X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fhooks%2Fpartition.DEFAULT;h=317eb6d3b9b149069fcc3b0f8fce4c94da0ef93c;hb=d3d495af167adba91b190e8dcb95649c34fa04c7;hp=b0d1c9cb2ade103c480056f20aca35527798d7d5;hpb=4261ad7e021ec77e7198cf42c3576dad07f12a64;p=automated-distro-installer diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index b0d1c9c..317eb6d 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -10,9 +10,9 @@ skiptask partition || ! type skiptask # for running not in fai #### begin configuration -bootn=3 rootn=1 swapn=2 +bootn=3 bios_grubn=4 boot_mib=1500 @@ -61,13 +61,13 @@ fi lastn=$bios_grubn -hds=() +hdds=() ssds=() cd /sys/block for disk in [sv]d[a-z]; do case $(cat $disk/queue/rotational) in 0) ssds+=(/dev/$disk) ;; - 1) hds+=(/dev/$disk) ;; + 1) hdds+=(/dev/$disk) ;; *) echo "$0: error: unknown /sys/block/$disk/queue/rotational: \ $(cat $disk/queue/rotational)"; exit 1 ;; esac @@ -77,7 +77,7 @@ done if (( ${#ssds[@]} > 0 )); then short_devs=( ${ssds[@]} ) else - short_devs=( ${hds[@]} ) + short_devs=( ${hdds[@]} ) fi # check if the partitions exist have the right filesystems @@ -188,7 +188,7 @@ first_root_crypt=$(root-cryptdev ${devs[0]}) bios_grubn=4 # 1.5 x based on https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-disk-partitioning-setup-x86.html#sect-custom-partitioning-x86 swap_mib=$(( $(grep ^MemTotal: /proc/meminfo | \ - awk '{print $2}') * 3/(${#devs[@]} * 2 ) / 1024 )) + awk '{print $2}') * 3/(${#devs[@]} * 2 ) / 1024 )) mkdir -p /tmp/fai shopt -s nullglob @@ -212,7 +212,7 @@ if $partition; then # parted print error output is expected. example: # Error: /dev/vda: unrecognised disk label disk_mib=$(( $(parted -m $dev unit MiB print | \ - sed -nr "s#^/dev/[^:]+:([0-9]+).*#\1#p") - 1)) + sed -nr "s#^/dev/[^:]+:([0-9]+).*#\1#p") - 1)) root_end=$(( disk_mib - swap_mib - boot_mib / ${#boot_devs[@]} )) swap_end=$(( root_end + swap_mib)) @@ -272,7 +272,7 @@ fi mount -o subvolid=0 $first_root_crypt /mnt # systemd creates subvolumes we want to delete. s=($(btrfs subvolume list --sort=-path /mnt | - sed -rn "s#^.*path\s*(root_$DISTRO/\S+)\s*\$#\1#p")) + sed -rn "s#^.*path\s*(root_$DISTRO/\S+)\s*\$#\1#p")) 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 @@ -282,8 +282,10 @@ btrfs subvolume set-default 0 /mnt cd /mnt for x in q home_$DISTRO root_$DISTRO; do btrfs subvolume list . | grep "$x$" >/dev/null || btrfs subvolume create $x - chown root:1000 q done +chown root:1000 q + + mkdir -p /mnt/root_$DISTRO/boot for x in root/a q/a; do mkdir -p $x