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

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-30 10:40:21 +02:00
parent 9c095935da
commit 0ecc446575

View File

@@ -29,7 +29,8 @@ mount_with_dir() {
declare var_mount_path="${1}" var_mount_device="${2}" var_mount_options="${3:-}" var_mount_fs="${4:-}"
declare -a ary_cmd=( mount )
if [[ "${var_mount_device}" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}$ ]] || [[ "${var_mount_device}" =~ ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ ]]; then
### GPT-UUID conformity (RFC 4122).
if [[ "${var_mount_device}" =~ ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$ ]]; then
if [[ -e "/dev/disk/by-uuid/${var_mount_device}" ]]; then
@@ -37,7 +38,44 @@ mount_with_dir() {
else
do_log "error" "file_only" "3280() FS-UUID for mount path: '${var_mount_device}' not found by '/dev/disk/by-uuid/${var_mount_device}'."
do_log "error" "file_only" "3280() GPT-UUID for mount path: '${var_mount_path}' not found by '/dev/disk/by-uuid/${var_mount_device}'."
return "${ERR_MOUNTING_DEV}"
fi
### VFAT-UUID conformity.
elif [[ "${var_mount_device}" =~ ^[0-9A-F]{4}-[0-9A-F]{4}$ ]]; then
if [[ -e "/dev/disk/by-uuid/${var_mount_device}" ]]; then
var_mount_device="/dev/disk/by-uuid/${var_mount_device}"
else
do_log "error" "file_only" "3280() FAT-UUID for mount path: '${var_mount_path}' not found by '/dev/disk/by-uuid/${var_mount_device}'."
return "${ERR_MOUNTING_DEV}"
fi
### Already absolute path.
elif [[ "${var_mount_device}" == /dev/* ]]; then
: ### Do nothing
### Alternative checks for LABEL and PARTUUID.
else
if [[ -e "/dev/disk/by-label/${var_mount_device}" ]]; then
var_mount_device="/dev/disk/by-label/${var_mount_device}"
elif [[ -e "/dev/disk/by-partuuid/${var_mount_device}" ]]; then
var_mount_device="/dev/disk/by-partuuid/${var_mount_device}"
else
do_log "error" "file_only" "3280() Mount path: '${var_mount_path}' could not be resolved by [UUID, LABEL, DEV, PARTUUID]'."
return "${ERR_MOUNTING_DEV}"
fi
@@ -50,11 +88,9 @@ mount_with_dir() {
fi
[[ "${var_mount_path}" != "/" ]] && mkdir -p "${TARGET}${var_mount_path}"
### Build the command in an array to keep word boundaries intact.
[[ -n "${var_mount_fs}" ]] && ary_cmd+=( "-t" "${var_mount_fs}" )
[[ -n "${var_mount_options}" ]] && ary_cmd+=( "-o" "${var_mount_options}" )