Exit if some basics commands fails
This commit is contained in:
parent
035d1eb2a6
commit
695012520f
|
@ -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 {{{
|
||||
|
|
Loading…
Reference in New Issue