add library mode

This commit is contained in:
James Swineson 2019-08-24 14:42:32 +08:00 committed by GitHub
parent d57d102509
commit 9b00723bc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,6 +179,21 @@ clear_processes() {
}
# main procedure
LIBRARY_ONLY=0
while test $# -gt 0
do
case "$1" in
--lib) LIBRARY_ONLY=1
;;
esac
shift
done
if [[ $LIBRARY_ONLY -eq 1 ]]; then
# acting as a library only
exit 0
fi
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"