mirror of
https://github.com/routerich/RouterichAX3000_configs.git
synced 2026-01-01 14:18:46 +03:00
Add check packets install and stop/run and disable/enable
This commit is contained in:
@@ -88,6 +88,38 @@ install_awg_packages() {
|
|||||||
rm -rf "$AWG_DIR"
|
rm -rf "$AWG_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 "opkg update"
|
echo "opkg update"
|
||||||
opkg update
|
opkg update
|
||||||
|
|
||||||
@@ -306,9 +338,9 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\033[32;1mStop and disabled service 'youtubeUnblock'...\033[0m\n"
|
printf "\033[32;1mStop and disabled service 'youtubeUnblock' and 'ruantiblock'...\033[0m\n"
|
||||||
service youtubeUnblock stop
|
manage_package "youtubeUnblock" "disable" "stop"
|
||||||
service youtubeUnblock disable
|
manage_package "ruantiblock" "disable" "stop"
|
||||||
|
|
||||||
printf "\033[32;1mRestart firewall and network...\033[0m\n"
|
printf "\033[32;1mRestart firewall and network...\033[0m\n"
|
||||||
service firewall restart
|
service firewall restart
|
||||||
|
|||||||
@@ -5,6 +5,37 @@ DIR_BACKUP="/root/backup2"
|
|||||||
config_files="network
|
config_files="network
|
||||||
firewall"
|
firewall"
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
if [ -d "$DIR_BACKUP" ]
|
if [ -d "$DIR_BACKUP" ]
|
||||||
then
|
then
|
||||||
@@ -18,12 +49,11 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Stop and disabled autostart Podkop..."
|
echo "Stop and disabled autostart Podkop..."
|
||||||
service podkop disable
|
manage_package "podkop" "disable" "stop"
|
||||||
service podkop stop
|
|
||||||
|
|
||||||
echo "Run and enabled autostart youtubeUnblock..."
|
echo "Run and enabled autostart youtubeUnblock and ruantiblock..."
|
||||||
service youtubeUnblock enable
|
manage_package "youtubeUnblock" "enable" "start"
|
||||||
service youtubeUnblock start
|
manage_package "ruantiblock" "enable" "start"
|
||||||
|
|
||||||
printf "\033[32;1mRestart firewall and network...\033[0m\n"
|
printf "\033[32;1mRestart firewall and network...\033[0m\n"
|
||||||
service firewall restart
|
service firewall restart
|
||||||
|
|||||||
Reference in New Issue
Block a user