posix-dergutils/uninstall

20 lines
620 B
Bash
Executable File

#!/bin/sh
# Removes all of the executable filenames found in non-hidden subdirectories from an installation directory and prefix.
# Requires find and sed to work.
if type sed && type find ; then
if [ "$DESTDIR" = "" ] ; then
if [ -d "$1" ] ; then DESTDIR="$1" ; else DESTDIR="$HOME" ; fi
fi
if [ "$PREFIX" = "" ] ; then
if [ "$2" != "" ] && [ -d "$DESTDIR$2" ] ; then PREFIX="$2" ; else PREFIX="/.local" ; fi
fi
for file in $(find ./ -not -path '*/.*' -path './*/*' -type f -perm 755 | sed 's/.*\///') ; do
rm -vf "$DESTDIR$PREFIX/bin/$file"
done
else
echo "Please install find and sed." >&2
exit 1
fi