V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 44s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-29 19:46:22 +02:00
parent dd9c937a56
commit 219c272299
10 changed files with 88 additions and 92 deletions

View File

@@ -254,7 +254,7 @@ partitioning() {
return "${ERR_PART_READ}"
else
HMP_PATH_PARTUUID["${var_mount_path}"]="${var_uuid}"
do_log "debug" "file_only" "3200() Stored in HashMap [HMP_PATH_PARTUUID] : '${var_mount_path}' -> '${HMP_PATH_PARTUUID["${var_mount_path}"]}'."
do_log "debug" "file_only" "3200() [HMP_PATH_PARTUUID]: '${var_mount_path}' -> '${HMP_PATH_PARTUUID["${var_mount_path}"]}'."
fi
### Gathering information for forthcoming modules 32n0().
@@ -280,9 +280,9 @@ partitioning() {
if [[ "${var_mount_true}" == "true" ]]; then
# shellcheck disable=SC2034
ARY_FSTAB_MOUNT_PATHS+=("${var_mount_path}")
do_log "debug" "file_only" "3200() Stored in Array [ARY_FSTAB_MOUNT_PATHS] : '${var_mount_path}'."
do_log "debug" "file_only" "3200() [ARY_FSTAB_MOUNT_PATHS]: '${var_mount_path}'."
HMP_FSTAB_MOUNT_FTYPE["${var_mount_path}"]="${var_fs}"
do_log "debug" "file_only" "3200() Stored in HashMap [HMP_FSTAB_MOUNT_FTYPE] : '${var_mount_path}' -> '${HMP_FSTAB_MOUNT_FTYPE["${var_mount_path}"]}'."
do_log "debug" "file_only" "3200() [HMP_FSTAB_MOUNT_FTYPE]: '${var_mount_path}' -> '${HMP_FSTAB_MOUNT_FTYPE["${var_mount_path}"]}'."
fi

View File

@@ -49,7 +49,7 @@ partition_encryption() {
declare -gx VAR_CRYPT_ROOT="" # LUKS UUID of '/'.
declare -gx VAR_CRYPT_RECOVERY="" # LUKS UUID of '/recovery'.
declare var_encryption_path="" var_dev_part="" \
declare var_encryption_path="" var_dev_part="" var_dev="" \
var_encryption_ephemeral="" var_encryption_integrity="" var_encryption_cipher="" var_encryption_hash="" \
var_encryption_key="" var_encryption_label="" var_encryption_meta="" var_encryption_slot="" \
var_encryption_pbkdf="" var_encryption_rng="" var_filesystem_label="" var_mount_path="" var_uuid="" var_fs=""
@@ -63,6 +63,7 @@ partition_encryption() {
### Generates physical device location.
var_dev_part="${HMP_PATH_DEV_PART["${var_encryption_path}"]}"
var_dev="${var_dev_part//./}"
### Extract parameters from YAML.
var_encryption_ephemeral=$(yq_val ".recipe.${VAR_RECIPE_STRING}.dev.${var_dev_part}.encryption.ephemeral" "${VAR_SETUP_PART}")
@@ -118,10 +119,10 @@ partition_encryption() {
var_filesystem_label=$(get_label "${var_encryption_path}" "${var_fs}" "file")
mkfs.ext4 -L "${var_filesystem_label}" "/dev/${var_dev_part}" 1M
do_log "info" "file_only" "3220() Ephemeral: '${var_encryption_path}' prepared on: '/dev/${var_dev_part}'."
mkfs.ext4 -L "${var_filesystem_label}" "/dev/${var_dev}" 1M
do_log "info" "file_only" "3220() Ephemeral: '${var_encryption_path}' prepared on: '/dev/${var_dev}'."
var_fs_uuid=$(blkid -s UUID -o value "${var_dev_part}")
var_fs_uuid=$(blkid -s UUID -o value "${var_dev}")
### Gathering information for '/etc/fstab'-generation in 4040() and '/etc/crypttab'-generation in 4060().
# shellcheck disable=SC2034
HMP_PATH_FSUUID["${var_encryption_path}"]="${var_fs_uuid}"
@@ -139,7 +140,7 @@ partition_encryption() {
*)
do_log "error" "file_only" "3220() Invalid mount path: '${var_encryption_path}' for partition: '/dev/${var_dev_part}'."
do_log "error" "file_only" "3220() Invalid mount path: '${var_encryption_path}' for partition: '/dev/${var_dev}'."
### There is no other need to implement ephemeral devices.
continue
;;
@@ -148,40 +149,40 @@ partition_encryption() {
fi
cryptsetup luksFormat "${ary_luks_opts[@]}" "/dev/${var_dev_part}"
cryptsetup luksFormat "${ary_luks_opts[@]}" "/dev/${var_dev}"
if [[ "${var_encryption_integrity,,}" == "true" ]]; then
do_log "debug" "file_only" "3220() [cryptsetup luksFormat ${ary_luks_opts[*]} /dev/${var_dev_part}]."
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev_part}' dm-integrity encrypted."
do_log "debug" "file_only" "3220() [cryptsetup luksFormat ${ary_luks_opts[*]} /dev/${var_dev}]."
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev}' dm-integrity encrypted."
else
do_log "debug" "file_only" "3220() [cryptsetup luksFormat ${ary_luks_opts[*]} /dev/${var_dev_part}]."
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev_part}' encrypted."
do_log "debug" "file_only" "3220() [cryptsetup luksFormat ${ary_luks_opts[*]} /dev/${var_dev}]."
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev}' encrypted."
fi
cryptsetup luksHeaderBackup --header-backup-file="${DIR_BAK}/luks_header_${var_dev_part}.bak" "/dev/${var_dev_part}"
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev_part}' LUKS Header saved: '${DIR_BAK}/luks_header_${var_dev_part}.bak'."
cryptsetup luksHeaderBackup --header-backup-file="${DIR_BAK}/luks_header_${var_dev}.bak" "/dev/${var_dev}"
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev}' LUKS Header saved: '${DIR_BAK}/luks_header_${var_dev}.bak'."
### Opening encrypted container.
if [[ "${var_encryption_path,,}" == "/boot" ]]; then
cryptsetup luksOpen "/dev/${var_dev_part}" \
cryptsetup luksOpen "/dev/${var_dev}" \
--key-file="${DIR_CNF}/password_luks_boot.txt" \
"${var_encryption_label}"
else
cryptsetup luksOpen "/dev/${var_dev_part}" \
cryptsetup luksOpen "/dev/${var_dev}" \
--key-file="${DIR_CNF}/password_luks_common.txt" \
"${var_encryption_label}"
fi
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev_part}' opened as '/dev/mapper/${var_encryption_label}'."
do_log "info" "file_only" "3220() Partition: '/dev/${var_dev}' opened as '/dev/mapper/${var_encryption_label}'."
### Create luksDump log entry.
cryptsetup luksDump "/dev/${var_dev_part}" >> "${DIR_LOG}/cryptsetup_luksdump_${var_dev_part}.log"
cryptsetup luksDump "/dev/${var_dev}" >> "${DIR_LOG}/cryptsetup_luksdump_${var_dev}.log"
### Store UUID of the LUKS container.
var_uuid=$(blkid -s UUID -o value "/dev/${var_dev_part}")
var_uuid=$(blkid -s UUID -o value "/dev/${var_dev}")
[[ "${var_encryption_path}" == "/" ]] && declare -grx VAR_CRYPT_ROOT="${var_uuid}"
[[ "${var_encryption_path}" == "/recovery" ]] && declare -grx VAR_CRYPT_RECOVERY="${var_uuid}"

View File

@@ -33,7 +33,7 @@ partition_formatting() {
declare -Ag HMP_PATH_FSUUID # Used in: 3290() - [Mount Path:Filesystem UUID].
# Used in: 4040() - [Mount Path:Filesystem UUID].
# Used in: 4060() - [Mount Path:Filesystem UUID].
declare var_dev="" var_dev_part="" \
declare var_dev="" var_dev_part="" var_dev="" \
var_encryption_enable="" var_encryption_label="" var_format_path="" var_fs_btrfs_checksum="" \
var_fs_btrfs_compress="" var_fs_btrfs_mdup="" var_fs_label="" var_fs_options="" var_fs_version="" \
var_node="" var_fs_uuid=""
@@ -47,6 +47,7 @@ partition_formatting() {
### Generates physical device location.
var_dev_part="${HMP_PATH_DEV_PART["${var_format_path}"]}"
var_dev="${var_dev_part//./}"
### Extract parameters from YAML.
var_encryption_enable=$(yq_val ".recipe.${VAR_RECIPE_STRING}.dev.${var_dev_part}.encryption.enable" "${VAR_SETUP_PART}")
@@ -58,7 +59,7 @@ partition_formatting() {
case "${var_format_path,,}" in
swap|/tmp)
do_log "info" "file_only" "3240() Partition: '/dev/${var_dev_part}' ephemeral encryption already prepared in 3220(): '${var_format_path}'."
do_log "info" "file_only" "3240() Partition: '/dev/${var_dev}' ephemeral encryption already prepared in 3220(): '${var_format_path}'."
### Nothing more to do here.
continue
;;
@@ -68,7 +69,7 @@ partition_formatting() {
var_encryption_label=$(get_label "${var_format_path}" "${var_fs_version}" "luks")
var_node="/dev/mapper/${var_encryption_label}"
else
var_node="/dev/${var_dev_part}"
var_node="/dev/${var_dev}"
fi
var_fs_label=$(get_label "${var_format_path}" "${var_fs_version}" "file")
@@ -129,9 +130,6 @@ partition_formatting() {
esac
var_dev="${HMP_PATH_DEV_PART["${var_format_path}"]}"
var_dev="${var_dev%.*}"
lsblk -o NAME,MAJ:MIN,FSTYPE,FSVER,SIZE,UUID,MOUNTPOINT,PATH "/dev/${var_dev}" >| "${DIR_LOG}/${var_dev}_overview_3240.log"
printf "%b" "${NL}" >> "${DIR_LOG}/${var_dev}_overview_3240.log"
lsblk "/dev/${var_dev}" >> "${DIR_LOG}/${var_dev}_overview_3240.log"

View File

@@ -137,6 +137,7 @@ mount_partition() {
### Generates physical device location.
var_dev_part="${HMP_PATH_DEV_PART["${var_mount_path}"]}"
var_dev="${var_dev_part//./}"
### Extract parameters from YAML.
var_fs_btrfs_compress=$(yq_val ".recipe.${VAR_RECIPE_STRING}.dev.${var_dev_part}.filesystem.btrfs.compress" "${VAR_SETUP_PART}")
@@ -287,9 +288,6 @@ mount_partition() {
esac
var_dev="${HMP_PATH_DEV_PART["${var_mount_path}"]}"
var_dev="${var_dev%.*}"
lsblk -o NAME,MAJ:MIN,FSTYPE,FSVER,SIZE,UUID,MOUNTPOINT,PATH "/dev/${var_dev}" >| "${DIR_LOG}/${var_dev}_overview_3280.log"
printf "%b" "${NL}" >> "${DIR_LOG}/${var_dev}_overview_3280.log"
lsblk "/dev/${var_dev}" >> "${DIR_LOG}/${var_dev}_overview_3280.log"