From 37464725aeecf468265275c0be0963858511398b Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 7 May 2019 15:33:18 -0400 Subject: [PATCH] update hosts, fix fai-cd and wrt --- README | 6 ++- grub.cfg.autodiscover | 13 ++--- lk | 6 +-- pxe-server | 2 +- wrt-setup | 40 +++++++--------- wrt-setup-local | 109 +++++++++++++++++++++++++++++++++++------- 6 files changed, 126 insertions(+), 50 deletions(-) diff --git a/README b/README index 5d3bc6e..9d5e00f 100644 --- a/README +++ b/README @@ -69,7 +69,9 @@ use one called 5-multi-boot, which you can see example of in fai/config/class/50-host-classes. Before doing a fai install, you will need to populate /q/root/luks and -/q/root/shadow, see their references. +/q/root/shadow, see their references. You might also want to copy +existing /etc/ssh/*host* to +/p/c/machine_specific/HOST/filesystem/etc/ssh. @@ -78,7 +80,7 @@ All scripts meant to be used directly are listed here: # Scripts to setup the environment for the install -sudo fai-cd -g grub.cfg.autodiscover -f -A $BASEFILE_DIR/autodiscover.iso # create autodiscover cd +sudo fai-cd -g $PWD/grub.cfg.autodiscover -f -A $BASEFILE_DIR/autodiscover.iso # create autodiscover cd mymk-basefile # Create basefiles for various distros archlike-pxe # Setup pxe boot server from an archlike base image fai-redep # Deploy fai configuration to host "faiserver" diff --git a/grub.cfg.autodiscover b/grub.cfg.autodiscover index 1e7ce43..6ed3a28 100644 --- a/grub.cfg.autodiscover +++ b/grub.cfg.autodiscover @@ -55,12 +55,6 @@ menuentry "" --unrestricted { set gfxpayload=$resolution } -menuentry "Autodiscover the FAI server" { - set gfxpayload=$resolution - linux /boot/vmlinuz FAI_FLAGS="menu,verbose,createvt" fai.discover aufs rootovl root=/dev/nfs ip=dhcp quiet - initrd /boot/initrd.img -} - # ian: Added this from fai # note, we could replace faiserver with an ip if we didn't want to mess with dns. # args are copied from myfai-chboot-local @@ -71,6 +65,13 @@ menuentry "FAI server via dns" { } +menuentry "Autodiscover the FAI server" { + set gfxpayload=$resolution + linux /boot/vmlinuz FAI_FLAGS="menu,verbose,createvt" fai.discover aufs rootovl root=/dev/nfs ip=dhcp quiet + initrd /boot/initrd.img +} + + menuentry "Boot OS of first partition on first disk" --unrestricted { if [ -d (cd) ]; then chainloader (hd0)+1 diff --git a/lk b/lk index 03b17c6..d3d13ea 100755 --- a/lk +++ b/lk @@ -33,9 +33,9 @@ Alternative to http server: 2. On another machine nc INSTALL_MACHINE 1234 1 )); then - usage 1 -fi - -if [[ $# == 1 ]]; then - read h <<<"$@" -fi +echo "$0: host=$h" cat ~/.ssh/home.pub | ssh $h dd of=/etc/dropbear/authorized_keys 2>/dev/null -scp /a/bin/fai/wrt-setup-local /a/bin/cedit/cedit $h:/usr/bin -# build for openwrt 18.06.2, r7676-cddd7b4c77 +scp /a/work/libremanage/libremanage /a/bin/fai/wrt-setup-local /a/bin/cedit/cedit $h:/usr/bin +# relay is built for openwrt 18.06.2, r7676-cddd7b4c77 sudo scp /q/root/shadow/router \ /a/opt/openwrt/source/bin/packages/mips_24kc/mypackages/relay_1.0-1_mips_24kc.ipk $h: ssh $h <&2' ERR + +usage() { + cat <&2; usage 1 ;; + esac + ;; + m) mac=$OPTARG ;; + *) echo "$0: Internal error! unexpected args: $*" >&2 ; usage 1 ;; + esac +done +shift "$((OPTIND-1))" # Discard the options and sentinel -- + +if [[ ! $mac ]] && ! $test; then + # if we wanted to increment it + #WIRELESSMAC=${WIRELESSMAC:0: -1}$((${WIRELESSMAC: -1} + 2)) + mac=$WIRELESSMAC +fi + +if (( $# != 0 )); then + usage 1 fi + +macpre=${mac:0: -1} +macsuf=${mac: -1} + pmirror() { # background: upgrading all packages is not recommended because it # doesn't go into the firmware. build new firmware if you want @@ -79,11 +135,12 @@ uset() { ### ssid="check out gnu.org" lan=10.0.0.0 -if $dev2; then +if $test; then ssid="gnuv3" lan=10.1.0.0 fi mask=255.255.0.0 +cidr=16 l=${lan%.0} passwd -l root ||: #already locked fails @@ -114,10 +171,15 @@ EOFOUTER chmod +x /usr/bin/archlike-pxe-mount sed -i '/^root:/s,/bin/ash$,/bin/bash,' /etc/passwd +# usb, screen, relay are for libremanage v pi kmod-usb-storage block-mount kmod-fs-ext4 nfs-kernel-server \ - tcpdump openvpn-openssl adblock libusb-compat /root/relay_1.0-1_mips_24kc.ipk - + tcpdump openvpn-openssl adblock libusb-compat /root/relay_1.0-1_mips_24kc.ipk \ + screen kmod-usb-serial-cp210x kmod-usb-serial-ftdi +cat >/etc/libremanage.conf </dev/null) ]]; then - v uci delete wireless.radio$x.disabled - wireless_restart=true + if [[ $mac ]]; then + uset wireless.default_radio$x.macaddr $macpre$((macsuf + 2*x)) fi + # secondary device has wireless disabled + uset wireless.radio$x.disabled $dev2 done if $wireless_restart; then @@ -338,7 +401,7 @@ v cedit /etc/hosts <