mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-13 18:28:34 +05:00
install_easy: openrc support
This commit is contained in:
parent
02343afba7
commit
7c85d8c6c4
@ -198,3 +198,7 @@ v40
|
|||||||
|
|
||||||
init scripts : IFACE_LAN, IFACE_WAN now accept multiple interfaces
|
init scripts : IFACE_LAN, IFACE_WAN now accept multiple interfaces
|
||||||
init scripts : openwrt uses now OPENWRT_LAN parameter to override incoming interfaces for tpws
|
init scripts : openwrt uses now OPENWRT_LAN parameter to override incoming interfaces for tpws
|
||||||
|
|
||||||
|
v41
|
||||||
|
|
||||||
|
install_easy : openrc support
|
||||||
|
@ -629,7 +629,7 @@ And you can start or stop the demons separately from the firewall:
|
|||||||
Simple install to desktop linux system
|
Simple install to desktop linux system
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
Simple install works on most modern linux distributions with systemd, OpenWRT and MacOS.
|
Simple install works on most modern linux distributions with systemd or openrc, OpenWRT and MacOS.
|
||||||
Run install_easy.sh and answer its questions.
|
Run install_easy.sh and answer its questions.
|
||||||
|
|
||||||
Simple install to openwrt
|
Simple install to openwrt
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
zapret v.40
|
zapret v.41
|
||||||
|
|
||||||
English
|
English
|
||||||
-------
|
-------
|
||||||
@ -1037,14 +1037,16 @@ stop : rc-service zapret stop
|
|||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
install_easy.sh автоматизирует описанные выше ручные варианты процедур установки.
|
install_easy.sh автоматизирует описанные выше ручные варианты процедур установки.
|
||||||
Он поддерживает OpenWRT, linux системы на базе systemd и MacOS.
|
Он поддерживает OpenWRT, linux системы на базе systemd или openrc и MacOS.
|
||||||
|
|
||||||
Для более гибкой настройки перед запуском инсталятора следует выполнить раздел "Выбор параметров".
|
Для более гибкой настройки перед запуском инсталятора следует выполнить раздел "Выбор параметров".
|
||||||
|
|
||||||
Если система на базе systemd, но используется не поддерживаемый инсталятором менеджер пакетов
|
Если система запуска поддерживается, но используется не поддерживаемый инсталятором менеджер пакетов
|
||||||
или названия пакетов не соответствуют прописанным в инсталятор, пакеты нужно установить вручную.
|
или названия пакетов не соответствуют прописанным в инсталятор, пакеты нужно установить вручную.
|
||||||
Требуется : ipset curl
|
Требуется : ipset curl
|
||||||
|
|
||||||
|
Для совсем обрезанных дистрибутивов (alpine) требуется отдельно установить iptables и ip6tables.
|
||||||
|
|
||||||
В комплекте идут статические бинарики для большинства архитектур. Какой-то из них подойдет
|
В комплекте идут статические бинарики для большинства архитектур. Какой-то из них подойдет
|
||||||
с вероятностью 99%. Но если у вас экзотическая система, инсталятор попробует собрать бинарики сам
|
с вероятностью 99%. Но если у вас экзотическая система, инсталятор попробует собрать бинарики сам
|
||||||
через make. Для этого нужны gcc, make и необходимые -dev пакеты. Можно форсировать режим
|
через make. Для этого нужны gcc, make и необходимые -dev пакеты. Можно форсировать режим
|
||||||
|
123
install_easy.sh
123
install_easy.sh
@ -161,8 +161,11 @@ check_system()
|
|||||||
SYSTEM=systemd
|
SYSTEM=systemd
|
||||||
elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then
|
elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then
|
||||||
SYSTEM=openwrt
|
SYSTEM=openwrt
|
||||||
|
elif exists /sbin/openrc-run || exists /usr/sbin/openrc-run ; then
|
||||||
|
SYSTEM=openrc
|
||||||
else
|
else
|
||||||
echo system is not either systemd based or openwrt. check readme.txt for manual setup info.
|
echo system is not either systemd, openrc or openwrt based
|
||||||
|
echo check readme.txt for manual setup info.
|
||||||
exitp 5
|
exitp 5
|
||||||
fi
|
fi
|
||||||
elif [ "$UNAME" = "Darwin" ]; then
|
elif [ "$UNAME" = "Darwin" ]; then
|
||||||
@ -625,8 +628,16 @@ check_prerequisites_linux()
|
|||||||
{
|
{
|
||||||
echo \* checking prerequisites
|
echo \* checking prerequisites
|
||||||
|
|
||||||
|
if exists iptables && exists ip6tables ; then
|
||||||
|
echo iptables present
|
||||||
|
else
|
||||||
|
# looks like it's a limited system. will not guess how to install base tools
|
||||||
|
echo '! iptables/ip6tables NOT present. you must install them manually.'
|
||||||
|
exitp 5
|
||||||
|
fi
|
||||||
|
|
||||||
if exists ipset && exists curl ; then
|
if exists ipset && exists curl ; then
|
||||||
echo everything is present
|
echo ipset and curl are present
|
||||||
else
|
else
|
||||||
echo \* installing prerequisites
|
echo \* installing prerequisites
|
||||||
|
|
||||||
@ -635,6 +646,7 @@ check_prerequisites_linux()
|
|||||||
PACMAN=$(whichq pacman)
|
PACMAN=$(whichq pacman)
|
||||||
ZYPPER=$(whichq zypper)
|
ZYPPER=$(whichq zypper)
|
||||||
EOPKG=$(whichq eopkg)
|
EOPKG=$(whichq eopkg)
|
||||||
|
APK=$(whichq apk)
|
||||||
if [ -x "$APTGET" ] ; then
|
if [ -x "$APTGET" ] ; then
|
||||||
"$APTGET" update
|
"$APTGET" update
|
||||||
"$APTGET" install -y --no-install-recommends ipset curl dnsutils || {
|
"$APTGET" install -y --no-install-recommends ipset curl dnsutils || {
|
||||||
@ -662,6 +674,11 @@ check_prerequisites_linux()
|
|||||||
echo could not install prerequisites
|
echo could not install prerequisites
|
||||||
exitp 6
|
exitp 6
|
||||||
}
|
}
|
||||||
|
elif [ -x "$APK" ] ; then
|
||||||
|
"$APK" add ipset curl || {
|
||||||
|
echo could not install prerequisites
|
||||||
|
exitp 6
|
||||||
|
}
|
||||||
else
|
else
|
||||||
echo supported package manager not found
|
echo supported package manager not found
|
||||||
echo you must manually install : ipset curl
|
echo you must manually install : ipset curl
|
||||||
@ -895,6 +912,82 @@ install_systemd()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
install_sysv_init()
|
||||||
|
{
|
||||||
|
# $1 - "0"=disable
|
||||||
|
echo \* installing init script
|
||||||
|
|
||||||
|
[ -x "$INIT_SCRIPT" ] && {
|
||||||
|
"$INIT_SCRIPT" stop
|
||||||
|
"$INIT_SCRIPT" disable
|
||||||
|
}
|
||||||
|
ln -fs "$INIT_SCRIPT_SRC" "$INIT_SCRIPT"
|
||||||
|
[ "$1" != "0" ] && "$INIT_SCRIPT" enable
|
||||||
|
}
|
||||||
|
|
||||||
|
install_openrc_init()
|
||||||
|
{
|
||||||
|
# $1 - "0"=disable
|
||||||
|
echo \* installing init script
|
||||||
|
|
||||||
|
[ -x "$INIT_SCRIPT" ] && {
|
||||||
|
"$INIT_SCRIPT" stop
|
||||||
|
rc-update del zapret
|
||||||
|
}
|
||||||
|
ln -fs "$INIT_SCRIPT_SRC" "$INIT_SCRIPT"
|
||||||
|
[ "$1" != "0" ] && rc-update add zapret
|
||||||
|
}
|
||||||
|
|
||||||
|
service_start_sysv()
|
||||||
|
{
|
||||||
|
echo \* starting zapret service
|
||||||
|
|
||||||
|
"$INIT_SCRIPT" start || {
|
||||||
|
echo could not start zapret service
|
||||||
|
exitp 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service_stop_sysv()
|
||||||
|
{
|
||||||
|
[ -x "$INIT_SCRIPT" ] && {
|
||||||
|
echo \* stopping zapret service
|
||||||
|
"$INIT_SCRIPT" stop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_install_sysv()
|
||||||
|
{
|
||||||
|
# $1 - install init script
|
||||||
|
INIT_SCRIPT_SRC="$EXEDIR/init.d/sysv/zapret"
|
||||||
|
|
||||||
|
check_bins
|
||||||
|
require_root
|
||||||
|
check_location copy_all
|
||||||
|
check_prerequisites_linux
|
||||||
|
service_stop_sysv
|
||||||
|
install_binaries
|
||||||
|
check_dns
|
||||||
|
select_ipv6
|
||||||
|
ask_config
|
||||||
|
$1
|
||||||
|
download_list
|
||||||
|
crontab_del_quiet
|
||||||
|
# desktop system. more likely up at daytime
|
||||||
|
crontab_add 10 22
|
||||||
|
service_start_sysv
|
||||||
|
}
|
||||||
|
|
||||||
|
install_sysv()
|
||||||
|
{
|
||||||
|
_install_sysv install_sysv_init
|
||||||
|
}
|
||||||
|
|
||||||
|
install_openrc()
|
||||||
|
{
|
||||||
|
_install_sysv install_openrc_init
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
check_kmod()
|
check_kmod()
|
||||||
{
|
{
|
||||||
@ -1134,29 +1227,6 @@ deoffload_openwrt_firewall()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_sysv_init()
|
|
||||||
{
|
|
||||||
# $1 - "0"=disable
|
|
||||||
echo \* installing init script
|
|
||||||
|
|
||||||
[ -x "$INIT_SCRIPT" ] && {
|
|
||||||
"$INIT_SCRIPT" stop
|
|
||||||
"$INIT_SCRIPT" disable
|
|
||||||
}
|
|
||||||
ln -fs "$INIT_SCRIPT_SRC" "$INIT_SCRIPT"
|
|
||||||
[ "$1" != "0" ] && "$INIT_SCRIPT" enable
|
|
||||||
}
|
|
||||||
|
|
||||||
service_start_sysv()
|
|
||||||
{
|
|
||||||
echo \* starting zapret service
|
|
||||||
|
|
||||||
"$INIT_SCRIPT" start || {
|
|
||||||
echo could not start zapret service
|
|
||||||
exitp 30
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
install_openwrt()
|
install_openwrt()
|
||||||
@ -1275,6 +1345,9 @@ case $SYSTEM in
|
|||||||
systemd)
|
systemd)
|
||||||
install_systemd
|
install_systemd
|
||||||
;;
|
;;
|
||||||
|
openrc)
|
||||||
|
install_openrc
|
||||||
|
;;
|
||||||
openwrt)
|
openwrt)
|
||||||
install_openwrt
|
install_openwrt
|
||||||
;;
|
;;
|
||||||
|
@ -7,8 +7,12 @@ EXEDIR="$(cd "$EXEDIR"; pwd)"
|
|||||||
IPSET_DIR="$EXEDIR/ipset"
|
IPSET_DIR="$EXEDIR/ipset"
|
||||||
|
|
||||||
GET_LIST_PREFIX=/ipset/get_
|
GET_LIST_PREFIX=/ipset/get_
|
||||||
SYSTEMD_SYSTEM_DIR=/lib/systemd/system
|
|
||||||
[ -d "$SYSTEMD_SYSTEM_DIR" ] || SYSTEMD_SYSTEM_DIR=/usr/lib/systemd/system
|
SYSTEMD_DIR=/lib/systemd
|
||||||
|
[ -d "$SYSTEMD_DIR" ] || SYSTEMD_DIR=/usr/lib/systemd
|
||||||
|
[ -d "$SYSTEMD_DIR" ] && SYSTEMD_SYSTEM_DIR="$SYSTEMD_DIR/system"
|
||||||
|
|
||||||
|
INIT_SCRIPT=/etc/init.d/zapret
|
||||||
|
|
||||||
exists()
|
exists()
|
||||||
{
|
{
|
||||||
@ -48,16 +52,22 @@ check_system()
|
|||||||
|
|
||||||
local UNAME=$(uname)
|
local UNAME=$(uname)
|
||||||
if [ "$UNAME" = "Linux" ]; then
|
if [ "$UNAME" = "Linux" ]; then
|
||||||
if [ -x "$SYSTEMCTL" ] ; then
|
# some distros include systemctl without systemd
|
||||||
|
if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMD_DIR/systemd" ] && [ -x "$SYSTEMCTL" ]; then
|
||||||
SYSTEM=systemd
|
SYSTEM=systemd
|
||||||
elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then
|
elif [ -f "/etc/openwrt_release" ] && exists opkg && exists uci ; then
|
||||||
SYSTEM=openwrt
|
SYSTEM=openwrt
|
||||||
|
elif exists /sbin/openrc-run || exists /usr/sbin/openrc-run ; then
|
||||||
|
SYSTEM=openrc
|
||||||
else
|
else
|
||||||
echo system is not either systemd based or openwrt. check readme.txt for manual setup info.
|
echo system is not either systemd, openrc or openwrt based
|
||||||
|
echo check readme.txt for manual setup info.
|
||||||
exitp 5
|
exitp 5
|
||||||
fi
|
fi
|
||||||
elif [ "$UNAME" = "Darwin" ]; then
|
elif [ "$UNAME" = "Darwin" ]; then
|
||||||
SYSTEM=macos
|
SYSTEM=macos
|
||||||
|
# MacOS echo from /bin/sh does not support -n
|
||||||
|
ECHON=printf
|
||||||
else
|
else
|
||||||
echo easy installer only supports Linux and MacOS. check readme.txt for supported systems and manual setup info.
|
echo easy installer only supports Linux and MacOS. check readme.txt for supported systems and manual setup info.
|
||||||
exitp 5
|
exitp 5
|
||||||
@ -117,8 +127,6 @@ timer_remove_systemd()
|
|||||||
|
|
||||||
remove_systemd()
|
remove_systemd()
|
||||||
{
|
{
|
||||||
INIT_SCRIPT=/etc/init.d/zapret
|
|
||||||
|
|
||||||
service_stop_systemd
|
service_stop_systemd
|
||||||
service_remove_systemd
|
service_remove_systemd
|
||||||
timer_remove_systemd
|
timer_remove_systemd
|
||||||
@ -126,6 +134,36 @@ remove_systemd()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
service_remove_sysv()
|
||||||
|
{
|
||||||
|
echo \* removing zapret service
|
||||||
|
|
||||||
|
[ -x "$INIT_SCRIPT" ] && {
|
||||||
|
"$INIT_SCRIPT" disable
|
||||||
|
"$INIT_SCRIPT" stop
|
||||||
|
}
|
||||||
|
rm -f "$INIT_SCRIPT"
|
||||||
|
}
|
||||||
|
|
||||||
|
service_remove_openrc()
|
||||||
|
{
|
||||||
|
echo \* removing zapret service
|
||||||
|
|
||||||
|
[ -x "$INIT_SCRIPT" ] && {
|
||||||
|
rc-update del zapret
|
||||||
|
"$INIT_SCRIPT" stop
|
||||||
|
}
|
||||||
|
rm -f "$INIT_SCRIPT"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
remove_openrc()
|
||||||
|
{
|
||||||
|
OPENWRT_FW_INCLUDE=/etc/firewall.zapret
|
||||||
|
|
||||||
|
service_remove_openrc
|
||||||
|
crontab_del
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -188,20 +226,9 @@ remove_openwrt_iface_hook()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
service_remove_sysv()
|
|
||||||
{
|
|
||||||
echo \* removing zapret service
|
|
||||||
|
|
||||||
[ -x "$INIT_SCRIPT" ] && {
|
|
||||||
"$INIT_SCRIPT" disable
|
|
||||||
"$INIT_SCRIPT" stop
|
|
||||||
}
|
|
||||||
rm -f "$INIT_SCRIPT"
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_openwrt()
|
remove_openwrt()
|
||||||
{
|
{
|
||||||
INIT_SCRIPT=/etc/init.d/zapret
|
|
||||||
OPENWRT_FW_INCLUDE=/etc/firewall.zapret
|
OPENWRT_FW_INCLUDE=/etc/firewall.zapret
|
||||||
|
|
||||||
remove_openwrt_firewall
|
remove_openwrt_firewall
|
||||||
@ -247,6 +274,9 @@ case $SYSTEM in
|
|||||||
systemd)
|
systemd)
|
||||||
remove_systemd
|
remove_systemd
|
||||||
;;
|
;;
|
||||||
|
openrc)
|
||||||
|
remove_openrc
|
||||||
|
;;
|
||||||
openwrt)
|
openwrt)
|
||||||
remove_openwrt
|
remove_openwrt
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user