cd
test -f installed/file-5.03.tar.gz && mv installed/file-5.03.tar.gz .
test ! -f file-5.03.tar.gz &&
wget ftp://ftp.astron.com/pub/file/file-5.03.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "file-*" -exec rm -r {} \;
tar xzvf ~/file-5.03.tar.gz
cd file-5.03
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --datadir=/etc --mandir=/usr/man \
--enable-fsect-man5
make
# Become root to clean up old files and to install it
su
# If you run Slackware >= 12.0, remove the 'file' package:
test -x /sbin/removepkg && /sbin/removepkg file
# Various versions of file put the magic related files in
# various places, look around in these places to see if you
# need to clean up any old files
# /etc/magic*
# /etc/file/
# /etc/misc/
# Remove old files
# (back up your old ones first if you've customized them)
( cd /etc ; rm -f magic magic.mgc magic.mime magic.mime.mgc )
test -d /etc/file && rm -r /etc/file
test -d /etc/misc && rm -r /etc/misc
rm -f /usr/lib/libmagic.*
# Install the new version
make install
ldconfig
# There are new Python bindings as of 4.06 To build and install them, do this.
# You should probably read python/README too, and don't forget to re-do this
# if you upgrade Python.
cd python
python setup.py build
PYDIR=`find /usr/lib -maxdepth 1 -type d -name "python?.*" | sort | tail -1`
test -n "$PYDIR" && cp build/lib.*/magic.so $PYDIR/lib-dynload/
unset PYDIR
chown -R $USER .
# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .