V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m27s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m27s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SPDX-Version: 3.0
|
||||
# SPDX-CreationInfo: 2025-02-13; WEIDNER, Marc S.; <cendev@coresecret.eu>
|
||||
# SPDX-ExternalRef: GIT https://cendev.eu/marc.weidner/CISS.2025.debian.installer.git
|
||||
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
||||
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <cendev@coresecret.eu>
|
||||
# SPDX-FileType: SOURCE
|
||||
# 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-PackageName: CISS.2025.hardened.installer
|
||||
# SPDX-Security-Contact: security@coresecret.eu
|
||||
|
||||
###########################################################################################
|
||||
# 3.6.0. Functions - installation - setup filesystem #
|
||||
###########################################################################################
|
||||
|
||||
###########################################################################################
|
||||
# Function to prepare the filesystem to mount each partition on the respective path.
|
||||
# Globals:
|
||||
# MAP_MOUNTPATH_DEV
|
||||
# MODULE_ERR
|
||||
# MODULE_TXT
|
||||
# RECIPE_DEV_PARTITIONS
|
||||
# RECIPE_STRING
|
||||
# Arguments:
|
||||
# None
|
||||
###########################################################################################
|
||||
3_6_0_functions_installation_setup_filesystem() {
|
||||
declare -g -x MODULE_ERR="3_6_0_functions_installation_setup_filesystem"
|
||||
declare -g -x MODULE_TXT="Prepare filesystem to mount each partition on the respective path"
|
||||
do_show_header "${MODULE_TXT}"
|
||||
|
||||
# Declare local variables
|
||||
declare DEV
|
||||
declare NUM_PARTITIONS
|
||||
declare PARTITION
|
||||
|
||||
# Iterate through each device
|
||||
for DEV in "${!RECIPE_DEV_PARTITIONS[@]}"; do
|
||||
NUM_PARTITIONS=${RECIPE_DEV_PARTITIONS[${DEV}]}
|
||||
|
||||
# Iterate through each partition of the current device
|
||||
for PARTITION in $(seq 1 "${NUM_PARTITIONS}"); do
|
||||
|
||||
# Generate vars for the current partition
|
||||
declare MOUNT_ENABLE_VAR="recipe_${RECIPE_STRING}_dev_${DEV}_${PARTITION}_mount_enable"
|
||||
declare MOUNT_PATH_VAR="recipe_${RECIPE_STRING}_dev_${DEV}_${PARTITION}_mount_path"
|
||||
declare ENCRYPTION_ENABLE_VAR="recipe_${RECIPE_STRING}_dev_${DEV}_${PARTITION}_encryption_enable"
|
||||
declare ENCRYPTION_LABEL_VAR="recipe_${RECIPE_STRING}_dev_${DEV}_${PARTITION}_encryption_label"
|
||||
|
||||
# Initialize variables
|
||||
declare MOUNT_ENABLE=${!MOUNT_ENABLE_VAR}
|
||||
declare MOUNT_PATH=${!MOUNT_PATH_VAR}
|
||||
declare ENCRYPTION_ENABLE=${!ENCRYPTION_ENABLE_VAR}
|
||||
declare ENCRYPTION_LABEL=${!ENCRYPTION_LABEL_VAR}
|
||||
|
||||
# Proceed if and only if "mount_enable" equals "true".
|
||||
if [[ ${MOUNT_ENABLE,,} == "true" ]]; then
|
||||
|
||||
if [[ -n ${MOUNT_PATH} ]]; then
|
||||
|
||||
if [[ ${ENCRYPTION_ENABLE,,} == "true" && ${MOUNT_PATH} != "SWAP" && ${MOUNT_PATH} != "/tmp" ]]; then
|
||||
|
||||
# Encrypted partition
|
||||
MAP_MOUNTPATH_DEV["${MOUNT_PATH}"]="/dev/mapper/${ENCRYPTION_LABEL}"
|
||||
do_log "info" "false" "Saved in HashMap MAP_MOUNTPATH_DEV: '${MOUNT_PATH}' -> '${MAP_MOUNTPATH_DEV["${MOUNT_PATH}"]}'"
|
||||
|
||||
elif [[ ${ENCRYPTION_ENABLE,,} == "false" && ${MOUNT_PATH} != "SWAP" && ${MOUNT_PATH} != "/tmp" ]]; then
|
||||
|
||||
# Unencrypted partition
|
||||
MAP_MOUNTPATH_DEV["${MOUNT_PATH}"]="/dev/${DEV}${PARTITION}"
|
||||
do_log "info" "false" "Saved in HashMap MAP_MOUNTPATH_DEV: '${MOUNT_PATH}' -> '${MAP_MOUNTPATH_DEV["${MOUNT_PATH}"]}'"
|
||||
|
||||
else
|
||||
|
||||
do_log "error" "false" "Invalid value for encryption_enable: '${ENCRYPTION_ENABLE}', should be either true or false."
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
done
|
||||
|
||||
do_show_footer
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh:
|
||||
Reference in New Issue
Block a user