Merge pull request #33 from Akiyamov/master

Add confdir for snapshot
This commit is contained in:
itdoginfo
2024-12-16 00:17:23 +03:00
committed by GitHub
2 changed files with 33 additions and 1 deletions

View File

@@ -323,7 +323,20 @@ 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() {
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() {
@@ -986,6 +999,8 @@ add_set
dnsmasqfull
dnsmasqconfdir
add_dns_resolver
add_getdomains

View File

@@ -6,6 +6,15 @@
shell: opkg list-installed | grep dnsmasq-full | awk '{print $3}'
register: dnsmasqfull_version
- name: Check confdir option
shell: uci get dhcp.@dnsmasq[0].confdir
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
@@ -63,6 +72,14 @@
when: ansible_distribution_major_version >= "23" and list_domains and not dnsmasqfull_version.stdout
ignore_errors: true
- name: set confdir for dnsmasq
uci:
command: set
key: dhcp.@dnsmasq[0]
value:
confdir: "/tmp/dnsmasq.d"
when: dnsmasq_confdir.stdout != "/tmp/dnsmasq.d" and openwrt_major_release >= 24
# Getdomains script configure
- name: getdomains script copy