Skip to content

Instantly share code, notes, and snippets.

@abhijayrajvansh
Created September 6, 2024 05:07
Show Gist options
  • Save abhijayrajvansh/a48861d48f2f9729453e09cde4041765 to your computer and use it in GitHub Desktop.
Save abhijayrajvansh/a48861d48f2f9729453e09cde4041765 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Define the version you want to install
VERSION="1.34" # Replace with the desired version if needed
# Define the download URL for the specified version
URL="https://ftp.gnu.org/gnu/tar/tar-${VERSION}.tar.gz"
# Download the source code tarball
echo "Downloading GNU tar version ${VERSION}..."
curl -O "${URL}"
# Extract the downloaded tarball
echo "Extracting tarball..."
tar -xzf "tar-${VERSION}.tar.gz"
cd "tar-${VERSION}"
# Configure the build for your system with the included libiconv
echo "Configuring the build..."
./configure --with-included-libiconv
# Compile the source code
echo "Compiling GNU tar..."
make
# Install GNU tar
echo "Installing GNU tar..."
sudo make install
# Clean up
echo "Cleaning up..."
cd ..
rm -rf "tar-${VERSION}" "tar-${VERSION}.tar.gz"
echo "GNU tar version ${VERSION} has been installed successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment