Преглед изворни кода

Initial dynamic eth0 configuration

Bob Mottram пре 7 година
родитељ
комит
9fe1f91722
1 измењених фајлова са 16 додато и 4 уклоњено
  1. 16
    4
      src/freedombone-utils-network

+ 16
- 4
src/freedombone-utils-network Прегледај датотеку

54
     if [[ $INSTALLING_ON_BBB == "yes" ]]; then
54
     if [[ $INSTALLING_ON_BBB == "yes" ]]; then
55
         return
55
         return
56
     fi
56
     fi
57
-    if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
58
-        return
59
-    fi
60
 
57
 
61
     echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
58
     echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
62
     echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
59
     echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
63
     echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces
60
     echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces
64
 
61
 
62
+    if [ ! $LOCAL_NETWORK_STATIC_IP_ADDRESS ]; then
63
+
64
+        { echo 'auto eth0';
65
+          echo 'iface eth0 inet dhcp'; } > /etc/network/interfaces.d/dynamic
66
+
67
+        if [ -f /etc/network/interfaces.d/static ]; then
68
+            rm /etc/network/interfaces.d/static
69
+        fi
70
+
71
+        mark_completed "${FUNCNAME[0]}"
72
+        return
73
+    fi
74
+
65
     { echo 'auto eth0';
75
     { echo 'auto eth0';
66
       echo 'iface eth0 inet static';
76
       echo 'iface eth0 inet static';
67
       echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS";
77
       echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS";
68
       echo '    netmask 255.255.255.0';
78
       echo '    netmask 255.255.255.0';
69
       echo "    gateway $ROUTER_IP_ADDRESS"; } > /etc/network/interfaces.d/static
79
       echo "    gateway $ROUTER_IP_ADDRESS"; } > /etc/network/interfaces.d/static
70
 
80
 
71
-    mark_completed "${FUNCNAME[0]}"
81
+    if [ -f /etc/network/interfaces.d/dynamic ]; then
82
+        rm /etc/network/interfaces.d/dynamic
83
+    fi
72
 }
84
 }
73
 
85
 
74
 function get_external_ipv4_address {
86
 function get_external_ipv4_address {