1dcab4d1e3
* Fix py3 version changed even version control enabled issue * Add some comments and simplify the script * Add the comment to explain how to get the not hooked command
35 lines
576 B
Bash
Executable File
35 lines
576 B
Bash
Executable File
#!/bin/bash
|
|
|
|
HOOK_PATH=/usr/local/share/buildinfo/hooks
|
|
TARGET_PATH=/usr/local/sbin
|
|
FILES=$(ls $HOOK_PATH)
|
|
|
|
usage()
|
|
{
|
|
echo "Usage: $0 [-d]"
|
|
exit 1
|
|
}
|
|
|
|
DISABLE=n
|
|
while getopts "d" opt; do
|
|
case $opt in
|
|
d)
|
|
DISABLE=y
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
|
|
for f in $FILES
|
|
do
|
|
if [ $DISABLE == "n" ]; then
|
|
[ ! -e $TARGET_PATH/$f ] && ln -s $HOOK_PATH/$f $TARGET_PATH/$f
|
|
else
|
|
([ -e $TARGET_PATH/$f ] && ls -l $TARGET_PATH/$f | grep -q $HOOK_PATH) && rm -f $TARGET_PATH/$f
|
|
fi
|
|
done
|
|
|
|
exit 0
|