1
0
forked from ports/contrib

distcc: minor improvements to post-install and post-remove

This commit is contained in:
Danny Rawlins 2008-05-08 21:51:46 +10:00
parent f296f95f4f
commit d5c9441c43
2 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/env sh
DIRECTORY='/usr/lib/distcc'
SYMLINKS='cc c++ gcc g++'
unset NOT_INSTALLED
if [ ! -d "$DIRECTORY" ]; then
if [ -w '/usr/lib' ]; then
install -d "$DIRECTORY"
@ -8,21 +10,30 @@ if [ ! -d "$DIRECTORY" ]; then
else
echo "post-install: '$DIRECTORY' created."
fi
pushd "$DIRECTORY"
for c in cc c++ gcc g++; do
if [ ! -e $c ]; then
ln -s ../../bin/distcc $c
cd "$DIRECTORY"
for c in $SYMLINKS; do
if [ ! -e "$DIRECTORY/$c" ]; then
NOT_INSTALLED='yes'
fi
done
if [ "$NOT_INSTALLED" ]; then
echo "post-install: in directory '$DIRECTORY'."
fi
for c in $SYMLINKS; do
if [ ! -e "$DIRECTORY/$c" ]; then
ln -s '../../bin/distcc' "$c"
if [ $? -gt 0 ]; then
echo "post-install: error creating symlink '../../bin/distcc $c'."
echo "post-install: error creating symlink '../../bin/distcc -> $c'."
exit 1
else
echo "post-install: create symlink '../../bin/distcc $c'."
echo "post-install: create symlink '../../bin/distcc -> $c'."
fi
fi
done
popd
cd - > /dev/null
else
echo "Error: no permission to write to '/usr/lib'."
echo "post-install: error no permission to create symlinks in '$DIRECTORY'."
fi
fi
unset NOT_INSTALLED SYMLINKS DIRECTORY
# End of file

View File

@ -12,4 +12,5 @@ if [ -d "$DIRECTORY" ]; then
echo "post-remove: error no permission to remove '$DIRECTORY'."
fi
fi
unset DIRECTORY
# End of file