From 695012520f9c942429bc17392dfc4d80e2ebae15 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 19 Oct 2020 17:34:28 +0200 Subject: [PATCH] Exit if some basics commands fails --- debian/chroot.install | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/debian/chroot.install b/debian/chroot.install index 2f08cb2..867699d 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -71,15 +71,15 @@ if [ "${manage_part}" -eq 0 ]; then rm -f -- "${luks_key_file}" && printf '%b\n' "${luks_passphrase}" > "${luks_key_file}" cryptsetup -c aes-xts-plain -s 512 --use-random -y luksFormat "${hdd}"2 "${luks_passphrase}" --key-file "${luks_key_file}" || exit 2 cryptsetup luksOpen "${hdd}"2 "${luks_pv_name}" --key-file "${luks_key_file}" || exit 2 - pvcreate /dev/mapper/"${luks_pv_name}" - vgcreate "${vgname}" /dev/mapper/"${luks_pv_name}" + pvcreate /dev/mapper/"${luks_pv_name}" || exit 3 + vgcreate "${vgname}" /dev/mapper/"${luks_pv_name}" || exit 3 else - pvcreate "${hdd}"2 - vgcreate "${vgname}" "${hdd}"2 + pvcreate "${hdd}"2 || exit 3 + vgcreate "${vgname}" "${hdd}"2 || exit 3 fi fi -mkfs.ext3 -F -L boot -- "${hdd}"1 +mkfs.ext3 -F -L boot -- "${hdd}"1 || exit 4 ## }}} ## Create Logical Volumes {{{ @@ -106,18 +106,18 @@ fi ### Format LVs in ext4 cd -- /dev/"${vgname}" || exit 1 for lvname in *; do - mkfs.ext4 -F -L "${lvname}" -- "${lvname}" + mkfs.ext4 -F -L "${lvname}" -- "${lvname}" || exit 4 done cd -- - || exit 1 ### (re)format Btrfs LV if [ "${manage_btrfs}" -eq 0 ]; then ### Ensure to format Btrfs LV - mkfs.btrfs --force -L root -- /dev/"${vgname}"/root + mkfs.btrfs --force -L root -- /dev/"${vgname}"/root || exit 4 fi ### And format the swap -mkswap -L sw01 -- /dev/mapper/"${vgname}"-swap +mkswap -L sw01 -- /dev/mapper/"${vgname}"-swap || exit 4 ## }}} # }}} # Debootstrap {{{