diff --git a/src/freedombone-installer b/src/freedombone-installer index 75a6cd2852ce8e9edf2d8b846909b3830fddd02d..ea36f656a49d018e7e7e5467dcb3e117a03e3908 100755 --- a/src/freedombone-installer +++ b/src/freedombone-installer @@ -142,9 +142,8 @@ liquidsoap_script=/etc/liquidsoapuser/radio.liq IPV4_ADDRESS_TEST_DESTINATION='85.214.73.63' webadmin_ipv4_address= -function get_ipv4_address { - IPv4dev=$(ip route get $IPV4_ADDRESS_TEST_DESTINATION | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') - ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}' +function get_external_ipv4_address { + curl -s ipinfo.io/ip } function web_admin_background_color { @@ -1856,7 +1855,7 @@ function regenerate_dynamic_dns { fi sed -i "s|\"$ddns\"|\"$ddns\" selected|g" "$webadmin_install_dir/dynamicdns.html" sed -i "s|DDNS_USERNAME|$ddns_username|g" "$webadmin_install_dir/dynamicdns.html" - sed -i "s|CURRENT_IP_ADDRESS|$(get_ipv4_address)|g" "$webadmin_install_dir/dynamicdns.html" + sed -i "s|CURRENT_IP_ADDRESS|$(get_external_ipv4_address)|g" "$webadmin_install_dir/dynamicdns.html" # Note: For security don't populate the password #sed -i "s|DDNS_PASSWORD|$ddns_password|g" "$webadmin_install_dir/dynamicdns.html" chown www-data:www-data "$webadmin_install_dir/dynamicdns.html" @@ -2600,7 +2599,7 @@ function update_dynamic_dns { } function webadmin_monitor_ip_changes { - curr_ipv4=$(get_ipv4_address) + curr_ipv4=$(get_external_ipv4_address) if [[ "$curr_ipv4" != "$webadmin_ipv4_address" ]]; then webadmin_ipv4_address="$curr_ipv4" update_dynamic_dns diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index 90713becddcaaae6cfe351206922fc27fc06edcb..ad342adf96f0da9c82ee1d2504f6a552a6efd1c0 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -1091,7 +1091,7 @@ function regenerate_webadmin_dynamic_dns { fi sed -i "s|\"$ddns\"|\"$ddns\" selected|g" "$webadmin_install_dir/dynamicdns.html" sed -i "s|DDNS_USERNAME|$DDNS_USERNAME|g" "$webadmin_install_dir/dynamicdns.html" - sed -i "s|CURRENT_IP_ADDRESS|$(get_ipv4_address)|g" "$webadmin_install_dir/dynamicdns.html" + sed -i "s|CURRENT_IP_ADDRESS|$(get_external_ipv4_address)|g" "$webadmin_install_dir/dynamicdns.html" # Note: For security don't populate the password #sed -i "s|DDNS_PASSWORD|$DDNS_PASSWORD|g" "$webadmin_install_dir/dynamicdns.html" chown www-data:www-data "$webadmin_install_dir/dynamicdns.html"