posix-dergutils/install

19 lines
623 B
Bash
Executable File

#!/bin/sh
# Copies all of the executable files in non-hidden subdirectories into 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) ; do
cp -v "$file" "$DESTDIR$PREFIX/bin/$(echo $file | sed 's/.*\///')"
done
else
echo "Please install find and sed." >&2
exit 1
fi