1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Set Pi-Hole state when VPS script start

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-09-06 07:54:47 +02:00
parent a78da33f37
commit 403488eb53

View file

@ -171,6 +171,21 @@ _get_vps_config() {
_set_config_from_vps
fi
piholeomr="$(uci -q get openmptcprouter.${servername}.pihole)"
pihole="$(echo "$vps_config" | jsonfilter -q -e '@.pihole.state')"
if [ "$pihole" = "true" ] && [ "$piholeomr" != "1" ]; then
uci -q batch <<-EOF >/dev/null
set openmptcprouter.${servername}.pihole='1'
commit openmptcprouter
EOF
elif [ "$pihole" = "false" ] && [ "$piholeomr" != "0" ]; then
uci -q batch <<-EOF >/dev/null
set openmptcprouter.${servername}.pihole='0'
commit openmptcprouter
EOF
fi
vps_kernel="$(echo "$vps_config" | jsonfilter -q -e '@.vps.kernel')"
vps_machine="$(echo "$vps_config" | jsonfilter -q -e '@.vps.machine')"
vps_omr_version="$(echo "$vps_config" | jsonfilter -q -e '@.vps.omr_version')"