1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#!/bin/sh
SYSTEM=`uname -s`
echo "Finding your system..."
case ${SYSTEM} in
"Linux")
GPATH="/usr/sbin/groupadd"
GOPTS="slocate"
DBPATH="/var/lib/slocate"
UPREFIX="/usr/bin"
MANPAGE="slocate.1.linux"
echo "We have a winner! SYSTEM=Linux"
;;
"FreeBSD")
GPATH="/usr/sbin/pw"
GOPTS="groupadd slocate"
DBPATH="/var/db/slocate"
UPREFIX="/usr/libexec"
MANPAGE="slocate.1.other"
echo "We have a winner! SYSTEM=FreeBSD"
;;
*)
echo
echo "Could not find system type for groupadd."
echo
echo "Read the README.DOC file to install Secure Locate manually."
echo
exit 1
esac
user=`id -un`
instdir="/usr/bin"
echo
echo "Copying slocate to $instdir"
install -m 0755 slocate /usr/bin
$GPATH $GOPTS
CWD="`pwd`"
cd $instdir
echo
echo "Changing permisions on slocate"
chown $user:slocate slocate
chmod g+s ./slocate
cd $CWD
echo "Making Database Directory"
install -d -m 0750 $DBPATH
chown $user:slocate $DBPATH
echo "Creating Symlinks"
if [ -f /usr/bin/locate ] ; then
rm -f /usr/bin/locate.old
mv /usr/bin/locate /usr/bin/locate.old
chmod 700 /usr/bin/locate.old
fi
ln -s /usr/bin/slocate /usr/bin/locate
if [ -f $UPREFIX/updatedb ] ; then
rm -f $UPREFIX/updatedb.old
mv $UPREFIX/updatedb $UPREFIX/updatedb.old
fi
ln -s /usr/bin/slocate $UPREFIX/updatedb
echo "Installing man page"
if [ -d /usr/man ] ; then
mandir="/usr/man"
elif [ -d /usr/share/man ] ; then
mandir="/usr/share/man"
fi
if [ ! -f ./locate.1.gz ] ; then
cp $MANPAGE slocate.1
gzip slocate.1 >/dev/null 2>&1
fi
if [ ! -f ./updatedb.1.gz ] ; then
gzip updatedb.1 >/dev/null 2>&1
fi
if [ -f $mandir/man1/locate.1.gz ] ; then
mv -f $mandir/man1/locate.1.gz $mandir/man1/locate.old.1.gz
fi
if [ -f $mandir/man1/locate.1.gz ] ; then
mv -f $mandir/man1/updatedb.1.gz $mandir/man1/updatedb.old.1.gz
fi
install -m 0644 slocate.1.gz $mandir/man1/locate.1.gz
install -m 0644 updatedb.1.gz $mandir/man1/
rm slocate.1.gz >/dev/null 2>&1
gunzip updatedb.1.gz >/dev/null 2>&1
echo
echo "Install Complete!"
echo
|