Linux HOWTOs

About | Home | Search


HOWTO: tar
Description: The GNU version of the tar archiving utility
Click here for ChangeLog
NOTE: it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# GNU tar 1.26
# ============
# Slackware 12.1, 12.2: tar 1.16.1
# Slackware 13.0: tar 1.22
# Slackware 13.1: tar 1.23
# Slackware 13.37: tar 1.26

# Prerequisites:
# gzip
# Bison
# gettext
# iconv

# If the download site used below is busy, try one of these:
# http://mirrors.ibiblio.org/pub/mirrors/gnu/ftp/gnu/tar/
# http://ftp.gnu.org/gnu/tar/

# This will clean up old versions of tar and will create the necessary
# directories for installing everything below.  If you're replacing a
# Slackware-installed tar package, removing that package will leave a
# /bin/tar binary behind, because it's called 'tar-incoming' in the package.
cd
su
mkdir -p -m 0700 ~/installed ~/src
test -x /sbin/removepkg && /sbin/removepkg tar
find ~/src -maxdepth 1 -type d -name "tar-*" -exec rm -r {} \;
find /usr/share/locale -type f -name "tar.mo" -exec rm {} \;
find /bin -type l -name "tar-*" -exec rm {} \;
exit

# Below we use the shar (SHell ARchive) format instead of .tar.gz or
# .tar.bz2, that way you don't need to already have tar installed to install
# tar.  You'll need gunzip to decompress the shar.gz file, and the shar file
# itself requires uudecode.  uudecode is part of the GNU sharutils package.
# If you have gmime installed, be aware that the 1.13 and 1.14 shar files
# failed to decompress (it hung on certain files) for me with gmime's version
# of uudecode.  I removed the temporary directory (_sh?????) that it left
# behind, I temporarily renamed uudecode to uudecode.old, copied the
# sharutils version from another box, and then it decompressed successfully
# (then restored the gmime version of uudecode).

# Here we install tar 1.13, patched to add bzip2 (-y) support.  This
# particular version is used by the Slackware package utilities.

# Not sure why, but I was unable to build this on one Slackware 11.0
# machine, but was able to build it on a Slackware 9.1 machine (both
# far from stock Slackware).
# If you have trouble building it too, here's a binary:
# http://englanders.us/pub/linux/misc/tar-1.13
# Install it as /bin/tar-1.13

cd
test -f installed/tar-1.13.shar.gz && mv installed/tar-1.13.shar.gz .
test ! -f tar-1.13.shar.gz &&
 wget http://ftpmirror.gnu.org/tar/tar-1.13.shar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "tar-*" -exec rm -r {} \;
zcat ~/tar-1.13.shar.gz | sh
cd tar-1.13
test $UID = 0 && chown -R root:root .

# Patch it to add bzip2 support via -y (it's -j in later versions of tar)
wget -nc http://englanders.us/pub/linux/patches/notmine/\
tar-1.13-bzip2.diff &&
 patch -p0 < tar-1.13-bzip2.diff
./configure --prefix=/usr --disable-nls
make

# Become root to install it
su

# Install this version as tar-1.13
install -s src/tar /bin/tar-1.13

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+rw .

# Become yourself again
exit

# Remove old version tarballs, put the installed ones in ~/installed/:
cd
rm -f installed/installed/tar-*.shar*
mv tar-1.13.shar.gz installed/


# And now the current version
cd
test -f installed/tar-1.26.tar.bz2 && mv installed/tar-1.26.tar.bz2 .
test ! -f tar-1.26.tar.bz2 &&
 wget http://ftpmirror.gnu.org/tar/tar-1.26.tar.bz2

# Verify tarball w/ md5sum:
echo "2cee42a2ff4f1cd4f9298eeeb2264519  tar-1.26.tar.bz2" | md5sum -c

# Verify tarball w/ sha1sum:
# (this came from my gpg-verified tarball)
echo "70f298c3cd997b694864c55e6d8655324c87a0cc  tar-1.26.tar.bz2" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 55D0C732 > /dev/null 2>&1 || gpg --recv-keys 55D0C732 ) &&
 wget -nc http://ftpmirror.gnu.org/tar/tar-1.26.tar.bz2.sig &&
 gpg --verify tar-1.26.tar.bz2.sig && rm tar-1.26.tar.bz2.sig

mkdir -p -m 0700 src
cd src
/bin/tar-1.13 xyvf ~/tar-1.26.tar.bz2
cd tar-1.26
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man \
--disable-nls --enable-backup-scripts
make

# Become root to install it
su

# Remove files that may cause issues later
make install-strip

mv -f /usr/bin/tar /bin/
ln -sf /bin/tar /usr/bin/tar
ln -sf /usr/libexec/rmt /etc/rmt
ln -sf /usr/libexec/rmt /sbin/rmt

# Become yourself again
exit

# Remove old version tarballs, put the installed ones in ~/installed/:
cd
rm -f installed/tar-*.tar.*
mv tar-1.26.tar.bz2 installed/

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>