contrib/gcc34/post-remove

36 lines
824 B
Bash
Executable File

#!/usr/bin/env sh
if [ -e '/usr/ports/contrib/gcc34/Pkgfile' ]; then
. /usr/ports/contrib/gcc34/Pkgfile
else
echo 'post-install: error Pkgfile is missing.'
exit 1
fi
SUFFIX="-${version%.*}"
SYMLINKS="cc${SUFFIX} c++${SUFFIX} gcc${SUFFIX} g++${SUFFIX}"
unset SUFFIX
remove() {
local DIRECTORY="$1"
if [ -d "$DIRECTORY" ]; then
if [ -w "$DIRECTORY" ]; then
for c in $SYMLINKS; do
if [ -L "$DIRECTORY/$c" ]; then
rm "$DIRECTORY/$c"
if [ $? -gt 0 ]; then
echo "post-remove: error removing symlink '$DIRECTORY/$c'."
exit 1
else
echo "post-remove: removing symlink '$DIRECTORY/$c'."
fi
fi
done
else
echo "post-remove: error no permission to remove '$DIRECTORY/$c'."
exit 1
fi
fi
}
remove '/usr/lib/distcc'
remove '/usr/lib/ccache'
unset SYMLINKS
# End of file