diff --git a/zapret-control.sh b/zapret-control.sh index 241d3cd..f0dc749 100755 --- a/zapret-control.sh +++ b/zapret-control.sh @@ -49,6 +49,10 @@ detect_init() { INIT_SYSTEM="openrc" elif command -v runit >/dev/null 2>&1; then INIT_SYSTEM="runit" + [ -f /etc/os-release ] && . /etc/os-release + if [ $ID = artix ]; then + INIT_SYSTEM="runit-artix" + fi elif [ -x /sbin/init ] && /sbin/init --version 2>&1 | grep -qi "sysv init"; then INIT_SYSTEM="sysvinit" else @@ -73,7 +77,10 @@ check_zapret_exist() { fi ;; runit) - service_exists=true + ls /var/service | grep -q "zapret" && service_exists=true || service_exists=false + ;; + runit-artix) + ls /run/runit/service | grep -q "zapret" && service_exists=true || service_exists=false ;; openrc) rc-service -l | grep -q "zapret" && service_exists=true || service_exists=false @@ -148,6 +155,10 @@ check_zapret_status() { sv status zapret | grep -q "run" && ZAPRET_ACTIVE=true || ZAPRET_ACTIVE=false ls /var/service | grep -q "zapret" && ZAPRET_ENABLED=true || ZAPRET_ENABLED=false ;; + runit-artix) + sv status zapret | grep -q "run" && ZAPRET_ACTIVE=true || ZAPRET_ACTIVE=false + ls /run/runit/service | grep -q "zapret" && ZAPRET_ENABLED=true || ZAPRET_ENABLED=false + ;; sysvinit) service zapret status >/dev/null 2>&1 && ZAPRET_ACTIVE=true || ZAPRET_ACTIVE=false ;; @@ -311,7 +322,7 @@ manage_service() { openrc) rc-service zapret "$1" ;; - runit) + runit|runit-artix) sv "$1" zapret ;; sysvinit) @@ -334,6 +345,13 @@ manage_autostart() { rm -f /var/service/zapret fi ;; + runit-artix) + if [[ "$1" == "enable" ]]; then + ln -fs /opt/zapret/init.d/runit/zapret/ /run/runit/service/ + else + rm -f /run/runit/service/zapret + fi + ;; sysvinit) if [[ "$1" == "enable" ]]; then update-rc.d zapret defaults @@ -364,7 +382,7 @@ install_dependencies() { ["centos"]="yum install -y ipset iptables" ["void"]="xbps-install -y iptables ipset" ["gentoo"]="emerge net-firewall/iptables net-firewall/ipset" - ["opensuse"]="zypper install iptables ipset" + ["opensuse"]="zypper install -y iptables ipset" ["openwrt"]="opkg install iptables ipset" ["altlinux"]="apt-get install -y iptables ipset" ) @@ -668,7 +686,7 @@ update_zapret_menu(){ update_zapret() { if [[ -d /opt/zapret ]]; then - cd /opt/zapret && git fetch origin master; git reset --hard origin/master + cd /opt/zapret && git fetch origin main; git reset --hard origin/main fi if [[ -d /opt/zapret/zapret.cfgs ]]; then cd /opt/zapret/zapret.cfgs && git fetch origin main; git reset --hard origin/main