# Get the tarball
cd
test -f installed/sed-4.9.tar.xz && mv installed/sed-4.9.tar.xz .
test ! -f sed-4.9.tar.xz &&
wget http://ftpmirror.gnu.org/sed/sed-4.9.tar.xz
# Verify tarball w/ sha256sum:
# (this came from the info-gnu/Savannah release announcement)
# Either requires cksum from coreutils >= 9.2 or you have to do some
# extra handling because the checksum is base64 encoded
# biJrcy4c1zlGStaGK9Ghq6QteYKSLaelNRljHSSXUYE=
# ->
# sha256sum -b sed-4.9.tar.xz | xxd -r -p | base64
# -or-
# shasum -a 256 -b sed-4.9.tar.xz | xxd -r -p | base64
# -or-
# openssl sha256 -binary sed-4.9.tar.xz | openssl base64
# ->
echo "6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d249751\
81 sed-4.9.tar.xz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "sed-*" -exec rm -r {} \;
tar xJvf ~/sed-4.9.tar.xz
cd sed-4.9
test $UID = 0 && chown -R root:root .
# If you don't have a sed binary installed (./configure uses it), do
# this first:
./bootstrap
./configure --disable-xattr
make
su -c "cp sed/sed /bin/"
chmod -R u+w .
cd ..
rm -r ./sed-4.9
tar xJvf ~/sed-4.9.tar.xz
cd sed-4.9
test $UID = 0 && chown -R root:root .
# Probably a good idea to copy your existing /bin/sed just in case
# cp -a /bin/sed /root/
# Remove old files that may cause issues
find /usr/doc -maxdepth 1 -type d -name "sed-*" -exec rm -r {} \;
test -d /usr/doc/sed && rm -r /usr/doc/sed
rm -f /usr/info/sed.info* /usr/man/man1/sed.1*
find /usr/share/locale -type f -name "sed.mo" -exec rm {} \;
# Move the sed package to removed packages, because running removepkg
# may run sed...
find /var/adm/packages -type f -name "sed*" \
-exec mv -f {} /var/log/removed_packages/ \;
find /var/adm/scripts -type f -name "sed*" \
-exec mv -f {} /var/log/removed_scripts/ \;
# Install the new version, the sed binary will be stripped
make install-strip
# Everything prior to Slackware 9.0, and this HOWTO as well, put sed in
# /usr/bin. Slackware 9.0 puts sed in /bin and creates a symlink to it
# in /usr/bin. Makes sense, sed is important and if your /usr is actually
# a mount of a remote filesystem, sed might not exist early on during
# boot-up. So here we remove the old binary and create a symlink to the new
# one:
rm -f /usr/bin/sed
ln -sf /bin/sed /usr/bin/sed
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+rw .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/sed-*.tar.*
mv sed-4.9.tar.xz installed/