mirror of
https://github.com/bol-van/zapret.git
synced 2025-04-22 15:02:58 +03:00
install_easy : copy itself to /opt/zapret
This commit is contained in:
parent
14ba5e6813
commit
4b19e6f409
@ -14,6 +14,7 @@
|
||||
|
||||
SCRIPT=$(readlink -f $0)
|
||||
EXEDIR=$(dirname $SCRIPT)
|
||||
ZAPRET_BASE=/opt/zapret
|
||||
LSB_INSTALL=/usr/lib/lsb/install_initd
|
||||
LSB_REMOVE=/usr/lib/lsb/remove_initd
|
||||
INIT_SCRIPT_SRC=$EXEDIR/init.d/debian/zapret
|
||||
@ -21,6 +22,7 @@ INIT_SCRIPT=/etc/init.d/zapret
|
||||
GET_IPLIST=$EXEDIR/ipset/get_antizapret.sh
|
||||
GET_IPLIST_PREFIX=$EXEDIR/ipset/get_
|
||||
|
||||
|
||||
echo \* checking system ...
|
||||
|
||||
SYSTEMCTL=$(which systemctl)
|
||||
@ -29,6 +31,37 @@ SYSTEMCTL=$(which systemctl)
|
||||
exit 5
|
||||
}
|
||||
|
||||
|
||||
echo \* checking location ...
|
||||
|
||||
[ "$EXEDIR" != "$ZAPRET_BASE" ] && {
|
||||
echo easy install is supported only from default location : $ZAPRET_BASE
|
||||
echo currenlty its run from $EXEDIR
|
||||
echo -n "do you want the installer to copy it for you (Y/N) ? "
|
||||
read A
|
||||
if [ "$A" = "Y" ] || [ "$A" = "y" ]; then
|
||||
if [ -d "$ZAPRET_BASE" ]; then
|
||||
echo installer found existing $ZAPRET_BASE
|
||||
echo -n "do you want to delete all files there and copy this version (Y/N) ? "
|
||||
read A
|
||||
if [ "$A" = "Y" ] || [ "$A" = "y" ]; then
|
||||
rm -r "$ZAPRET_BASE"
|
||||
else
|
||||
echo refused to overwrite $ZAPRET_BASE. exiting
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
cp -R $EXEDIR $ZAPRET_BASE
|
||||
echo relaunching itself from $ZAPRET_BASE
|
||||
exec $ZAPRET_BASE/$(basename $0)
|
||||
else
|
||||
echo copying aborted. exiting
|
||||
exit 3
|
||||
fi
|
||||
}
|
||||
echo running from $EXEDIR
|
||||
|
||||
|
||||
echo \* checking prerequisites ...
|
||||
|
||||
if [ ! -x "$LSB_INSTALL" ] || [ ! -x "$LSB_REMOVE" ] || ! which ipset >/dev/null || ! which curl >/dev/null ; then
|
||||
@ -76,6 +109,7 @@ script_mode=Y
|
||||
;;
|
||||
*)
|
||||
echo aborted
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ SYSTEMCTL=$(which systemctl)
|
||||
|
||||
echo \* stopping service and unregistering init script with LSB ...
|
||||
|
||||
"$SYSTEMCTL" disable zapret
|
||||
"$SYSTEMCTL" stop zapret
|
||||
[ -f "$INIT_SCRIPT" ] && "$LSB_REMOVE" $INIT_SCRIPT
|
||||
|
||||
@ -48,6 +49,10 @@ script_mode=Y
|
||||
fi
|
||||
}
|
||||
|
||||
echo \* systemd cleanup ...
|
||||
|
||||
"$SYSTEMCTL" daemon-reload
|
||||
|
||||
echo \* removing crontab entry ...
|
||||
|
||||
CRONTMP=/tmp/cron.tmp
|
||||
|
Loading…
x
Reference in New Issue
Block a user