V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 52s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 52s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -41,33 +41,43 @@ configure_system() {
|
|||||||
|
|
||||||
### Declare Arrays, HashMaps, and Variables.
|
### Declare Arrays, HashMaps, and Variables.
|
||||||
declare -A HMP_SPECIAL_MOUNTS=(
|
declare -A HMP_SPECIAL_MOUNTS=(
|
||||||
["/dev/pts"]="devpts devpts noexec,nosuid" ### Mount 'devpts' (used by pseudo-terminals).
|
["/dev"]="devtmpfs devtmpfs mode=0755,nosuid" # Base device node FS
|
||||||
["/dev/shm"]="tmpfs tmpfs rw,nosuid,nodev" ### Mount 'tmpfs' for '/dev/shm' (shared memory).
|
["/dev/pts"]="devpts devpts noexec,nosuid" # Pseudoterminals
|
||||||
["/dev/mqueue"]="mqueue mqueue rw,nosuid,nodev,noexec" ### Mount 'mqueue' for POSIX message queues.
|
["/dev/shm"]="tmpfs tmpfs rw,nosuid,nodev" # Shared memory
|
||||||
["/dev/hugepages"]="hugetlbfs hugetlbfs rw,nosuid,nodev" ### Mount 'hugetlbfs' (huge pages, may be unused but required on some 'archs').
|
["/dev/mqueue"]="mqueue mqueue rw,nosuid,nodev,noexec" # POSIX message queues
|
||||||
["/sys/fs/cgroup"]="cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime" ### Mount unified 'cgroup2' hierarchy.
|
["/dev/hugepages"]="hugetlbfs hugetlbfs rw,nosuid,nodev" # Huge pages
|
||||||
|
["/proc"]="proc proc nosuid,noexec,nodev" # procfs
|
||||||
|
["/sys"]="sysfs sysfs nosuid,noexec,nodev" # sysfs
|
||||||
|
["/sys/fs/cgroup"]="cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime" # Unified cgroup2
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -a ary_mount=( "/proc" "/sys" "/dev" )
|
declare var_path="" var_fs="" var_src="" var_opts=""
|
||||||
declare var_src="" var_dst="" var_path="" var_fs="" var_opts=""
|
|
||||||
|
|
||||||
for var_path in "${ary_mount[@]}" "${!HMP_SPECIAL_MOUNTS[@]}"; do
|
for var_path in "${!HMP_SPECIAL_MOUNTS[@]}"; do
|
||||||
|
|
||||||
mkdir -p "${TARGET}${var_path}"
|
mkdir -p "${TARGET}${var_path}"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for var_src in "${ary_mount[@]}"; do
|
for var_path in "${!HMP_SPECIAL_MOUNTS[@]}"; do
|
||||||
var_dst="${TARGET}${var_src}"
|
|
||||||
|
|
||||||
if ! mount --make-rslave --rbind "${var_src}" "${var_dst}"; then
|
IFS=" " read -r var_fs var_src var_opts <<< "${HMP_SPECIAL_MOUNTS[${var_path}]}"
|
||||||
|
|
||||||
do_log "emergency" "file_only" "4020() Command: [mount --make-rslave --rbind ${var_src} ${var_dst}] failed."
|
if mountpoint -q "${TARGET}${var_path}"; then
|
||||||
|
|
||||||
|
do_log "info" "file_only" "4020() Skipped: '${TARGET}${var_path}' is already a mountpoint."
|
||||||
|
continue
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mount -t "${var_fs}" "${var_src}" "${TARGET}${var_path}" -o "${var_opts}"; then
|
||||||
|
|
||||||
|
do_log "emergency" "file_only" "4020() Command: [mount -t ${var_fs} ${var_src} ${TARGET}${var_path} -o ${var_opts}] failed."
|
||||||
return "${ERR_CHRT_MOUNTS}"
|
return "${ERR_CHRT_MOUNTS}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_log "info" "file_only" "4020() Command: [mount --make-rslave --rbind ${var_src} ${var_dst}] successful."
|
do_log "info" "file_only" "4020() Command: [mount -t ${var_fs} ${var_src} ${TARGET}${var_path} -o ${var_opts}] successful."
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -86,34 +96,15 @@ configure_system() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for var_path in "${!HMP_SPECIAL_MOUNTS[@]}"; do
|
|
||||||
|
|
||||||
IFS=" " read -r var_fs var_src var_opts <<< "${HMP_SPECIAL_MOUNTS[${var_path}]}"
|
|
||||||
|
|
||||||
if ! mount -t "${var_fs}" "${var_src}" "${TARGET}${var_path}" -o "${var_opts}"; then
|
|
||||||
|
|
||||||
do_log "emergency" "file_only" "4020() Command: [mount -t ${var_fs} ${var_src} ${TARGET}${var_path} -o ${var_opts}] failed."
|
|
||||||
return "${ERR_CHRT_MOUNTS}"
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
do_log "info" "file_only" "4020() Command: [mount -t ${var_fs} ${var_src} ${TARGET}${var_path} -o ${var_opts}] successful."
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! do_in_target "${TARGET}" mkdir -p /etc/systemd/system/multi-user.target.wants; then
|
if ! do_in_target "${TARGET}" mkdir -p /etc/systemd/system/multi-user.target.wants; then
|
||||||
|
|
||||||
do_log "emergency" "file_only" "4020() Command: [do_in_target ${TARGET} mkdir -p /etc/systemd/system/multi-user.target.wants] failed."
|
do_log "emergency" "file_only" "4020() Command: [do_in_target ${TARGET} mkdir -p /etc/systemd/system/multi-user.target.wants] failed."
|
||||||
return "${ERR_CHRT_MOUNTS}"
|
return "${ERR_CHRT_MOUNTS}"
|
||||||
|
|
||||||
else
|
fi
|
||||||
|
|
||||||
do_log "info" "file_only" "4020() Command: [do_in_target ${TARGET} mkdir -p /etc/systemd/system/multi-user.target.wants] successful."
|
do_log "info" "file_only" "4020() Command: [do_in_target ${TARGET} mkdir -p /etc/systemd/system/multi-user.target.wants] successful."
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
declare -gx VAR_CHROOT_ACTIVATED="system"
|
declare -gx VAR_CHROOT_ACTIVATED="system"
|
||||||
|
|
||||||
|
|||||||
@@ -132,8 +132,12 @@ EOF
|
|||||||
write_fstab "${var_fs_uuid}" "${var_fs_path}" "${var_fs_type}" "${var_fs_opts}" "${var_fs_pass}"
|
write_fstab "${var_fs_uuid}" "${var_fs_path}" "${var_fs_type}" "${var_fs_opts}" "${var_fs_pass}"
|
||||||
if [[ -v HMP_FSTAB_MOUNT_OPTS["${var_path}/.snapshots"] ]]; then
|
if [[ -v HMP_FSTAB_MOUNT_OPTS["${var_path}/.snapshots"] ]]; then
|
||||||
var_fs_opts="${HMP_FSTAB_MOUNT_OPTS["${var_path}/.snapshots"]}"
|
var_fs_opts="${HMP_FSTAB_MOUNT_OPTS["${var_path}/.snapshots"]}"
|
||||||
|
if [[ "${var_fs_path}" == "/" ]]; then
|
||||||
|
write_fstab "${var_fs_uuid}" "/.snapshots" "${var_fs_type}" "${var_fs_opts}" "${var_fs_pass}"
|
||||||
|
else
|
||||||
write_fstab "${var_fs_uuid}" "${var_fs_path}/.snapshots" "${var_fs_type}" "${var_fs_opts}" "${var_fs_pass}"
|
write_fstab "${var_fs_uuid}" "${var_fs_path}/.snapshots" "${var_fs_type}" "${var_fs_opts}" "${var_fs_pass}"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user