minor improvements and misc changes
[automated-distro-installer] / wrt-setup-local
index e043e7dfaf5b7f6b1249b409cdd6eac8e5568e6c..f465da5a75ceef8e8da54932133943a5c4c1dbb1 100755 (executable)
@@ -47,12 +47,40 @@ v() {
   "$@"
 }
 
+######### uci example:#######
+# # https://wiki.openwrt.org/doc/uci
+# wan_index=$(uci show firewall | sed -rn 's/firewall\.@zone\[([0-9])+\]\.name=wan/\1/p')
+# wan="firewall.@zone[$wan_index]"
+# if [[ $(uci get firewall.@forwarding[0].dest) != $forward_dest ]]; then
+#     # default is wan
+#     v uci set firewall.@forwarding[0].dest=$forward_dest
+#     uci commit firewall
+#     firewall_restart=true
+# fi
+####### end uci example #####
+
+uset() {
+  local key="$1"
+  local val="$2"
+  local service="${key%%.*}"
+  restart_var=${service}_restart
+  if [[ ! ${!restart_var} ]]; then
+    eval $restart_var=false
+  fi
+  if [[ $(uci get "$key") != "$val" ]]; then
+    v uci set "$key"="$val"
+    uci commit $service
+    eval $restart_var=true
+  fi
+}
+
+
 ### network config
 ###
 ssid="check out gnu.org"
 lan=10.0.0.0
 if $dev2; then
-  ssid="test1"
+  ssid="gnuv3"
   lan=10.1.0.0
 fi
 mask=255.255.0.0
@@ -60,6 +88,14 @@ l=${lan%.0}
 
 passwd -l root ||: #already locked fails
 
+sed -ibak '/^root:/d' /etc/shadow
+# /root/router created by manually running passwd then copying the resulting
+# line. We have no mkpasswd on wrt/librecmc, then we scp it in.
+cat /root/router >>/etc/shadow
+# otherwise, serial console gets root login with no password
+uset system.@system[0].ttylogin 1
+
+
 cat >/usr/bin/archlike-pxe-mount <<'EOFOUTER'
 #!/bin/bash
 # symlinks are collapsed for nfs mount points, so use a bind mount.
@@ -154,32 +190,6 @@ EOF
 
 
 
-######### uci example:#######
-# # https://wiki.openwrt.org/doc/uci
-# wan_index=$(uci show firewall | sed -rn 's/firewall\.@zone\[([0-9])+\]\.name=wan/\1/p')
-# wan="firewall.@zone[$wan_index]"
-# if [[ $(uci get firewall.@forwarding[0].dest) != $forward_dest ]]; then
-#     # default is wan
-#     v uci set firewall.@forwarding[0].dest=$forward_dest
-#     uci commit firewall
-#     firewall_restart=true
-# fi
-
-
-uset() {
-  local key="$1"
-  local val="$2"
-  local service="${key%%.*}"
-  restart_var=${service}_restart
-  if [[ ! ${!restart_var} ]]; then
-    eval $restart_var=false
-  fi
-  if [[ $(uci get "$key") != "$val" ]]; then
-    v uci set "$key"="$val"
-    uci commit $service
-    eval $restart_var=true
-  fi
-}
 
 uset dropbear.@dropbear[0].PasswordAuth 0
 uset dropbear.@dropbear[0].RootPasswordAuth 0
@@ -236,6 +246,8 @@ EOF
 
 firewall_restart=false
 v cedit /etc/config/firewall <<EOF || firewall_restart=true
+
+
 config redirect
     option name ssh
     option src              wan
@@ -329,14 +341,11 @@ $l.3 frodo
 $l.4 htpc
 $l.5 x2
 $l.6 demohost
-#$l.7 faiserver
-$l.8 tp faiserver b8.nz
-$l.9 n5
-$l.10 so
-$l.12 fz
+$l.7 x3
+$l.8 tp b8.nz faiserver
+$l.9 bb8
 72.14.176.105 li
-45.33.9.11 lj
-138.68.10.24 dopub
+
 # netns creation looks for next free subnet starting at 10.173, but I only
 # use one, and I would keep this one as the first created.
 10.173.0.2 transmission
@@ -424,16 +433,18 @@ dhcp-host=c8:60:00:31:6b:75,set:kd,$l.2,kd
 dhcp-host=00:26:18:97:bb:16,set:frodo,$l.3,frodo
 dhcp-host=10:78:d2:da:29:22,set:htpc,$l.4,htpc
 dhcp-host=00:1f:16:16:39:24,set:x2,$l.5,x2
-#dhcp-host=00:c0:ca:27:e9:b2,set:x2w,$l.11,x2w
-#wireless interface
-# this is so fai can have an explicit name to use for testing,
+# This is so fai can have an explicit name to use for testing,
 # or else any random machine which did a pxe boot would get
 # reformatted. The mac is from doing a virt-install, cancelling it,
 # and copying the generated mac, so it should be randomish.
 dhcp-host=52:54:00:9c:ef:ad,set:demohost,$l.6,demohost
-#dhcp-host=52:54:00:56:09:f9,set:faiserver,$l.7,faiserver
+dhcp-host=00:1f:16:14:01:d8,set:tp,$l.7,x3
 dhcp-host=80:fa:5b:1c:6e:cf,set:tp,$l.8,tp
-# this is the ip it picks by default if dhcp fails,
+
+# faiserver vm
+dhcp-host=52:54:00:56:09:f9,set:faiserver,$l.15,faiserver
+
+# This is the ip it picks by default if dhcp fails,
 # so might as well use it.
 # hostname is the name it uses according to telnet
 dhcp-host=b4:75:0e:94:29:ca,set:switch9429ca,$l.251,switch9429ca