# GNU coreutils 9.4
# =================
# coreutils first appeared in Slackware 9.1, prior to that there were
# individual "fileutils", "sh-utils", and "textutils" packages.
# Slackware 9.1 was released in 2003. Cleaning up of fileutils, sh-utils,
# and textutils is no longer handled in here.
# Get the source tarball
cd
test -f installed/coreutils-9.4.tar.xz &&
mv installed/coreutils-9.4.tar.xz .
test ! -f coreutils-9.4.tar.xz &&
wget https://ftpmirror.gnu.org/coreutils/coreutils-9.4.tar.xz
# Verify tarball w/ sha256sum from any coreutils version:
# (this is from my already-verified tarball)
echo "ea613a4cf44612326e917201bbbcdfbd301de21ffc3b59b6e5c07e040b275e\
52 coreutils-9.4.tar.xz" | sha256sum -c
# Verify tarball w/ cksum from coreutils >= 9.2:
# (this base64 encoded checksum is from the release announcement)
echo "6mE6TPRGEjJukXIBu7zfvTAd4h/8O1m25cB+BAsnXlI= coreutils-9.4.tar.xz" | \
cksum -a sha256 -c
# You can also create the base64-encoded checksum for comparison
# openssl is from OpenSSL
# sha256sum is from coreutils
# shasum is from Perl
# xxd is from vim
# sha256sum coreutils-9.4.tar.xz | xxd -r -p | base64
# shasum -a 256 coreutils-9.4.tar.xz | xxd -r -p | base64
# openssl sha256 -binary coreutils-9.4.tar.xz | openssl base64
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "coreutils-*" -exec rm -r {} \;
tar xJvf ~/coreutils-9.4.tar.xz
cd coreutils-9.4
test $UID = 0 && chown -R root:root .
# If you need to alter the source, run the ./bootstrap script
# See ./README-install
# Some utilities that are part of coreutils are included with other packages
# too:
# hostname (tcpip/net-tools and util-linux)
# kill (util-linux and procps/procps-ng)
# su (shadow)
# uptime (procps/procps-ng)
#
# coreutils, hostname and su are already not installed by default
# no need to use --enable-no-install-program for those
# Check the build
make -k check | tee log
grep FAIL log
# Become root to clean up old files and to install it
su
# Check the build as root
make -k check-root | tee log
grep FAIL log
rm log
# If you did not have these critical core utilities, you would be, well,
# screwed. So, either keep the package tarball itself just in case, and
# hope that you can re-install it, or copy a select few in to a backup
# directory. If everything goes very badly, at least you could run them
# directly with their full path.
mkdir -p -m 0700 ~/backup/coreutils
( cd /bin
cp -a cat chmod chown cp echo ls mkdir mv rm ~/backup/coreutils/ )
# Because we can't actually use removepkg to remove the old coreutils,
# because removepkg itself uses the programs in coreutils, remove
# files from old versions of coreutils manually:
rm -f /etc/DIR_COLORS /etc/profile.d/coreutils-dircolors.csh \
/etc/profile.d/coreutils-dircolors.sh /usr/info/coreutils.info.gz
find /usr/doc -maxdepth 1 -type d -name "coreutils-*" -exec rm -r {} \;
( cd /
grep -E "^usr/man/man1/.*\.1\.gz$" \
/var/adm/packages/coreutils-* | xargs rm )
find /usr/share/locale -type f -name coreutils.mo -exec rm {} \;
# Move the old package files, if there are any, to make them appear as if
# they were removed by removepkg:
find /var/adm/packages -type f -name "coreutils-*" \
-exec mv -f {} /var/adm/removed_packages/ \;
find /var/adm/scripts -type f -name "coreutils-*" \
-exec mv -f {} /var/adm/removed_scripts/ \;
# Install it
make install
# Create symlinks from /bin to /usr/bin
for file in [ arch b2sum base32 base64 basename basenc cat chcon chgrp \
chmod chown chroot cksum comm cp csplit cut date dcgen dd df dir \
dircolors dirname du echo env expand expr factor false fmt fold getlimits \
ginstall groups head hostid id join link ln logname ls make-prime-list \
md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt od paste \
pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir runcon \
seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort \
split stat stdbuf stty sum sync tac tail tee test timeout touch tr true \
truncate tsort tty uname unexpand uniq unlink users vdir wc who whoami yes;
do
test -e /usr/bin/${file} && rm -f /usr/bin/${file}
ln -sf /bin/${file} /usr/bin/${file}
done
# If you want a more robust profile script, see Slackware source for
# a (gzipped) .sh and a .csh version. The same location also has a (gzipped)
# /etc/DIR_COLORS that you cold use, but that is not required.
# http://ftp.slackware.com/pub/slackware/slackware64-15.0/source/a/coreutils/
#
# Otherwise, create a /etc/profile.d/coreutils-dircolors.sh which will set
# 'ls' with some common options and set up the LS_COLORS variable.
# If you have a really old version of Slackware that doesn't have
# /etc/profile.d/, add the alias line to /etc/profile (or ~/.bash_login or
# ~/.profile or ~/.bash_aliases) instead. dir and vdir aliases are not
# necessary, coreutils includes a copy of 'cp' as /bin/dir and /bin/vdir,
# but you want to keep those aliases if you want color support.
echo '#!/bin/sh' > /etc/profile.d/coreutils-dircolors.sh
echo "alias ls='ls --color=auto -F -b -T 0'" >> /etc/profile.d/coreutils-dircolors.sh
echo "alias dir='dir --color=auto'" >> /etc/profile.d/coreutils-dircolors.sh
echo "alias vdir='vdir --color=auto'" >> /etc/profile.d/coreutils-dircolors.sh
echo "alias d=dir" >> /etc/profile.d/coreutils-dircolors.sh
echo "alias v=vdir" >> /etc/profile.d/coreutils-dircolors.sh
echo "eval \`/bin/dircolors -b\`" >> /etc/profile.d/coreutils-dircolors.sh
chmod +x /etc/profile.d/coreutils-dircolors.sh
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Source coreutils-dircolors.sh so set the aliases and variables for
# your current shell (or log out, log in)
. /etc/profile.d/coreutils-dircolors.sh
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/coreutils-*.tar.*
mv coreutils-9.4.tar.xz installed/
# Keep an eye out for scripts that use the many utils in this package. If
# you find a script that is hard coded to use the path of a coreutils utility
# that isn't used any more, either update the script(s) to point to the new
# path, replace that part of the script with a call to which (`which ls` will
# cause the script to find where ls is and output it), or create a symlink
# from the binary to where the script thinks it is.