From: Ian Kelling Date: Mon, 9 May 2016 05:59:16 +0000 (-0700) Subject: various fixes and improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=afabe0c27af744200aa6b6e05c5b2ab7d7518c1e;p=automated-distro-installer various fixes and improvements --- 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 <