Listing 1: share-generic
#! /bin/sh
#
# share-generic:
# @(#) Move non-OS-dependent programs to share directories
#
PATH=/bin:/usr/bin; export PATH
SHARE=/export/share
if [ $# -eq 0 ]; then
echo "usage: `basename $0` <file> [ <file> ... ]" >&2
exit 1
fi
cd $SHARE
for target
do
targetdir=`dirname $target`
if [ ! -f "generic/devel/$target" ]; then
echo "${SHARE}/generic/devel/$target does not exist!" >&2
[ ! "$targetdir" ] &&
echo "Hint: try 'bin/<file>' or 'man/man1/<file>'." >&2
exit 1
fi
if [ "$targetdir" = bin ]; then
mode=555
elif [ "$targetdir" = lib -o "`dirname $targetdir`" = man ]; then
mode=444
else
mode=a-w
fi
cp generic/devel/$target generic/share/$target
chmod $mode generic/share/$target
rm -f SunOS5/share/$target
ln generic/share/$target SunOS5/share/$target
rm -f SunOS4/share/$target
ln generic/share/$target SunOS4/share/$target
done
exit 0
# End of File
|