From afabe0c27af744200aa6b6e05c5b2ab7d7518c1e Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 8 May 2016 22:59:16 -0700 Subject: [PATCH] various fixes and improvements --- chost | 13 +++++++++ fai-redep | 13 +-------- fai/config/distro-install-common/end | 2 +- fai/config/hooks/partition.DEFAULT | 7 +---- fai/config/scripts/GRUB_PC/11-ian | 7 +++-- faiserver-disable | 18 +++++++++++++ faiserver-enable | 18 +++++++++++++ pxe-server | 40 +++++++++++++++++++++++----- wrt-setup | 5 ++++ 9 files changed, 95 insertions(+), 28 deletions(-) create mode 100755 chost create mode 100755 faiserver-disable create mode 100755 faiserver-enable diff --git a/chost b/chost new file mode 100755 index 0000000..9a0034f --- /dev/null +++ b/chost @@ -0,0 +1,13 @@ +#!/bin/bash + +# chost: get canonical hostname + +set -eE -o pipefail +trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR + +host=$1 +addr=$(host $host) +addr=${addr##* } +h=$(host $addr) +h=${h##* } +echo ${h%%.*} diff --git a/fai-redep b/fai-redep index 29f4d15..9730260 100755 --- a/fai-redep +++ b/fai-redep @@ -10,21 +10,10 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR cd $(dirname $(readlink -f "$BASH_SOURCE")) -faiserver_host=faiserver # i use faiserver as a dns alias, but ssh key is associated with # a canonical hostname and we will have ssh warning spam unless we # use it, so look it up. -if addr=$(host faiserver); then - addr=${addr##* } - if h=$(host $addr); then - h=${h##* } - faiserver_host=${h%%.*} - else - echo "$0: warning: host \$addr($addr) failed" - fi -else - echo "$0: warning: host faiserver failed" -fi +faiserver_host=$(chost faiserver) || faiserver_host=faiserver ssh root@$faiserver_host rm -rf /srv/fai/config diff --git a/fai/config/distro-install-common/end b/fai/config/distro-install-common/end index 79238a5..cbe724d 100755 --- a/fai/config/distro-install-common/end +++ b/fai/config/distro-install-common/end @@ -31,7 +31,7 @@ $ROOTCMD rm -rf /root/.unison $ROOTCMD ln -sf $dir /root $ROOTCMD ln -sf /q/p / -chown -R 1000:1000 $dir +$ROOTCMD chown -R 1000:1000 $dir while true; do $ROOTCMD chown 1000:1000 $dir $ROOTCMD chmod 700 $dir diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index e64f92b..2dc6fd5 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -287,15 +287,11 @@ for subvol in ${s[@]}; do btrfs subvolume delete /mnt/$subvol; done btrfs subvolume set-default 0 /mnt [[ ! -e /mnt/root_$DISTRO ]] || btrfs subvolume delete /mnt/root_$DISTRO - ## create subvols ## cd /mnt -for x in q home_$DISTRO root_$DISTRO; do - btrfs subvolume list . | grep "$x$" >/dev/null || btrfs subvolume create $x -done +btrfs subvolume create root_$DISTRO chown root:1000 q - mkdir -p /mnt/root_$DISTRO/boot for x in root/a q/a; do mkdir -p $x @@ -323,7 +319,6 @@ cat > /tmp/fai/fstab <&2' ERR + +usage() { + cat <&2' ERR + +usage() { + cat <