# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# todo /boot/chboot needs update for lvm i think?
+#
+# todo: this is complicated enough that set -u is appropriate, but
+# needs some changes in how we check for empty vars.
PS4='+ $LINENO '
set -eE -o pipefail
vg_wipes+=($vg)
lvs=$(vgs --noheadings -o lv_path $vg)
for lv in $lvs; do
- d wipefs -a $lv
+ d wipefs --backup -a $lv
done
done
fi
# we don't want any old fses hanging around.
count_down=10
# wipefs has failed, manual run works, google suggests timing issue
- while ! wipefs -a $dev; do
+ while ! wipefs --backup -a $dev*; do
sleep 2
count_down=$((count_down - 1))
if (( count_down <= 0 )); then
if [[ $SPECIAL_DISK ]]; then
lvmwipe -n $SPECIAL_DISK
if $would_wipe; then
- echo "wipefs -a $SPECIAL_DISK"
+ echo wipefs --backup -a $SPECIAL_DISK*
echo "$0: exiting. review and execute above wipefs commands manually"
exit 0
fi
fi
fi
- if [[ $SPECIAL_DISK ]]; then
+ if [[ $SPECIAL_DISK ]] && ! $fsf; then
lvcreate -y -L $root_mib $vg -n data
else
# -L unit default mebibyte
done
sleep 3
- mkfs.fat -F32 $dev$efisuf
+ if ! $fsf; then
+ mkfs.fat -F32 $dev$efisuf
+ fi
if ! fsf && $even_big_part && [[ $dev == "$even_big_dev" ]]; then
luks-setup $even_big_dev$even_bigsuf ${even_big_dev##*/}$even_bigsuf