fix arch install with new partition scheme
[automated-distro-installer] / fai / config / hooks / partition.DEFAULT
index adb7b629e6b8bc243a323106b6c25247c35e9258..89ae1e4491743e76b9fde6a1f37e6517d8accc22 100755 (executable)
@@ -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