2 Commits

Author SHA1 Message Date
Akiyamov
86b9c1c075 Major release for ansible 2024-12-05 18:35:01 +05:00
Akiyamov
7b1f1631b3 Execute confdir only for 24 and newer versions 2024-12-05 15:55:03 +05:00
2 changed files with 17 additions and 9 deletions

View File

@@ -323,18 +323,22 @@ dnsmasqfull() {
opkg remove dnsmasq && opkg install dnsmasq-full --cache /tmp/
[ -f /etc/config/dhcp-opkg ] && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp
fi
fi
}
dnsmasqconfdir() {
if uci get dhcp.@dnsmasq[0].confdir | grep -q /tmp/dnsmasq.d; then
printf "\033[32;1mconfdir alreadt set\033[0m\n"
else
printf "\033[32;1mSetting confdir\033[0m\n"
uci set dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
uci commit dhcp
fi
openwrt_release=$(cat /etc/openwrt_release | grep -Eo [0-9]{2}[.][0-9]{2}[.][0-9]* | cut -d '.' -f 1 | tail -n 1)
if [ $openwrt_release -ge 24 ]; then
if uci get dhcp.@dnsmasq[0].confdir | grep -q /tmp/dnsmasq.d; then
printf "\033[32;1mconfdir alreadt set\033[0m\n"
else
printf "\033[32;1mSetting confdir\033[0m\n"
uci set dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
uci commit dhcp
fi
fi
}
remove_forwarding() {
if [ ! -z "$forward_id" ]; then
while uci -q delete firewall.@forwarding[$forward_id]; do :; done

View File

@@ -11,6 +11,10 @@
register: dnsmasq_confdir
ignore_errors: true
- name: Get openwrt major release
shell: cat /etc/openwrt_release | grep -Eo [0-9]{2}[.][0-9]{2}[.][0-9]* | cut -d '.' -f 1 | tail -n 1
register: openwrt_major_release
- name: debug
debug:
var: ansible_distribution_major_version
@@ -74,7 +78,7 @@
key: dhcp.@dnsmasq[0]
value:
confdir: "/tmp/dnsmasq.d"
when: dnsmasq_confdir.stdout != "/tmp/dnsmasq.d"
when: dnsmasq_confdir.stdout != "/tmp/dnsmasq.d" and openwrt_major_release >= 24
# Getdomains script configure