mirror of
https://github.com/YunoHost-Apps/adguardhome_ynh.git
synced 2024-09-03 18:06:23 +02:00
Fix when the server doesn't have an ipv4/6
This commit is contained in:
parent
3836687675
commit
ab93de8dbc
2 changed files with 4 additions and 4 deletions
|
@ -125,8 +125,8 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Modifying a config file..." --weight=1
|
||||
|
||||
# echo the ip route command to prevent a crash if the server doesn't have any ipv4/6
|
||||
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+')
|
||||
ipv4_interface=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+' || true)
|
||||
ipv6_interface=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+' || true)
|
||||
|
||||
if [ -z "$ipv4_interface" ] && [ -z "$ipv6_interface" ]; then
|
||||
ynh_die --message="Impossible to find the main network interface, please report this issue."
|
||||
|
|
|
@ -137,8 +137,8 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
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+')
|
||||
ipv4_interface=$(echo "$(ip -4 route get 1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+' || true)
|
||||
ipv6_interface=$(echo "$(ip -6 route get ::1.2.3.4 2> /dev/null)" | head -n1 | grep -oP '(?<=dev )\w+' || true)
|
||||
|
||||
if [ -z "$ipv4_interface" ] && [ -z "$ipv6_interface" ]; then
|
||||
ynh_die --message="Impossible to find the main network interface, please report this issue."
|
||||
|
|
Loading…
Add table
Reference in a new issue