From: Ian Kelling Date: Mon, 18 Jan 2016 23:29:08 +0000 (-0800) Subject: for traci different pass and a home subvolume X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=a129832a849aa87163b866982c214bbdd7314a52;p=automated-distro-installer for traci different pass and a home subvolume --- diff --git a/fai-redep b/fai-redep index 1626272..3e13067 100755 --- a/fai-redep +++ b/fai-redep @@ -19,8 +19,12 @@ scp -r /a/bin/fai/fai/config root@faiserver:/srv/fai ssh root@faiserver tee -a /srv/fai/config/class/DEFAULT.var </dev/null || btrfs subvolume create $x + done + btrfs subvolume set-default \ + $(btrfs subvolume list . | grep 'root$' | awk '{print $2}') . + cd / + umount /mnt +} + shopt -s nullglob if $partition; then mkdir -p /tmp/fai @@ -85,8 +101,7 @@ if $partition; then yes YES | cryptsetup luksFormat /dev/$crypt $luks_dir/host-$HOSTNAME \ -c aes-cbc-essiv:sha256 -s 256 || [[ $? == 141 ]] - yes $(cat $luks_dir/traci) | \ - cryptsetup luksAddKey --key-file \ + yes "$lukspw" cryptsetup luksAddKey --key-file \ $luks_dir/host-$HOSTNAME /dev/$crypt || [[ $? == 141 ]] # this would remove the keyfile. we will do that manually later. # yes 'test' | cryptsetup luksRemoveKey /dev/... \ @@ -96,17 +111,12 @@ if $partition; then parted ${devs[0]} set 1 boot on mkfs.btrfs -f /dev/mapper/crypt_dev_$crypt mount /dev/mapper/crypt_dev_$crypt /mnt - cd /mnt - btrfs subvolume create a - btrfs subvolume create root - btrfs subvolume set-default $(btrfs subvolume list . | grep 'root$' | awk '{print $2}') . - cd / - umount /mnt + create_subvols else for dev in ${devs[@]}; do mkfs.ext4 -F ${dev}1 done - yes $(cat $luks_dir/traci) | \ + yes "$lukspw" | \ cryptsetup luksOpen /dev/$crypt crypt_dev_$crypt || [[ $? == 141 ]] sleep 1 mount -o subvolid=0 /dev/mapper/crypt_dev_$crypt /mnt @@ -116,9 +126,7 @@ else for subvol in ${s[@]}; do btrfs subvolume delete /mnt/$subvol; done btrfs subvolume set-default 0 /mnt btrfs subvolume delete /mnt/root - btrfs subvolume create /mnt/root - btrfs subvolume set-default $(btrfs subvolume list /mnt | grep 'root$' | awk '{print $2}') /mnt - umount /mnt + create_subvols fi cat > /tmp/fai/crypttab < /tmp/fai/fstab <