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

fixing my mess

This commit is contained in:
Kay0u 2022-01-06 11:44:14 +01:00
parent 521118bd30
commit 1f1c5055f9
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
3 changed files with 11 additions and 10 deletions

View file

@ -28,8 +28,8 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port) adguard_port=$(ynh_app_setting_get --app=$app --key=adguard_port)
ipv4_route_output=$(ip -4 route get 1.2.3.4 2> /dev/null || true | head -n1) ipv4_route_output=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1)
ipv6_route_output=$(ip -6 route get ::1.2.3.4 2> /dev/null || true | head -n1) ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
ipv4_addr="" ipv4_addr=""
for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do

View file

@ -116,8 +116,9 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1 ynh_script_progression --message="Modifying a config file..." --weight=1
ipv4_interface=$(ip route get 1.2.3.4 2> /dev/null || true | head -n1 | grep -oP '(?<=dev )\w+') # echo the ip route command to prevent a crash if the server doesn't have any ipv4/6
ipv6_interface=$(ip -6 route get ::1.2.3.4 2> /dev/null || true | head -n1 | grep -oP '(?<=dev )\w+') ipv4_interface=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+')
ipv6_interface=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+')
if [ -z "$ipv4_interface" ] && [ -z "$ipv6_interface" ]; then if [ -z "$ipv4_interface" ] && [ -z "$ipv6_interface" ]; then
ynh_die --message="Impossible to find the main network interface, please report this issue." ynh_die --message="Impossible to find the main network interface, please report this issue."
@ -141,8 +142,8 @@ systemctl restart dnsmasq
ynh_store_file_checksum --file="/etc/dnsmasq.d/$app" ynh_store_file_checksum --file="/etc/dnsmasq.d/$app"
ipv4_route_output=$(ip -4 route get 1.2.3.4 2> /dev/null || true | head -n1) ipv4_route_output=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 | head -n1)
ipv6_route_output=$(ip -6 route get ::1.2.3.4 2> /dev/null || true | head -n1) ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
ipv4_addr="" ipv4_addr=""
for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do

View file

@ -121,8 +121,8 @@ ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
ipv4_interface=$(ip route get 1.2.3.4 2> /dev/null || true | head -n1 | grep -oP '(?<=dev )\w+') ipv4_interface=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+')
ipv6_interface=$(ip -6 route get ::1.2.3.4 2> /dev/null || true | head -n1 | grep -oP '(?<=dev )\w+') ipv6_interface=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+')
if [ -z "$ipv4_interface" ] && [ -z "$ipv6_interface" ]; then if [ -z "$ipv4_interface" ] && [ -z "$ipv6_interface" ]; then
ynh_die --message="Impossible to find the main network interface, please report this issue." ynh_die --message="Impossible to find the main network interface, please report this issue."
@ -146,8 +146,8 @@ systemctl restart dnsmasq
ynh_store_file_checksum --file="/etc/dnsmasq.d/$app" ynh_store_file_checksum --file="/etc/dnsmasq.d/$app"
ipv4_route_output=$(ip -4 route get 1.2.3.4 2> /dev/null || true | head -n1) ipv4_route_output=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1)
ipv6_route_output=$(ip -6 route get ::1.2.3.4 2> /dev/null || true | head -n1) ipv6_route_output=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1)
ipv4_addr="" ipv4_addr=""
for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do for i in $(seq "$(echo $ipv4_route_output | wc -w)" -1 1); do