mirror of
https://github.com/itdoginfo/ansible-openwrt-hirkn.git
synced 2025-12-11 17:44:29 +05:00
Compare commits
7 Commits
1e7a3bb8f6
...
02f5e5e5c8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02f5e5e5c8 | ||
|
|
f6a6864080 | ||
|
|
86b9c1c075 | ||
|
|
7b1f1631b3 | ||
|
|
f3bf5dda15 | ||
|
|
ae9e42a578 | ||
|
|
a974ddef29 |
@@ -323,7 +323,19 @@ 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
|
||||
}
|
||||
s
|
||||
dnsmasqconfdir() {
|
||||
if [ $VERSION_ID -ge 24 ]; then
|
||||
if uci get dhcp.@dnsmasq[0].confdir | grep -q /tmp/dnsmasq.d; then
|
||||
printf "\033[32;1mconfdir already 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() {
|
||||
@@ -960,8 +972,8 @@ printf "\033[34;1mVersion: $OPENWRT_RELEASE\033[0m\n"
|
||||
|
||||
VERSION_ID=$(echo $VERSION | awk -F. '{print $1}')
|
||||
|
||||
if [ "$VERSION_ID" -ne 23 ]; then
|
||||
printf "\033[31;1mScript only support OpenWrt 23.05\033[0m\n"
|
||||
if [ "$VERSION_ID" -ne 23 ] && [ "$VERSION_ID" -ne 24 ]; then
|
||||
printf "\033[31;1mScript only support OpenWrt 23.05 and 24.10\033[0m\n"
|
||||
echo "For OpenWrt 21.02 and 22.03 you can:"
|
||||
echo "1) Use ansible https://github.com/itdoginfo/domain-routing-openwrt"
|
||||
echo "2) Configure manually. Old manual: https://itdog.info/tochechnaya-marshrutizaciya-na-routere-s-openwrt-wireguard-i-dnscrypt/"
|
||||
@@ -986,6 +998,8 @@ add_set
|
||||
|
||||
dnsmasqfull
|
||||
|
||||
dnsmasqconfdir
|
||||
|
||||
add_dns_resolver
|
||||
|
||||
add_getdomains
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user