X-Git-Url: https://iankelling.org/git/?p=automated-distro-installer;a=blobdiff_plain;f=wrt-setup-local;h=17fb9d2adb4ff915f94f5e33aaa0f64b2e9a12b8;hp=642c1935150c17dd756a08740f8ed4d94a5c1f04;hb=632c94b8382717f1a06b350c971b8246abbbbe61;hpb=3f20eea52b8d7f665b2c3b483921f15a0e48d7ee diff --git a/wrt-setup-local b/wrt-setup-local index 642c193..17fb9d2 100755 --- a/wrt-setup-local +++ b/wrt-setup-local @@ -39,15 +39,19 @@ EOF +dnsmasq_restart=false +firewall_restart=false dev2=false test=false libremanage_host=wrt2 -if [[ -e /p/router-secrets ]]; then - source /p/router-secrets +secrets=false +if [[ -e /root/router-secrets ]]; then + secrets=true + source /root/router-secrets fi rmac=$(cat /sys/class/net/eth0/address) -if [[ $rhost ]]; then +if $secrets; then hostname=${rhost[$rmac]} fi : ${hostname:=wrt} @@ -83,10 +87,10 @@ while getopts hm:t: opt; do done shift "$((OPTIND-1))" # Discard the options and sentinel -- -if [[ ! $mac ]] && ! $test; then +if [[ ! $mac ]] && ! $test && $secrets; then # if we wanted to increment it - #WIRELESSMAC=${WIRELESSMAC:0: -1}$((${WIRELESSMAC: -1} + 2)) - mac=$WIRELESSMAC + #mac=${mac:0: -1}$((${mac: -1} + 2)) + mac=${rwmac[$rmac]} fi if (( $# != 0 )); then @@ -183,17 +187,23 @@ udel() { ### network config ### -ssid="check out gnu.org" lan=10.0.0.0 if $test; then - ssid="gnuv3" lan=10.1.0.0 elif [[ $hostname == cmc ]]; then - ssid=Svenska lan=10.2.0.0 fi -if [[ $rkey ]]; then +if $test; then + ssid="gnuv3" +elif $secrets; then + ssid=${rssid[$rmac]} +fi + +: ${ssid:=librecmc} + + +if $secrets; then key=${rkey[$rmac]} fi : ${key:=pictionary49} @@ -212,6 +222,7 @@ cat /root/router >>/etc/shadow 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. @@ -408,25 +419,60 @@ EOF # option config /etc/openvpn/client.conf # EOF +wgip4=10.3.0.1/24 +wgip6=fdfd::1/64 +wgport=26000 v cedit /etc/config/network </dev/null; then + # cant mix cedit plus uci + echo | cedit /etc/config/firewall ||: + uci add_list firewall.@zone[1].network=wg0 + uci commit firewall + firewall-cedit ||: + firewall_restart=true +fi - -dnsmasq_restart=false v cedit /etc/hosts <