瀏覽代碼

Configure eth0 within images

Bob Mottram 7 年之前
父節點
當前提交
9c60ac9110
共有 1 個檔案被更改,包括 12 行新增8 行删除
  1. 12
    8
      src/freedombone-image-customise

+ 12
- 8
src/freedombone-image-customise 查看文件

203
         return
203
         return
204
     fi
204
     fi
205
 
205
 
206
+    { echo '# This file describes the network interfaces available on your system';
207
+      echo '# and how to activate them. For more information, see interfaces(5).';
208
+      echo 'source /etc/network/interfaces.d/*'; } > "$rootdir/etc/network/interfaces"
209
+
206
     if [[ "$GENERIC_IMAGE" == "no" ]]; then
210
     if [[ "$GENERIC_IMAGE" == "no" ]]; then
207
-        echo '# This file describes the network interfaces available on your system' > "$rootdir/etc/network/interfaces"
208
-        echo '# and how to activate them. For more information, see interfaces(5).' >> "$rootdir/etc/network/interfaces"
209
-        echo 'source /etc/network/interfaces.d/*' >> "$rootdir/etc/network/interfaces"
210
 
211
 
211
-        echo "auto eth0
212
-iface eth0 inet static
213
-    address $BOX_IP_ADDRESS
214
-    netmask 255.255.255.0
215
-    gateway $ROUTER_IP_ADDRESS" > "$rootdir/etc/network/interfaces.d/static"
212
+        { echo 'auto eth0';
213
+          echo 'iface eth0 inet static';
214
+          echo "address $BOX_IP_ADDRESS";
215
+          echo 'netmask 255.255.255.0';
216
+          echo "gateway $ROUTER_IP_ADDRESS"; } > "$rootdir/etc/network/interfaces.d/static"
216
 
217
 
217
         hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
218
         hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
218
         a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
219
         a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
221
         d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
222
         d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
222
         e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
223
         e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
223
         echo "hwaddress ether de:$a:$b:$c:$d:$e" > "$rootdir/etc/network/interfaces.d/macaddress"
224
         echo "hwaddress ether de:$a:$b:$c:$d:$e" > "$rootdir/etc/network/interfaces.d/macaddress"
225
+    else
226
+        { echo 'auto eth0';
227
+          echo 'iface eth0 inet dhcp'; } > "$rootdir/etc/network/interfaces.d/dynamic"
224
     fi
228
     fi
225
 
229
 
226
     # configure DNS
230
     # configure DNS