mirror of
https://github.com/YunoHost-Apps/adguardhome_ynh.git
synced 2024-09-03 18:06:23 +02:00
edit the 'ip' commands because we need the IP without route too (they may be private IPs)
This commit is contained in:
parent
f4f916a8b2
commit
952f48f41a
4 changed files with 21 additions and 8 deletions
|
@ -33,11 +33,17 @@ set__open_port_53() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# regenerate config, needed to add or delete public IPs following the user's choice
|
# regenerate config, needed to add or delete public IPs following the user's choice
|
||||||
|
|
||||||
|
# get the name of the network interface in IPv4 and IPv6
|
||||||
|
ipv4_interface="$(get_network_interface 4)"
|
||||||
|
ipv6_interface="$(get_network_interface 6)"
|
||||||
|
|
||||||
# get IPv4 for the AGH config file
|
# get IPv4 for the AGH config file
|
||||||
ipv4_addr=$(process_ips "$(ip -4 route get 1.2.3.4 2> /dev/null | head -n1 | head -n1)")
|
ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)")
|
||||||
|
|
||||||
# get IPv6 for the AGH config file
|
# get IPv6 for the AGH config file
|
||||||
ipv6_addr=$(process_ips "$(ip -6 route get ::1.2.3.4 2> /dev/null | head -n1)")
|
# the 'sed' is used to get rid of the network prefix ('/64' for example)
|
||||||
|
ipv6_addr=$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')")
|
||||||
|
|
||||||
# update the IP adresses in the AGH config file
|
# update the IP adresses in the AGH config file
|
||||||
update_agh_config
|
update_agh_config
|
||||||
|
|
|
@ -85,10 +85,11 @@ ipv6_interface="$(get_network_interface 6)"
|
||||||
configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface"
|
configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface"
|
||||||
|
|
||||||
# get IPv4 for the AGH config file (with a starting "- ")
|
# get IPv4 for the AGH config file (with a starting "- ")
|
||||||
ipv4_addr=$(echo "- " "$(process_ips "$(ip -4 route get 1.2.3.4 2> /dev/null | head -n1 | head -n1)")")
|
ipv4_addr=$(echo "- " "$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)")")
|
||||||
|
|
||||||
# get IPv6 for the AGH config file (with a starting "- ")
|
# get IPv6 for the AGH config file (with a starting "- ")
|
||||||
ipv6_addr=$(echo "- " "$(process_ips "$(ip -6 route get ::1.2.3.4 2> /dev/null | head -n1)")")
|
# the 'sed' is used to get rid of the network prefix ('/64' for example)
|
||||||
|
ipv6_addr=$(echo "- " "$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')")")
|
||||||
|
|
||||||
password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())")
|
password=$(python3 -c "import bcrypt; print(bcrypt.hashpw(b\"$password\", bcrypt.gensalt(rounds=10)).decode())")
|
||||||
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
||||||
|
|
|
@ -52,10 +52,11 @@ ipv6_interface="$(get_network_interface 6)"
|
||||||
configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface"
|
configure_network_interface_dnsmasq "$ipv4_interface" "$ipv6_interface"
|
||||||
|
|
||||||
# get IPv4 for the AGH config file
|
# get IPv4 for the AGH config file
|
||||||
ipv4_addr=$(process_ips "$(ip -4 route get 1.2.3.4 2> /dev/null | head -n1 | head -n1)")
|
ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)")
|
||||||
|
|
||||||
# get IPv6 for the AGH config file
|
# get IPv6 for the AGH config file
|
||||||
ipv6_addr=$(process_ips "$(ip -6 route get ::1.2.3.4 2> /dev/null | head -n1)")
|
# the 'sed' is used to get rid of the network prefix ('/64' for example)
|
||||||
|
ipv6_addr=$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')")
|
||||||
|
|
||||||
# update the IP adresses in the AGH config file
|
# update the IP adresses in the AGH config file
|
||||||
update_agh_config
|
update_agh_config
|
||||||
|
|
|
@ -124,11 +124,16 @@ usermod -a -G ssl-cert "$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
|
# get the name of the network interface in IPv4 and IPv6
|
||||||
|
ipv4_interface="$(get_network_interface 4)"
|
||||||
|
ipv6_interface="$(get_network_interface 6)"
|
||||||
|
|
||||||
# get IPv4 for the AGH config file
|
# get IPv4 for the AGH config file
|
||||||
ipv4_addr=$(process_ips "$(ip -4 route get 1.2.3.4 2> /dev/null | head -n1 | head -n1)")
|
ipv4_addr=$(process_ips "$(ip -4 address show "$ipv4_interface" 2> /dev/null | grep inet)")
|
||||||
|
|
||||||
# get IPv6 for the AGH config file
|
# get IPv6 for the AGH config file
|
||||||
ipv6_addr=$(process_ips "$(ip -6 route get ::1.2.3.4 2> /dev/null | head -n1)")
|
# the 'sed' is used to get rid of the network prefix ('/64' for example)
|
||||||
|
ipv6_addr=$(process_ips "$(ip -6 address show "$ipv6_interface" 2> /dev/null | grep inet | sed 's&/.*&&')")
|
||||||
|
|
||||||
# update the IP adresses in the AGH config file
|
# update the IP adresses in the AGH config file
|
||||||
update_agh_config
|
update_agh_config
|
||||||
|
|
Loading…
Add table
Reference in a new issue