mirror of
https://github.com/routerich/RouterichAX3000_configs.git
synced 2026-01-01 06:08:46 +03:00
Add check packets install and stop/run and disable/enable
This commit is contained in:
@@ -5,6 +5,37 @@ DIR_BACKUP="/root/backup2"
|
||||
config_files="network
|
||||
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" ]
|
||||
then
|
||||
@@ -18,12 +49,11 @@ then
|
||||
fi
|
||||
|
||||
echo "Stop and disabled autostart Podkop..."
|
||||
service podkop disable
|
||||
service podkop stop
|
||||
manage_package "podkop" "disable" "stop"
|
||||
|
||||
echo "Run and enabled autostart youtubeUnblock..."
|
||||
service youtubeUnblock enable
|
||||
service youtubeUnblock start
|
||||
echo "Run and enabled autostart youtubeUnblock and ruantiblock..."
|
||||
manage_package "youtubeUnblock" "enable" "start"
|
||||
manage_package "ruantiblock" "enable" "start"
|
||||
|
||||
printf "\033[32;1mRestart firewall and network...\033[0m\n"
|
||||
service firewall restart
|
||||
|
||||
Reference in New Issue
Block a user