All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m54s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
62 lines
1.9 KiB
Bash
62 lines
1.9 KiB
Bash
#!/bin/bash
|
|
# SPDX-Version: 3.0
|
|
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
|
|
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.git
|
|
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
|
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
|
# SPDX-FileType: SOURCE
|
|
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
|
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
|
# SPDX-PackageName: CISS.debian.installer
|
|
# SPDX-Security-Contact: security@coresecret.eu
|
|
|
|
guard_sourcing
|
|
|
|
#######################################
|
|
# Creates the DIRs, prepares the files and mounting paths for installation.
|
|
# Globals:
|
|
# LOG_DBS
|
|
# LOG_ERR
|
|
# LOG_EXT
|
|
# LOG_INS
|
|
# LOG_NIC
|
|
# LOG_REC
|
|
# LOG_UID
|
|
# RECOVERY
|
|
# TARGET
|
|
# VAR_PRESEED
|
|
# VAR_SAFE_MNT_BASE
|
|
# Arguments:
|
|
# None
|
|
# Returns:
|
|
# 0: on success
|
|
#######################################
|
|
gen_dir_files() {
|
|
[[ -d /tmp/.ciss/log ]] && rm -rf /tmp/.ciss
|
|
[[ -d "${TARGET}" ]] && rm -rf "${TARGET}"
|
|
[[ -d "${RECOVERY}" ]] && rm -rf "${RECOVERY}"
|
|
[[ -d "${VAR_SAFE_MNT_BASE}" ]] && rm -rf "${VAR_SAFE_MNT_BASE}"
|
|
|
|
### MAKE DIRS
|
|
mkdir -p /tmp/.ciss/{backup,log,tmp} && chmod -R 0700 /tmp/.ciss
|
|
mkdir -p "${TARGET}"
|
|
mkdir -p "${RECOVERY}"
|
|
mkdir -p "${VAR_SAFE_MNT_BASE}"
|
|
|
|
### TOUCH FILES
|
|
touch "${LOG_ERR}" && chmod 0600 "${LOG_ERR}"
|
|
touch "${LOG_EXT}" && chmod 0600 "${LOG_EXT}"
|
|
touch "${LOG_INS}" && chmod 0600 "${LOG_INS}"
|
|
touch "${LOG_NIC}" && chmod 0600 "${LOG_NIC}"
|
|
touch "${LOG_UID}" && chmod 0600 "${LOG_UID}"
|
|
touch "${LOG_DBS}" && chmod 0600 "${LOG_DBS}"
|
|
touch "${LOG_REC}" && chmod 0600 "${LOG_REC}"
|
|
touch "${VAR_PRESEED}" && chmod 0600 "${VAR_PRESEED}"
|
|
|
|
return 0
|
|
}
|
|
### Prevents accidental 'unset -f'.
|
|
# shellcheck disable=SC2034
|
|
readonly -f gen_dir_files
|
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|