# GNU which 2.20
# ==============
# Slackware 12.0, 12.1, 12.2: which 2.16
# Slackware 13.0, 13.1, 13.37: which 2.20
# As I write this, http://www.xs4all.nl/~carlo17/which/ redirects to
# http://carlo17.home.xs4all.nl/which/. 'which' is updated infrequently.
# If by the time you try this, the linked home page URL at the top does
# not get you anywhere, try the other one.
# If you want to uninstall which, or just clean up files from an old
# version before installing the new one, skip down to the bottom for
# instructions.
# Way back, 'which' used to be part of the Slackware 'bin' package.
# If you run an old Slackware, keep in mind that it may be referenced
# in /var/adm/packages/bin*
# Get it
cd
test -f installed/which-2.20.tar.gz && mv installed/which-2.20.tar.gz .
test ! -f which-2.20.tar.gz &&
wget http://www.xs4all.nl/~carlo17/which/which-2.20.tar.gz
# Extract the source
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "which-*" -exec rm -r {} \;
tar xzvf ~/which-2.20.tar.gz
cd which-2.20
test $UID = 0 && chown -R root.root .
# Configure and build it
./configure --prefix=/usr --docdir=/usr/doc/which --infodir=/usr/info \
--mandir=/usr/man
make
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg which
# Install it
make install
# Slackware's which is in /bin, this one is in /usr/sbin, create a symlink
# (or move it to /bin, create a link in /usr/bin if you prefer...)
ln -sf /usr/bin/which /bin/which
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become your non-root user again
exit
# Keep the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/which-*.tar.*
mv which-2.20.tar.gz installed/
# If you ever want to uninstall which, this should do it:
cd
su
test -d src/which-* && ( cd src/which-* ; make uninstall )
rm -f /usr/bin/which
test -d /usr/doc/which && rm -r /usr/doc/which
find /usr/doc -maxdepth 1 -type d -name "which-*" -exec rm -r {} \;
( cd /usr/info ; rm -f which.info which.info.gz )
( cd /usr/man/man1 ; rm -f which.1 which.1.gz )
exit
find ~/src -maxdepth 1 -type d -name "which-*" -exec rm -r {} \;
rm -f ~/installed/which-*.tar.*