diff --git a/scripts/_variables b/scripts/_variables index 8b2b08b..98b1bab 100644 --- a/scripts/_variables +++ b/scripts/_variables @@ -1,7 +1,8 @@ #!/bin/bash # Dependencies -app_depencencies="dhcpcd5 sqlite idn2" +app_depencencies="sqlite idn2" +# dhcpcd5 has been removed because it can cause some problems with the internet connection. if [ "$(lsb_release --codename --short)" != "jessie" ]; then app_depencencies="$app_depencencies php-sqlite3" else diff --git a/scripts/change_url b/scripts/change_url index 6340ecc..5e0d06c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,6 +21,12 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME +#================================================= +# LOAD SETTINGS +#================================================= + +final_path=$(ynh_app_setting_get $app final_path) + #================================================= # CHECK THE SYNTAX OF THE PATHS #================================================= diff --git a/scripts/install b/scripts/install index aa35dbd..2421fa7 100644 --- a/scripts/install +++ b/scripts/install @@ -188,7 +188,7 @@ ynh_exec_warn_less systemctl enable pihole-FTL setupVars="$pihole_storage/setupVars.conf" # Trouve l'interface réseau par défaut -main_iface=$(route | grep default | awk '{print $8;}' | head -n1) +main_iface=$(ip route | grep default | awk '{print $5;}') echo "PIHOLE_INTERFACE=$main_iface" > $setupVars echo "IPV4_ADDRESS=127.0.0.1" >> $setupVars echo "IPV6_ADDRESS=" >> $setupVars @@ -237,7 +237,7 @@ ynh_replace_string "^cache-size=" "#pihole# cache-size=" /etc/dnsmasq.conf #================================================= # Trouve l'ipv4 associée à l'interface trouvée -localipv4=$(ifconfig | grep -A 1 "$main_iface" | tail -1 | awk '{print $2;}' | cut -d: -f2) +localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1) # Liste les domaines de yunohost while read perdomain @@ -268,9 +268,9 @@ then a_range=$(( $b_range - $dhcp_range )) # Get the gateway - gateway=$(route | grep default | awk '{print $2;}' | head -n1) + gateway=$(ip route | grep default | awk '{print $3;}') # And the mac adress - hw_adress=$(ifconfig | grep "eth0" | awk '{print $5;}') + hw_adress=$(ip link | grep -A1 "$main_iface" | tail -n1 | awk '{print $2;}') # Copy the config file cp "../conf/02-pihole-dhcp.conf" "/etc/dnsmasq.d/" diff --git a/scripts/restore b/scripts/restore index 8dd239f..d87b5a2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -150,9 +150,9 @@ ynh_replace_string "^cache-size=" "#pihole# cache-size=" /etc/dnsmasq.conf #================================================= # Trouve l'interface réseau par défaut -main_iface=$(route | grep default | awk '{print $8;}' | head -n1) +main_iface=$(ip route | grep default | awk '{print $5;}') # Trouve l'ipv4 associée à l'interface trouvée -localipv4=$(ifconfig | grep -A 1 "$main_iface" | tail -1 | awk '{print $2;}' | cut -d: -f2) +localipv4=$(ip address | grep "${main_iface}\$" | awk '{print $2;}' | cut -d/ -f1) # Liste les domaines de yunohost while read perdomain diff --git a/scripts/upgrade b/scripts/upgrade index e941066..8a47430 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -165,7 +165,7 @@ setupVars="$pihole_storage/setupVars.conf" ynh_backup_if_checksum_is_different "$setupVars" # Créé un backup du fichier de config si il a été modifié. # Trouve l'interface réseau par défaut -main_iface=$(route | grep default | awk '{print $8;}' | head -n1) +main_iface=$(ip route | grep default | awk '{print $5;}') echo "PIHOLE_INTERFACE=$main_iface" > $setupVars echo "IPV4_ADDRESS=127.0.0.1" >> $setupVars echo "IPV6_ADDRESS=" >> $setupVars