diff --git a/awg_config.sh b/awg_config.sh index 5e73e37..d3c73d7 100644 --- a/awg_config.sh +++ b/awg_config.sh @@ -301,7 +301,7 @@ done path_podkop_config="/etc/config/podkop" path_podkop_config_backup="/root/podkop" -URL="https://raw.githubusercontent.com/routerich/RouterichAX3000_configs/refs/heads/main" +URL="https://raw.githubusercontent.com/CodeRoK7/RouterichAX3000_configs/refs/heads/main" if [ -f "/etc/init.d/podkop" ]; then printf "Podkop installed. Reconfigured on AWG WARP? (y/n): \n" @@ -342,6 +342,14 @@ printf "\033[32;1mStop and disabled service 'youtubeUnblock' and 'ruantiblock'. manage_package "youtubeUnblock" "disable" "stop" manage_package "ruantiblock" "disable" "stop" +str=$(grep -i "0 4 \* \* \* wget -O - $URL/configure_zaprets.sh | sh" /etc/crontabs/root) +if [ ! -z "$str" ] +then + grep -v "0 4 \* \* \* wget -O - $URL/configure_zaprets.sh | sh" /etc/crontabs/root > /etc/crontabs/temp + cp -f "/etc/crontabs/temp" "/etc/crontabs/root" + rm -f "/etc/crontabs/temp" +fi + printf "\033[32;1mRestart firewall and network...\033[0m\n" service firewall restart service network restart diff --git a/configure_zaprets.sh b/configure_zaprets.sh index d382d7f..e3a33a2 100644 --- a/configure_zaprets.sh +++ b/configure_zaprets.sh @@ -1,6 +1,6 @@ #!/bin/sh -URL="https://raw.githubusercontent.com/routerich/RouterichAX3000_configs/refs/heads/main" +URL="https://raw.githubusercontent.com/CodeRoK7/RouterichAX3000_configs/refs/heads/main" DIR="/etc/config" DIR_BACKUP="/root/backup" config_files="dhcp @@ -21,6 +21,38 @@ checkAndAddDomainPermanentName() fi } +manage_package() { + local name="$1" + local autostart="$2" + local process="$3" + + # Проверка, установлен ли пакет + if opkg list-installed | grep -q "^$name"; then + + # Проверка, включен ли автозапуск + if /etc/init.d/$name enabled; then + if [ "$autostart" = "disable" ]; then + /etc/init.d/$name disable + fi + else + if [ "$autostart" = "enable" ]; then + /etc/init.d/$name enable + fi + fi + + # Проверка, запущен ли процесс + if pidof $name > /dev/null; then + if [ "$process" = "stop" ]; then + /etc/init.d/$name stop + fi + else + if [ "$process" = "start" ]; then + /etc/init.d/$name start + fi + fi + fi +} + echo "Upgrade packages..." opkg update @@ -147,6 +179,8 @@ then echo "$cronTask" >> /etc/crontabs/root fi +manage_package "podkop" "disable" "stop" + echo "Restart service..." service youtubeUnblock restart diff --git a/off_configure_zaprets.sh b/off_configure_zaprets.sh index a827626..db0bc44 100644 --- a/off_configure_zaprets.sh +++ b/off_configure_zaprets.sh @@ -1,6 +1,6 @@ #!/bin/sh -URL="https://raw.githubusercontent.com/routerich/RouterichAX3000_configs/refs/heads/main" +URL="https://raw.githubusercontent.com/CodeRoK7/RouterichAX3000_configs/refs/heads/main" DIR="/etc/config" DIR_BACKUP="/root/backup" config_files="dhcp @@ -27,8 +27,12 @@ service odhcpd restart echo "Remove cron task auto run script configure zaprets.." -grep -v "0 4 \* \* \* wget -O - $URL/configure_zaprets.sh | sh" /etc/crontabs/root > /etc/crontabs/temp -cp -f "/etc/crontabs/temp" "/etc/crontabs/root" -rm -f "/etc/crontabs/temp" +str=$(grep -i "0 4 \* \* \* wget -O - $URL/configure_zaprets.sh | sh" /etc/crontabs/root) +if [ ! -z "$str" ] +then + grep -v "0 4 \* \* \* wget -O - $URL/configure_zaprets.sh | sh" /etc/crontabs/root > /etc/crontabs/temp + cp -f "/etc/crontabs/temp" "/etc/crontabs/root" + rm -f "/etc/crontabs/temp" +fi printf "\033[32;1mOff configured completed...\033[0m"