Exit if some basics commands fails

This commit is contained in:
Jeremy Gardais 2020-10-19 17:34:28 +02:00
parent 035d1eb2a6
commit 695012520f
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 8 additions and 8 deletions

16
debian/chroot.install vendored
View File

@ -71,15 +71,15 @@ if [ "${manage_part}" -eq 0 ]; then
rm -f -- "${luks_key_file}" && printf '%b\n' "${luks_passphrase}" > "${luks_key_file}" 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 -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 cryptsetup luksOpen "${hdd}"2 "${luks_pv_name}" --key-file "${luks_key_file}" || exit 2
pvcreate /dev/mapper/"${luks_pv_name}" pvcreate /dev/mapper/"${luks_pv_name}" || exit 3
vgcreate "${vgname}" /dev/mapper/"${luks_pv_name}" vgcreate "${vgname}" /dev/mapper/"${luks_pv_name}" || exit 3
else else
pvcreate "${hdd}"2 pvcreate "${hdd}"2 || exit 3
vgcreate "${vgname}" "${hdd}"2 vgcreate "${vgname}" "${hdd}"2 || exit 3
fi fi
fi fi
mkfs.ext3 -F -L boot -- "${hdd}"1 mkfs.ext3 -F -L boot -- "${hdd}"1 || exit 4
## }}} ## }}}
## Create Logical Volumes {{{ ## Create Logical Volumes {{{
@ -106,18 +106,18 @@ fi
### Format LVs in ext4 ### Format LVs in ext4
cd -- /dev/"${vgname}" || exit 1 cd -- /dev/"${vgname}" || exit 1
for lvname in *; do for lvname in *; do
mkfs.ext4 -F -L "${lvname}" -- "${lvname}" mkfs.ext4 -F -L "${lvname}" -- "${lvname}" || exit 4
done done
cd -- - || exit 1 cd -- - || exit 1
### (re)format Btrfs LV ### (re)format Btrfs LV
if [ "${manage_btrfs}" -eq 0 ]; then if [ "${manage_btrfs}" -eq 0 ]; then
### Ensure to format Btrfs LV ### Ensure to format Btrfs LV
mkfs.btrfs --force -L root -- /dev/"${vgname}"/root mkfs.btrfs --force -L root -- /dev/"${vgname}"/root || exit 4
fi fi
### And format the swap ### And format the swap
mkswap -L sw01 -- /dev/mapper/"${vgname}"-swap mkswap -L sw01 -- /dev/mapper/"${vgname}"-swap || exit 4
## }}} ## }}}
# }}} # }}}
# Debootstrap {{{ # Debootstrap {{{