V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m21s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m21s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -1,67 +1,63 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# SPDX-Version: 3.0
|
# SPDX-Version: 3.0
|
||||||
# SPDX-CreationInfo: 2025-02-13; WEIDNER, Marc S.; <cendev@coresecret.eu>
|
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||||
# SPDX-ExternalRef: GIT https://cendev.eu/marc.weidner/CISS.2025.debian.installer.git
|
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.git
|
||||||
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
||||||
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <cendev@coresecret.eu>
|
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||||
# SPDX-FileType: SOURCE
|
# SPDX-FileType: SOURCE
|
||||||
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
||||||
# SPDX-LicenseComment: This file is part of the CISS.2025.hardened.installer framework.
|
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
||||||
# SPDX-PackageName: CISS.2025.hardened.installer
|
# SPDX-PackageName: CISS.debian.installer
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
|
|
||||||
###########################################################################################
|
guard_sourcing
|
||||||
# 3.6.1. Functions - installation - mount partition #
|
|
||||||
###########################################################################################
|
|
||||||
|
|
||||||
###########################################################################################
|
#######################################
|
||||||
# Function to generate btrfs-subvolumes.
|
# Function to generate btrfs-subvolumes.
|
||||||
# Globals:
|
# Globals:
|
||||||
# ERR_CREAT_SUB_VOL
|
# ERR_BTRFS_SUBVOL
|
||||||
# TARGET
|
# TARGET
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1: MOUNT_PATH
|
# $1: MOUNT_PATH
|
||||||
# 2: SUBVOLUME
|
# $2: SUBVOLUME
|
||||||
###########################################################################################
|
#######################################
|
||||||
create_btrfs_subvolume() {
|
create_btrfs_subvolume() {
|
||||||
declare MOUNT_PATH="$1"
|
declare var_mount_path="$1"
|
||||||
declare SUBVOLUME="$2"
|
declare var_subvolume="$2"
|
||||||
|
|
||||||
btrfs subvolume create "${TARGET}${MOUNT_PATH}/${SUBVOLUME}" || {
|
btrfs subvolume create "${TARGET}${var_mount_path}/${var_subvolume}" || {
|
||||||
do_log "error" "false" "Error occurred at creation of subvolume: '${SUBVOLUME}' in: '${TARGET}${MOUNT_PATH}'."
|
do_log "error" "false" "Error occurred at creation of subvolume: '${var_subvolume}' in: '${TARGET}${var_mount_path}'."
|
||||||
exit "${ERR_CREAT_SUB_VOL}"
|
exit "${ERR_BTRFS_SUBVOL}"
|
||||||
}
|
}
|
||||||
do_log "info" "false" "Created: '${SUBVOLUME}' at: '${TARGET}${MOUNT_PATH}'."
|
do_log "info" "false" "Created: '${var_subvolume}' at: '${TARGET}${var_mount_path}'."
|
||||||
}
|
}
|
||||||
|
|
||||||
###########################################################################################
|
#######################################
|
||||||
# Function to create the mount path and mount the respective device on it.
|
# Function to create the mount path and mount the respective device on it.
|
||||||
# Globals:
|
# Globals:
|
||||||
# ERR_MOUNTING_PATH
|
# ERR_MOUNTING_DEV
|
||||||
# TARGET
|
# TARGET
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1: MOUNT_PATH
|
# $1: MOUNT_PATH
|
||||||
# $2: MOUNT_DEVICE
|
# $2: MOUNT_DEVICE
|
||||||
# $3: MOUNT_OPTIONS
|
# $3: MOUNT_OPTIONS
|
||||||
###########################################################################################
|
#######################################
|
||||||
mount_with_dir() {
|
mount_with_dir() {
|
||||||
declare MOUNT_PATH="$1"
|
declare var_mount_path="$1"
|
||||||
declare MOUNT_DEVICE="$2"
|
declare var_mount_device="$2"
|
||||||
declare MOUNT_OPTIONS="$3"
|
declare var_mount_options="$3"
|
||||||
|
|
||||||
if [[ ${MOUNT_PATH} == "/" ]]; then
|
if [[ "${var_mount_path}" == "/" ]]; then
|
||||||
MOUNT_PATH=""
|
var_mount_path=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create directory
|
mkdir -p "${TARGET}${var_mount_path}"
|
||||||
mkdir -p "${TARGET}${MOUNT_PATH}"
|
|
||||||
|
|
||||||
# Mount routine
|
mount "${var_mount_options:+-o $var_mount_options}" "${var_mount_device}" "${TARGET}${var_mount_path}" || {
|
||||||
mount "${MOUNT_OPTIONS:+-o $MOUNT_OPTIONS}" "${MOUNT_DEVICE}" "${TARGET}${MOUNT_PATH}" || {
|
do_log "error" "false" "Error occurred at mounting '${var_mount_device}' on: '${TARGET}${var_mount_path}'."
|
||||||
do_log "error" "false" "Error occurred at mounting '${MOUNT_DEVICE}' on: '${TARGET}${MOUNT_PATH}'."
|
exit "${ERR_MOUNTING_DEV}"
|
||||||
exit "${ERR_MOUNTING_PATH}"
|
|
||||||
}
|
}
|
||||||
do_log "info" "false" "Mounted: '${MOUNT_DEVICE}' on: '${TARGET}${MOUNT_PATH}' with: '${MOUNT_OPTIONS}'."
|
do_log "info" "false" "Mounted: '${var_mount_device}' on: '${TARGET}${var_mount_path}' incl. options: '${var_mount_options}'."
|
||||||
}
|
}
|
||||||
|
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
@@ -79,25 +75,26 @@ mount_with_dir() {
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
3_6_1_functions_installation_mount_partition() {
|
mount_partition() {
|
||||||
declare -g -x MODULE_ERR="3_6_1_functions_installation_mount_partition"
|
### 3260_setup_filesystem.sh
|
||||||
declare -g -x MODULE_TXT="Mounting all partitions for debootstrap incl. generating btrfs subvolumes"
|
### Assoziative Array (HashMap) to store Crypt Mapper OR Device for each Mount Path
|
||||||
do_show_header "${MODULE_TXT}"
|
### HMP_MOUNTPATH_DEV["${var_mount_path}"]="/dev/mapper/${var_encryption_label}"
|
||||||
|
### HMP_MOUNTPATH_DEV["${var_mount_path}"]="/dev/${var_dev}${var_part}"
|
||||||
|
|
||||||
# Mount "/"-filesystem
|
### Mount "/"-filesystem
|
||||||
declare -r MOUNT_PATH_ROOT="/"
|
declare -r var_mount_path_root="/"
|
||||||
if [[ -n ${MAP_MOUNTPATH_DEV[$MOUNT_PATH_ROOT]} ]]; then
|
if [[ -n ${MAP_MOUNTPATH_DEV[$var_mount_path_root]} ]]; then
|
||||||
mount_with_dir "${MOUNT_PATH_ROOT}" "${MAP_MOUNTPATH_DEV[$MOUNT_PATH_ROOT]}"
|
mount_with_dir "${var_mount_path_root}" "${MAP_MOUNTPATH_DEV[$var_mount_path_root]}"
|
||||||
else
|
else
|
||||||
do_log "error" "false" "Root-filesystem '${MOUNT_PATH_ROOT}' not found in Hashmap."
|
do_log "error" "false" "Root-filesystem '${var_mount_path_root}' not found in Hashmap."
|
||||||
exit "${ERR_MOUNTING_ROOT}"
|
exit "${ERR_MOUNTING_ROOT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure order of "/boot" and "/boot/efi"
|
### Ensure order of "/boot" and "/boot/efi"
|
||||||
declare PATH
|
declare var_path
|
||||||
for PATH in "/boot" "/boot/efi"; do
|
for var_path in "/boot" "/boot/efi"; do
|
||||||
if [[ -n ${MAP_MOUNTPATH_DEV[$PATH]} ]]; then
|
if [[ -n ${MAP_MOUNTPATH_DEV[${var_path}]} ]]; then
|
||||||
mount_with_dir "${PATH}" "${MAP_MOUNTPATH_DEV[$PATH]}"
|
mount_with_dir "${var_path}" "${MAP_MOUNTPATH_DEV[${var_path}]}"
|
||||||
else
|
else
|
||||||
do_log "info" "false" "Entry '${PATH}' not found in Hashmap."
|
do_log "info" "false" "Entry '${PATH}' not found in Hashmap."
|
||||||
fi
|
fi
|
||||||
@@ -261,7 +258,5 @@ mount_with_dir() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
do_log "info" "false" "All devices of 'MAP_MOUNTPATH_DEV' and 'MAP_EPHEMERALLABEL_DEV' successfully mounted."
|
do_log "info" "false" "All devices of 'MAP_MOUNTPATH_DEV' and 'MAP_EPHEMERALLABEL_DEV' successfully mounted."
|
||||||
|
|
||||||
do_show_footer "${MODULE_TXT}"
|
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh:
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
@@ -27,7 +27,9 @@ declare -girx ERR_INVALID_PORT=243 # Port validation failure.
|
|||||||
declare -girx ERR_ARG_MISMATCH=242 # The wrong number of optional arguments has been provided.
|
declare -girx ERR_ARG_MISMATCH=242 # The wrong number of optional arguments has been provided.
|
||||||
declare -girx ERR_PARTITIONTBL=241 # The partition table is not allowed.
|
declare -girx ERR_PARTITIONTBL=241 # The partition table is not allowed.
|
||||||
declare -girx ERR_READ_PARTTBL=240 # The partition could not be deleted, created, or the UUID of the partition could not be read.
|
declare -girx ERR_READ_PARTTBL=240 # The partition could not be deleted, created, or the UUID of the partition could not be read.
|
||||||
|
declare -girx ERR_BTRFS_SUBVOL=239 # The btrfs subvolume could not be created.
|
||||||
|
declare -girx ERR_MOUNTING_DEV=238 # The Device could not be mounted.
|
||||||
|
declare -girx ERR_MOUNTING_ROOT=237 # The / Volume could not be mounted.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,8 +87,9 @@ declare -Ag HMP_ENCRYPTIONLABEL_UUID
|
|||||||
declare -Ag HMP_MOUNTPATH_ENCRYPTIONLABEL
|
declare -Ag HMP_MOUNTPATH_ENCRYPTIONLABEL
|
||||||
|
|
||||||
### 3260_setup_filesystem.sh
|
### 3260_setup_filesystem.sh
|
||||||
### Assoziative Array (HashMap) to store Crypt Mapper for each Mount Path
|
### Assoziative Array (HashMap) to store Crypt Mapper OR Device for each Mount Path
|
||||||
### HMP_MOUNTPATH_DEV["${var_mount_path}"]="/dev/mapper/${var_encryption_label}"
|
### HMP_MOUNTPATH_DEV["${var_mount_path}"]="/dev/mapper/${var_encryption_label}"
|
||||||
|
### HMP_MOUNTPATH_DEV["${var_mount_path}"]="/dev/${var_dev}${var_part}"
|
||||||
declare -Ag HMP_MOUNTPATH_DEV
|
declare -Ag HMP_MOUNTPATH_DEV
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user