V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 43s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 43s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -48,7 +48,7 @@ mount_with_dir() {
|
||||
ary_cmd+=("${var_mount_device}" "${TARGET}${var_mount_path}")
|
||||
|
||||
safe_exec "${ary_cmd[@]}" "${ERR_MOUNTING_DEV}" || return
|
||||
do_log "info" "file_only" "Mounted: '${var_mount_device}' on: '${TARGET}${var_mount_path}' (Options='${var_mount_options}')."
|
||||
do_log "info" "file_only" "3280() Mounted: '${var_mount_device}' on: '${TARGET}${var_mount_path}' (Options='${var_mount_options}')."
|
||||
}
|
||||
|
||||
#######################################
|
||||
@@ -61,7 +61,7 @@ mount_with_dir() {
|
||||
#######################################
|
||||
resolve_device() {
|
||||
declare local_var_dev="$1" local_var_partition="$2" local_var_enc_boolean="$3" local_var_enc_label="$4"
|
||||
if [[ "${local_var_enc_boolean,,}" == true ]]; then
|
||||
if [[ "${local_var_enc_boolean,,}" == "true" ]]; then
|
||||
printf '/dev/mapper/%s' "${local_var_enc_label}"
|
||||
else
|
||||
printf '/dev/%s%s' "${local_var_dev}" "${local_var_partition}"
|
||||
@@ -81,7 +81,7 @@ validate_btrfs_compression() {
|
||||
declare var_algo="$1" var_level="$2"
|
||||
case "${var_algo}:${var_level}" in
|
||||
zstd:|zstd:[0-9]|zstd:1[0-9]|zstd:2[0-2]|lzo:) return 0 ;;
|
||||
*) do_log "error" "file_only" "Invalid btrfs compression '${var_algo}:${var_level}'"; return "${ERR_BTRFS_OPTION}" ;;
|
||||
*) do_log "error" "file_only" "3280() Invalid btrfs compression '${var_algo}:${var_level}'"; return "${ERR_BTRFS_OPTION}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -107,13 +107,13 @@ mount_partition() {
|
||||
### Mount "/"-filesystem
|
||||
declare -r var_mount_path_root="/"
|
||||
|
||||
if [[ -n ${HMP_MOUNTPATH_DEV[${var_mount_path_root}]} ]]; then
|
||||
if [[ -n "${HMP_MOUNTPATH_DEV[${var_mount_path_root}]}" ]]; then
|
||||
|
||||
mount_with_dir "${var_mount_path_root}" "${HMP_MOUNTPATH_DEV[${var_mount_path_root}]}" || return "${ERR_MOUNTING_DEV}"
|
||||
|
||||
else
|
||||
|
||||
do_log "error" "file_only" "Root-filesystem '${var_mount_path_root}' not found in Hashmap."
|
||||
do_log "error" "file_only" "3280() Root-filesystem '${var_mount_path_root}' not found in Hashmap."
|
||||
return "${ERR_MOUNTING_ROOT}"
|
||||
|
||||
fi
|
||||
@@ -123,13 +123,13 @@ mount_partition() {
|
||||
|
||||
for var_path in "/boot" "/boot/efi"; do
|
||||
|
||||
if [[ -n ${HMP_MOUNTPATH_DEV[${var_path}]} ]]; then
|
||||
if [[ -n "${HMP_MOUNTPATH_DEV[${var_path}]}" ]]; then
|
||||
|
||||
mount_with_dir "${var_path}" "${HMP_MOUNTPATH_DEV[${var_path}]}" || return "${ERR_MOUNTING_DEV}"
|
||||
|
||||
else
|
||||
|
||||
do_log "info" "file_only" "Entry '${var_path}' not found in Hashmap."
|
||||
do_log "info" "file_only" "3280() Entry '${var_path}' not found in Hashmap."
|
||||
|
||||
fi
|
||||
|
||||
@@ -175,7 +175,7 @@ mount_partition() {
|
||||
--sector-size 4096 "/dev/disk/by-label/${var_fs_label}" "${var_encryption_label}"
|
||||
mkswap "/dev/mapper/${var_encryption_label}"
|
||||
swapon "/dev/mapper/${var_encryption_label}"
|
||||
do_log "info" "file_only" "Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||
do_log "info" "file_only" "3280() Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||
continue
|
||||
|
||||
elif [[ "${var_mount_path}" == "/tmp" ]]; then
|
||||
@@ -192,7 +192,7 @@ mount_partition() {
|
||||
ary_cmd2+=("/dev/mapper/${var_encryption_label}" "${TARGET}${var_mount_path}")
|
||||
|
||||
safe_exec "${ary_cmd2[@]}" "${ERR_MOUNTING_DEV}" || return "${ERR_MOUNTING_DEV}"
|
||||
do_log "info" "file_only" "Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||
do_log "info" "file_only" "3280() Mounted: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||
continue
|
||||
|
||||
fi
|
||||
@@ -200,23 +200,27 @@ mount_partition() {
|
||||
declare var_resolved_dev
|
||||
var_resolved_dev=$(resolve_device "${var_dev}" "${var_part}" "${var_encryption_enable}" "${var_encryption_label}")
|
||||
|
||||
if [[ "${var_fs_version,,}" == btrfs ]]; then
|
||||
if [[ "${var_fs_version,,}" == "btrfs" ]]; then
|
||||
|
||||
### Mount toplevel (subvolid=0) *without* extra options
|
||||
### Mount toplevel (subvolid=0) without extra options.
|
||||
declare -a ary_cmd_mount=(mount -o "subvolid=0" "${var_resolved_dev}" "${VAR_SAFE_MNT_BASE}")
|
||||
safe_exec "${ary_cmd_mount[@]}" "${ERR_BTRFS_INITPH}" || return "${ERR_BTRFS_INITPH}"
|
||||
|
||||
btrfs subvolume create "${VAR_SAFE_MNT_BASE}"/"${var_fs_btrfs_subvolume}"
|
||||
do_log "info" "file_only" "3280() btrfs subvolid=0 created: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||
|
||||
if [[ -n "${var_fs_btrfs_snapshot}" ]]; then
|
||||
btrfs subvolume create "${VAR_SAFE_MNT_BASE}"/"${var_fs_btrfs_snapshot}" || return "${ERR_BTRFS_SUBVOL}"
|
||||
do_log "info" "file_only" "3280() btrfs subvolid=${var_fs_btrfs_snapshot} created: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||
fi
|
||||
|
||||
umount "${VAR_SAFE_MNT_BASE}"
|
||||
do_log "info" "file_only" "3280() btrfs subvolume umount: '${var_mount_path}' on: '/dev/mapper/${var_encryption_label}'."
|
||||
|
||||
fi
|
||||
|
||||
case "${var_fs_version,,}:${var_encryption_enable,,}" in
|
||||
|
||||
btrfs:*)
|
||||
validate_btrfs_compression "${var_fs_btrfs_compress}" "${var_fs_btrfs_level}" || return "${ERR_BTRFS_OPTION}"
|
||||
declare var_btrfs_compression_options="compress=${var_fs_btrfs_compress}:${var_fs_btrfs_level}"
|
||||
@@ -224,19 +228,25 @@ mount_partition() {
|
||||
mount_with_dir "${var_mount_path}" "${var_resolved_dev}" "${var_btrfs_compression_options}" || return "${ERR_MOUNTING_DEV}"
|
||||
if [[ -n "${var_fs_btrfs_snapshot}" ]]; then
|
||||
mkdir -p "${TARGET}${var_mount_path}/.snapshots"
|
||||
do_log "info" "file_only" "3280() Created: '${TARGET}${var_mount_path}/.snapshots'."
|
||||
mount -o "${var_mount_optsnap}" "${var_resolved_dev}" "${TARGET}${var_mount_path}/.snapshots"
|
||||
do_log "info" "file_only" "3280() Mounted: '${var_resolved_dev}' on: '${TARGET}${var_mount_path}/.snapshots' (Options='${var_mount_optsnap}')."
|
||||
fi
|
||||
;;
|
||||
|
||||
ext4:*)
|
||||
mount_with_dir "${var_mount_path}" "${var_resolved_dev}" "${var_mount_options}" || return "${ERR_MOUNTING_DEV}"
|
||||
;;
|
||||
*) do_log "error" "file_only" "Unsupported fs/encryption combination."
|
||||
|
||||
*) do_log "error" "file_only" "3280() Unsupported fs/encryption combination."
|
||||
return "${ERR_MOUNTING_DEV}" ;;
|
||||
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
Reference in New Issue
Block a user