1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00

add a specific config for dnsmasq

This commit is contained in:
Kay0u 2022-01-04 14:00:07 +01:00
parent e965af96b5
commit 036747440f
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
4 changed files with 35 additions and 0 deletions

View file

@ -41,6 +41,7 @@ ynh_print_info --message="Declaring files to be backed up..."
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="/etc/dnsmasq.d/$app"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -116,6 +116,21 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
ipv4_interface=$(ip route get 1.2.3.4 | grep -oP '(?<=dev )\w+')
ipv6_interface=$(ip -6 route get ::1.2.3.4 | grep -oP '(?<=dev )\w+')
if [ "$ipv4_interface" != "$ipv6_interface" ]; then
echo "bind-interfaces
except-interface=$ipv4_interface, $ipv6_interface" > "/etc/dnsmasq.d/$app"
else
echo "bind-interfaces
except-interface=$ipv4_interface" > "/etc/dnsmasq.d/$app"
fi
systemctl restart dnsmasq
ynh_store_file_checksum --file="/etc/dnsmasq.d/$app"
ipv4_route_output=$(ip -4 route get 1.2.3.4 | head -n1)
ipv6_route_output=$(ip -6 route get ::1.2.3.4 | head -n1)

View file

@ -66,6 +66,10 @@ chown -R $app: "$final_path"
setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $final_path/AdGuardHome
ynh_restore_file --origin_path="/etc/dnsmasq.d/$app"
systemctl restart dnsmasq
#=================================================
# SPECIFIC RESTORATION
#=================================================

View file

@ -121,6 +121,21 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ipv4_interface=$(ip route get 1.2.3.4 | grep -oP '(?<=dev )\w+')
ipv6_interface=$(ip -6 route get ::1.2.3.4 | grep -oP '(?<=dev )\w+')
if [ "$ipv4_interface" != "$ipv6_interface" ]; then
echo "bind-interfaces
except-interface=$ipv4_interface, $ipv6_interface" > "/etc/dnsmasq.d/$app"
else
echo "bind-interfaces
except-interface=$ipv4_interface" > "/etc/dnsmasq.d/$app"
fi
systemctl restart dnsmasq
ynh_store_file_checksum --file="/etc/dnsmasq.d/$app"
ipv4_route_output=$(ip -4 route get 1.2.3.4 | head -n1)
ipv6_route_output=$(ip -6 route get ::1.2.3.4 | head -n1)