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

Create network interfaces on non-Beaglebone systems

Bob Mottram пре 10 година
родитељ
комит
a16b11ecae
1 измењених фајлова са 54 додато и 0 уклоњено
  1. 54
    0
      install-freedombone.sh

+ 54
- 0
install-freedombone.sh Прегледај датотеку

@@ -112,6 +112,9 @@ CPU_CORES=1
112 112
 # The static IP address of the system within the local network
113 113
 LOCAL_NETWORK_STATIC_IP_ADDRESS="192.168.1.60"
114 114
 
115
+# IP address of the router (gateway)
116
+ROUTER_IP_ADDRESS="192.168.1.254"
117
+
115 118
 # whether to route outgoing traffic through Tor
116 119
 ROUTE_THROUGH_TOR="no"
117 120
 
@@ -353,6 +356,9 @@ function read_configuration {
353 356
       if grep -q "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE; then
354 357
           LOCAL_NETWORK_STATIC_IP_ADDRESS=$(grep "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
355 358
       fi
359
+      if grep -q "ROUTER_IP_ADDRESS" $CONFIGURATION_FILE; then
360
+          ROUTER_IP_ADDRESS=$(grep "ROUTER_IP_ADDRESS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
361
+      fi
356 362
       if grep -q "GITHUB_USERNAME" $CONFIGURATION_FILE; then
357 363
           GITHUB_USERNAME=$(grep "GITHUB_USERNAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
358 364
       fi
@@ -452,6 +458,53 @@ function read_configuration {
452 458
   fi
453 459
 }
454 460
 
461
+function install_not_on_BBB {
462
+  if grep -Fxq "install_not_on_BBB" $COMPLETION_FILE; then
463
+      return
464
+  fi
465
+  if [[ INSTALLING_ON_BBB == "yes" ]]; then
466
+      return
467
+  fi
468
+
469
+  echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
470
+  echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
471
+  echo '' >> /etc/network/interfaces
472
+  echo '# The loopback network interface' >> /etc/network/interfaces
473
+  echo 'auto lo' >> /etc/network/interfaces
474
+  echo 'iface lo inet loopback' >> /etc/network/interfaces
475
+  echo '' >> /etc/network/interfaces
476
+  echo '# The primary network interface' >> /etc/network/interfaces
477
+  echo 'auto eth0' >> /etc/network/interfaces
478
+  echo 'iface eth0 inet static' >> /etc/network/interfaces
479
+  echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
480
+  echo '    netmask 255.255.255.0' >> /etc/network/interfaces
481
+  echo "    gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
482
+  echo '    dns-nameservers 213.73.91.35 85.214.20.141' >> /etc/network/interfaces
483
+  echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
484
+  echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
485
+  echo '' >> /etc/network/interfaces
486
+  echo '# The secondary network interface' >> /etc/network/interfaces
487
+  echo '#auto eth1' >> /etc/network/interfaces
488
+  echo '#iface eth1 inet dhcp' >> /etc/network/interfaces
489
+  echo '' >> /etc/network/interfaces
490
+  echo '# WiFi Example' >> /etc/network/interfaces
491
+  echo '#auto wlan0' >> /etc/network/interfaces
492
+  echo '#iface wlan0 inet dhcp' >> /etc/network/interfaces
493
+  echo '#    wpa-ssid "essid"' >> /etc/network/interfaces
494
+  echo '#    wpa-psk  "password"' >> /etc/network/interfaces
495
+  echo '' >> /etc/network/interfaces
496
+  echo '# Ethernet/RNDIS gadget (g_ether)' >> /etc/network/interfaces
497
+  echo '# ... or on host side, usbnet and random hwaddr' >> /etc/network/interfaces
498
+  echo '# Note on some boards, usb0 is automaticly setup with an init script' >> /etc/network/interfaces
499
+  echo '#iface usb0 inet static' >> /etc/network/interfaces
500
+  echo '#    address 192.168.7.2' >> /etc/network/interfaces
501
+  echo '#    netmask 255.255.255.0' >> /etc/network/interfaces
502
+  echo '#    network 192.168.7.0' >> /etc/network/interfaces
503
+  echo '#    gateway 192.168.7.1' >> /etc/network/interfaces
504
+
505
+  echo 'install_not_on_BBB' >> $COMPLETION_FILE
506
+}
507
+
455 508
 function check_hwrng {
456 509
   # If hardware random number generation was enabled then make sure that the device exists.
457 510
   # if /dev/hwrng is not found then any subsequent cryptographic key generation would
@@ -5406,6 +5459,7 @@ function install_final {
5406 5459
 
5407 5460
 read_configuration
5408 5461
 argument_checks
5462
+install_not_on_BBB
5409 5463
 remove_default_user
5410 5464
 configure_firewall
5411 5465
 configure_firewall_for_ssh