Files
CISS.debian.installer/lib/cdi_0010_basic/0011_gen_dir_files.sh
Marc S. Weidner 775f68d79e
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m42s
V8.00.000.2025.06.17
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
2025-08-29 00:15:16 +02:00

59 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:
# DIR_LOG
# LOG_DBS
# LOG_ERR
# LOG_INS
# LOG_NIC
# 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 "${VAR_PRESEED}" && chmod 0600 "${VAR_PRESEED}"
touch "${DIR_LOG}/btrfs.log" && chmod 0600 "${DIR_LOG}/btrfs.log"
touch "${DIR_LOG}/ext4.log" && chmod 0600 "${DIR_LOG}/ext4.log"
return 0
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh