mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-11 17:29:16 +05:00
install_easy: readonly system check
This commit is contained in:
parent
294140de97
commit
e6e8ca1d4a
@ -184,6 +184,26 @@ check_system()
|
||||
echo system is based on $SYSTEM
|
||||
}
|
||||
|
||||
check_readonly_system()
|
||||
{
|
||||
local RO
|
||||
echo \* checking readonly system
|
||||
case $SYSTEM in
|
||||
systemd)
|
||||
[ -w "$SYSTEMD_SYSTEM_DIR" ] || RO=1
|
||||
;;
|
||||
openrc)
|
||||
[ -w "$(dirname "$INIT_SCRIPT")" ] || RO=1
|
||||
;;
|
||||
esac
|
||||
[ -z "$RO" ] || {
|
||||
echo '!!! READONLY SYSTEM DETECTED !!!'
|
||||
echo '!!! WILL NOT BE ABLE TO CONFIGURE STARTUP !!!'
|
||||
echo '!!! MANUAL STARTUP CONFIGURATION IS REQUIRED !!!'
|
||||
ask_yes_no N "do you want to continue" || exitp 5
|
||||
}
|
||||
}
|
||||
|
||||
check_bins()
|
||||
{
|
||||
echo \* checking executables
|
||||
@ -697,6 +717,7 @@ service_install_systemd()
|
||||
{
|
||||
echo \* installing zapret service
|
||||
|
||||
if [ -w "$SYSTEMD_SYSTEM_DIR" ] ; then
|
||||
rm -f "$INIT_SCRIPT"
|
||||
ln -fs "$EXEDIR/init.d/systemd/zapret.service" "$SYSTEMD_SYSTEM_DIR"
|
||||
"$SYSTEMCTL" daemon-reload
|
||||
@ -704,6 +725,9 @@ service_install_systemd()
|
||||
echo could not enable systemd service
|
||||
exitp 20
|
||||
}
|
||||
else
|
||||
echo '!!! READONLY SYSTEM DETECTED !!! CANNOT INSTALL SYSTEMD UNITS !!!'
|
||||
fi
|
||||
}
|
||||
|
||||
service_stop_systemd()
|
||||
@ -729,6 +753,7 @@ timer_install_systemd()
|
||||
{
|
||||
echo \* installing zapret-list-update timer
|
||||
|
||||
if [ -w "$SYSTEMD_SYSTEM_DIR" ] ; then
|
||||
"$SYSTEMCTL" disable zapret-list-update.timer
|
||||
"$SYSTEMCTL" stop zapret-list-update.timer
|
||||
ln -fs "$EXEDIR/init.d/systemd/zapret-list-update.service" "$SYSTEMD_SYSTEM_DIR"
|
||||
@ -742,6 +767,9 @@ timer_install_systemd()
|
||||
echo could not start zapret-list-update.timer
|
||||
exitp 30
|
||||
}
|
||||
else
|
||||
echo '!!! READONLY SYSTEM DETECTED !!! CANNOT INSTALL SYSTEMD UNITS !!!'
|
||||
fi
|
||||
}
|
||||
|
||||
download_list()
|
||||
@ -785,6 +813,7 @@ crontab_add()
|
||||
[ -x "$GET_LIST" ] && {
|
||||
echo \* adding crontab entry
|
||||
|
||||
if exists crontab; then
|
||||
CRONTMP=/tmp/cron.tmp
|
||||
crontab -l >$CRONTMP 2>/dev/null
|
||||
if grep -q "$GET_LIST_PREFIX" $CRONTMP; then
|
||||
@ -795,8 +824,10 @@ crontab_add()
|
||||
echo "$(random 0 59) $(random $1 $2) */2 * * $GET_LIST" >>$CRONTMP
|
||||
crontab $CRONTMP
|
||||
fi
|
||||
|
||||
rm -f $CRONTMP
|
||||
else
|
||||
echo '!!! CRON IS ABSENT !!! LISTS AUTO UPDATE WILL NOT WORK !!!'
|
||||
fi
|
||||
}
|
||||
}
|
||||
cron_ensure_running()
|
||||
@ -899,6 +930,7 @@ install_systemd()
|
||||
|
||||
check_bins
|
||||
require_root
|
||||
check_readonly_system
|
||||
check_location copy_all
|
||||
check_prerequisites_linux
|
||||
service_stop_systemd
|
||||
@ -968,6 +1000,7 @@ _install_sysv()
|
||||
|
||||
check_bins
|
||||
require_root
|
||||
check_readonly_system
|
||||
check_location copy_all
|
||||
check_prerequisites_linux
|
||||
service_stop_sysv
|
||||
|
Loading…
Reference in New Issue
Block a user