mirror of
https://github.com/bol-van/zapret.git
synced 2025-04-19 13:32:58 +03:00
install_easy : press enter on all exit paths
This commit is contained in:
parent
4b19e6f409
commit
c21b6eec16
@ -23,12 +23,21 @@ GET_IPLIST=$EXEDIR/ipset/get_antizapret.sh
|
|||||||
GET_IPLIST_PREFIX=$EXEDIR/ipset/get_
|
GET_IPLIST_PREFIX=$EXEDIR/ipset/get_
|
||||||
|
|
||||||
|
|
||||||
|
exitp()
|
||||||
|
{
|
||||||
|
echo
|
||||||
|
echo press enter to continue
|
||||||
|
read A
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo \* checking system ...
|
echo \* checking system ...
|
||||||
|
|
||||||
SYSTEMCTL=$(which systemctl)
|
SYSTEMCTL=$(which systemctl)
|
||||||
[ ! -x "$SYSTEMCTL" ] && {
|
[ ! -x "$SYSTEMCTL" ] && {
|
||||||
echo not systemd based system
|
echo not systemd based system
|
||||||
exit 5
|
exitp 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +57,7 @@ echo \* checking location ...
|
|||||||
rm -r "$ZAPRET_BASE"
|
rm -r "$ZAPRET_BASE"
|
||||||
else
|
else
|
||||||
echo refused to overwrite $ZAPRET_BASE. exiting
|
echo refused to overwrite $ZAPRET_BASE. exiting
|
||||||
exit 3
|
exitp 3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cp -R $EXEDIR $ZAPRET_BASE
|
cp -R $EXEDIR $ZAPRET_BASE
|
||||||
@ -56,7 +65,7 @@ echo \* checking location ...
|
|||||||
exec $ZAPRET_BASE/$(basename $0)
|
exec $ZAPRET_BASE/$(basename $0)
|
||||||
else
|
else
|
||||||
echo copying aborted. exiting
|
echo copying aborted. exiting
|
||||||
exit 3
|
exitp 3
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
echo running from $EXEDIR
|
echo running from $EXEDIR
|
||||||
@ -70,16 +79,16 @@ if [ ! -x "$LSB_INSTALL" ] || [ ! -x "$LSB_REMOVE" ] || ! which ipset >/dev/null
|
|||||||
APTGET=$(which apt-get)
|
APTGET=$(which apt-get)
|
||||||
[ ! -x "$APTGET" ] && {
|
[ ! -x "$APTGET" ] && {
|
||||||
echo not apt based system
|
echo not apt based system
|
||||||
exit 5
|
exitp 5
|
||||||
}
|
}
|
||||||
"$APTGET" update
|
"$APTGET" update
|
||||||
"$APTGET" install -y --no-install-recommends ipset curl lsb-core dnsutils || {
|
"$APTGET" install -y --no-install-recommends ipset curl lsb-core dnsutils || {
|
||||||
echo could not install prerequisites
|
echo could not install prerequisites
|
||||||
exit 6
|
exitp 6
|
||||||
}
|
}
|
||||||
[ ! -x "$LSB_INSTALL" ] || [ ! -x "$LSB_REMOVE" ] && {
|
[ ! -x "$LSB_INSTALL" ] || [ ! -x "$LSB_REMOVE" ] && {
|
||||||
echo lsb install scripts not found
|
echo lsb install scripts not found
|
||||||
exit 7
|
exitp 7
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo everything is present
|
echo everything is present
|
||||||
@ -109,7 +118,7 @@ script_mode=Y
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo aborted
|
echo aborted
|
||||||
exit 3
|
exitp 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@ -126,7 +135,7 @@ echo \* registering init script ...
|
|||||||
"$LSB_REMOVE" $INIT_SCRIPT
|
"$LSB_REMOVE" $INIT_SCRIPT
|
||||||
"$LSB_INSTALL" $INIT_SCRIPT || {
|
"$LSB_INSTALL" $INIT_SCRIPT || {
|
||||||
echo could not register $INIT_SCRIPT with LSB
|
echo could not register $INIT_SCRIPT with LSB
|
||||||
exit 20
|
exitp 20
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -134,7 +143,7 @@ echo \* downloading blocked ip list ...
|
|||||||
|
|
||||||
"$GET_IPLIST" || {
|
"$GET_IPLIST" || {
|
||||||
echo could not download ip list
|
echo could not download ip list
|
||||||
exit 25
|
exitp 25
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,11 +166,7 @@ echo \* starting zapret service ...
|
|||||||
|
|
||||||
systemctl start zapret || {
|
systemctl start zapret || {
|
||||||
echo could not start zapret service
|
echo could not start zapret service
|
||||||
exit 30
|
exitp 30
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
exitp 0
|
||||||
echo finished. press any key to continue.
|
|
||||||
read A
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
@ -18,12 +18,22 @@ INIT_SCRIPT_SRC=$EXEDIR/init.d/debian/zapret
|
|||||||
INIT_SCRIPT=/etc/init.d/zapret
|
INIT_SCRIPT=/etc/init.d/zapret
|
||||||
GET_IPLIST_PREFIX=$EXEDIR/ipset/get_
|
GET_IPLIST_PREFIX=$EXEDIR/ipset/get_
|
||||||
|
|
||||||
|
|
||||||
|
exitp()
|
||||||
|
{
|
||||||
|
echo
|
||||||
|
echo press enter to continue
|
||||||
|
read A
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo \* checking system ...
|
echo \* checking system ...
|
||||||
|
|
||||||
SYSTEMCTL=$(which systemctl)
|
SYSTEMCTL=$(which systemctl)
|
||||||
[ ! -x "$SYSTEMCTL" ] && {
|
[ ! -x "$SYSTEMCTL" ] && {
|
||||||
echo not systemd based system
|
echo not systemd based system
|
||||||
exit 5
|
exitp 5
|
||||||
}
|
}
|
||||||
|
|
||||||
echo \* stopping service and unregistering init script with LSB ...
|
echo \* stopping service and unregistering init script with LSB ...
|
||||||
@ -66,8 +76,4 @@ if grep -q "$GET_IPLIST_PREFIX" $CRONTMP; then
|
|||||||
fi
|
fi
|
||||||
rm -f $CRONTMP
|
rm -f $CRONTMP
|
||||||
|
|
||||||
echo
|
exitp 0
|
||||||
echo finished. press any key to continue.
|
|
||||||
read A
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user