Quellcode durchsuchen

Improve check netplan (#2133)

* Improve check netplan

* Fix tabbing

* Add check for current servers / admins to be warned
Jaap Marcus vor 4 Jahren
Ursprung
Commit
96a930d858
2 geänderte Dateien mit 18 neuen und 2 gelöschten Zeilen
  1. 14 2
      bin/v-add-sys-ip
  2. 4 0
      install/upgrade/versions/1.4.14.sh

+ 14 - 2
bin/v-add-sys-ip

@@ -76,8 +76,20 @@ if [ -z "$sys_ip_check" ]; then
     # Adding sys ip
     /sbin/ip addr add $ip/$cidr dev $iface \
         broadcast $broadcast label $iface
-
-    if dpkg-query -W -f'${Status}' "netplan*" 2>/dev/null | grep -q "ok installed"; then
+    
+    # Improve check netplan
+    if dpkg-query -W -f'${Status}' "netplan*" 2>/dev/null | grep -q "ok installed"; then 
+        result=$(cat /etc/netplan/*.yaml 2>/dev/null | grep $(hostname -I | cut -d' ' -f1));
+        if [ ! -z $result ]; then 
+            netplan=1
+        else
+            netplan=0
+        fi
+    else
+        netplan=0
+    fi
+    
+    if [ "$netplan" == "1" ]; then
         if [ -f "/etc/netplan/60-hestia.yaml" ]; then
             sys_ip="        - $ip/$cidr"
         else

+ 4 - 0
install/upgrade/versions/1.4.14.sh

@@ -15,3 +15,7 @@
 ####### You can use \n within the string to create new lines.                   #######
 #######################################################################################
 
+if [ -f "/etc/network/interfaces" ] && [ -f "/etc/netplan/60-hestia.yaml" ]; then
+    add_upgrade_message "Warning: Please check your network config!\n\nDuring this update a network compatibility issues has been detected. Both /etc/network/interfaces and /etc/netplan/60-hestia.yaml exists. This can lead to issues after a system reboot. Please review your network configuration."
+    $HESTIA/bin/v-add-user-notification admin "Invalid network configuration detected\n\nDuring this update a network compatibility issues has been detected. Both /etc/network/interfaces and /etc/netplan/60-hestia.yaml exists. This can lead to issues after a system reboot. Please review your network configuration."
+fi