X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Fhooks%2Fpartition.DEFAULT;h=89ae1e4491743e76b9fde6a1f37e6517d8accc22;hb=593c7e9993e4f2110846f869f468c4247a349700;hp=adb7b629e6b8bc243a323106b6c25247c35e9258;hpb=3c98a1230f8c0177d194038ac9c4db70648af792;p=automated-distro-installer diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index adb7b62..89ae1e4 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -36,7 +36,7 @@ fi ##### end configuration -bpart() { +bpart() { # btrfs a partition dev_n=$1 case ${#@} in [1-3]) mkfs.btrfs -f $@ ;; @@ -88,7 +88,7 @@ swap_mib=$(( $(grep ^MemTotal: /proc/meminfo | \ # fully 1MiB unit partitions for easy resizing of the last partition. # Otherwise we would pass in -0 for the end argument for the last partition. disk_mib=$(( $(parted -m ${devs[0]} unit MiB print | \ - sed -nr "s#^${devs[0]}:([0-9]+).*#\1#p") - 1)) + sed -nr "s#^${devs[0]}:([0-9]+).*#\1#p") - 1)) root_end=$(( disk_mib - swap_mib - boot_mib )) swap_end=$(( root_end + swap_mib)) @@ -96,7 +96,15 @@ mkdir -p /tmp/fai shopt -s nullglob if $partition; then for dev in ${devs[@]}; do - for x in $dev[0-9]; do wipefs -a $x; done + for x in $dev[0-9]; do + count_down=10 + # wipefs has failed, manual run works, google suggests timing issue + while ! wipefs -a $x; do + sleep 2 + count_down=$((count_down - 1)) + (( count_down > 0 )) || exit 1 + done + done done for dev in ${devs[@]}; do parted -s $dev mklabel gpt