mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-08 04:26:55 +03:00
refactor: add handler_network_restart
This commit is contained in:
14
install.sh
14
install.sh
@@ -24,6 +24,12 @@ else
|
|||||||
[ -f /etc/config/dhcp-opkg ] && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp
|
[ -f /etc/config/dhcp-opkg ] && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
IS_SHOULD_RESTART_NETWORK=false
|
||||||
|
|
||||||
|
handler_network_restart() {
|
||||||
|
IS_SHOULD_RESTART_NETWORK=true
|
||||||
|
}
|
||||||
|
|
||||||
install_awg_packages() {
|
install_awg_packages() {
|
||||||
# Получение pkgarch с наибольшим приоритетом
|
# Получение pkgarch с наибольшим приоритетом
|
||||||
PKGARCH=$(opkg print-architecture | awk 'BEGIN {max=0} {if ($3 > max) {max = $3; arch = $2}} END {print arch}')
|
PKGARCH=$(opkg print-architecture | awk 'BEGIN {max=0} {if ($3 > max) {max = $3; arch = $2}} END {print arch}')
|
||||||
@@ -237,6 +243,8 @@ wg_awg_setup() {
|
|||||||
uci set firewall.@forwarding[-1].family='ipv4'
|
uci set firewall.@forwarding[-1].family='ipv4'
|
||||||
uci commit firewall
|
uci commit firewall
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
handler_network_restart
|
||||||
}
|
}
|
||||||
|
|
||||||
add_tunnel() {
|
add_tunnel() {
|
||||||
@@ -317,5 +325,7 @@ opkg install $DOWNLOAD_DIR/luci-app-podkop*.ipk
|
|||||||
|
|
||||||
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk
|
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk
|
||||||
|
|
||||||
printf "\033[32;1mRestart network\033[0m\n"
|
if [ "$IS_SHOULD_RESTART_NETWORK" ]; then
|
||||||
service network restart
|
printf "\033[32;1mRestart network\033[0m\n"
|
||||||
|
/etc/init.d/network restart
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user