From 7386cdbee20dd73095264e2ad0ead433f97ac946 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sat, 11 Feb 2017 00:37:17 -0800 Subject: [PATCH] code cleanup, arch fixes arch might still need more fixes --- README | 1 + arch-init | 5 ++--- arch-init-chroot | 9 ++------- arch-init-remote | 1 - arch-pxe | 34 +++++++++++++++++++++++++--------- fai-revm | 7 +++---- pxe-server | 7 ++----- wrt-setup | 1 - 8 files changed, 35 insertions(+), 30 deletions(-) diff --git a/README b/README index d579feb..fa28fa9 100644 --- a/README +++ b/README @@ -49,6 +49,7 @@ All scripts meant to be used directly are listed here: # Scripts to setup the environment for the install +arch-pxe # Setup arch pxe boot server from an arch base image fai-redep # Deploy fai configuration to host "faiserver" faiserver-revm # using pxe & preseed, create a vm which is a fai server faiserver-uninstall # uninstall fai-server diff --git a/arch-init b/arch-init index aa26ffd..982357f 100755 --- a/arch-init +++ b/arch-init @@ -22,7 +22,6 @@ x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*} export HOSTNAME="$1" mirror=$2 -TPPASS="$(cat /root/shadow/traci-simple)" (( $# >= 1 )) || { echo "$0: error: need 1 or 2 arguments"; exit 1; } @@ -73,8 +72,7 @@ sed -ri --follow-symlinks "/^crypt_dev_\S+$rootn /d" /tmp/fai/crypttab if ! $already_partitioned; then mount -o subvol=root_$DISTRO $ROOT_PARTITION /mnt - mkdir -p /mnt/{a,home,boot} - mount -o subvol=a $ROOT_PARTITION /mnt/a + mkdir -p /mnt/boot mount -o subvol=boot_$DISTRO $BOOT_PARTITION /mnt/boot fi @@ -102,6 +100,7 @@ bindmount() { mount -o bind $source $mountpoint } bindmount /root/shadow /mnt/q/root/shadow +bindmount /a /mnt/a mkdir -p /mnt/etc/ssh cp /etc/ssh/ssh_host_* /mnt/etc/ssh diff --git a/arch-init-chroot b/arch-init-chroot index 7eac7eb..7eaa5a2 100755 --- a/arch-init-chroot +++ b/arch-init-chroot @@ -77,15 +77,11 @@ k_args=( root=/dev/mapper/crypt_dev_${first_root_dev##*/} resume=${first_root_dev%[0-9]}$swapn ) -extra_encrypt_hooks=() # If we have more than 1 to decrypt, arch wiki lead me onto # a sort of hacky way run the encrypt hook multiple times. -base=/usr/lib/initcpio - - # https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Configuring_mkinitcpio_2 # used to have lvm2 after encrypt for lvm, but not using lvm anymore for x in encrypt btrfs; do @@ -100,10 +96,9 @@ s#^\s*FILES=.*#FILES="/crypto_keyfile.bin"# EOF echo "$0: FILES:" grep FILES /etc/mkinitcpio.conf -k_args="${k_args[*]}" -echo "$0: grub cmdline additions: $k_args" +echo "$0: grub cmdline additions: ${k_args[*]}" sed -ri --follow-symlinks -f - /etc/default/grub <&2' ERR +usage() { + cat < airootfs.md5; b +pushd $(dirname $sfs); md5sum ${sfs##*/} > airootfs.md5; popd # seems if you've done a pxe boot, mounted the nfs, # then shutdown, it's still busy. @@ -59,12 +77,10 @@ ssh wrt "cd /mnt/usb && rm -f tftpboot && ln -s $iso tftpboot" # The default settings in the installer expect to find the NFS at /run/archiso/bootmnt -pxe-server default arch - -# background: -# great documentation at https://wiki.archlinux.org/index.php/PXE -# background: arch can do netboot like ubuntu etc, but the docs look a little complicated, so fuck it, -# we use nfs cuz it's easy +# background: great documentation at +# https://wiki.archlinux.org/index.php/PXE +# arch can do netboot like ubuntu etc, but the docs look a little +# complicated, so fuck it, we use nfs cuz it's easy rm -rf $iso s rm -rf squashfs-root diff --git a/fai-revm b/fai-revm index cc494cc..6f8beeb 100755 --- a/fai-revm +++ b/fai-revm @@ -34,7 +34,7 @@ then start a virtual machine to test the config Note, sometimes shutting down the existing demohost vm fails. Just run again if that happens. --r Do not reboot. +-r Do not boot after install is complete -n Create new qcow2(s) for vm -h|--help Print help and exit. @@ -45,13 +45,12 @@ EOF new_disk=false -reboot=true temp=$(getopt -l help hnr "$@") || usage 1 eval set -- "$temp" while true; do case $1 in -n) new_disk=true; shift ;; - -r) reboot=false; shift ;; + -r) reboot_arg=--noreboot; shift ;; -h|--help) usage ;; --) shift; break ;; *) echo "$0: Internal error!" ; exit 1 ;; @@ -120,7 +119,7 @@ fi # # uniq is to stop gtk-warning spam e s virt-install --os-variant $variant -n $name --pxe -r 2048 --vcpus 1 \ - ${disk_arg[*]} -w bridge=br0,mac=52:54:00:9c:ef:ad \ + ${disk_arg[*]} -w bridge=br0,mac=52:54:00:9c:ef:ad $reboot_arg \ --graphics spice,listen=0.0.0.0 $console_arg |& grep -v '^ *$' | uniq & if [[ $SSH_CLIENT ]]; then diff --git a/pxe-server b/pxe-server index fb92d66..a3df1a5 100755 --- a/pxe-server +++ b/pxe-server @@ -63,7 +63,6 @@ EOF ##### begin command line parsing ######## -args=() redep=true acks=2 wait=false @@ -80,7 +79,7 @@ while true; do esac done -read host type <<<"$@" +read -r host type <<<"$@" case $# in 0|2);; @@ -120,7 +119,6 @@ EOF fai() { cat < $(date +%s) )); then opkg update fi -- 2.30.2