diff --git a/check_process b/check_process old mode 100755 new mode 100644 diff --git a/conf/AdGuardHome.yaml b/conf/AdGuardHome.yaml index 4651b48..9e1fdd9 100644 --- a/conf/AdGuardHome.yaml +++ b/conf/AdGuardHome.yaml @@ -13,7 +13,8 @@ debug_pprof: false web_session_ttl: 720 dns: bind_hosts: - - 0.0.0.0 + __IPV4_ADDR__ + __IPV6_ADDR__ port: __ADGUARD_PORT__ statistics_interval: 1 querylog_enabled: true diff --git a/scripts/install b/scripts/install index 6b1c157..12bc39e 100644 --- a/scripts/install +++ b/scripts/install @@ -60,7 +60,7 @@ port=$(ynh_find_port --port=3000) ynh_app_setting_set --app=$app --key=port --value=$port # Find an available port -adguard_port=$(ynh_find_port --port=53) +adguard_port=53 ynh_app_setting_set --app=$app --key=adguard_port --value=$adguard_port # Disable the port 53 for upnp @@ -116,6 +116,27 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 +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) + +ipv4_addr="" +for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do + ip=$(echo $ipv4_route_output | awk "{print \$$i}") + if ynh_validate_ip4 --ip_address=$ip; then + ipv4_addr="- $ip" + break + fi +done + +ipv6_addr="" +for i in $(seq "$(echo $ipv6_route_output | wc -w)" -1 1); do + ip=$(echo $ipv6_route_output | awk "{print \$$i}") + if ynh_validate_ip6 --ip_address=$ip; then + ipv6_addr="- $ip" + break + fi +done + # Main config File ynh_add_config --template="../conf/AdGuardHome.yaml" --destination="$final_path/AdGuardHome.yaml"