V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 50s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-24 20:43:32 +02:00
parent 65c13547c3
commit b9d4c2019c
11 changed files with 64 additions and 75 deletions

View File

@@ -60,23 +60,43 @@
. ./var/early.var.sh
. ./lib/0010_guard_sourcing.sh
### CHECK FOR CONTACT, HELP, AND VERSION STRING
### CHECK FOR CONTACT, HELP, AND VERSION STRING.
for arg in "$@"; do case "${arg,,}" in -c|--contact) . ./lib/0001_contact.sh; contact; exit 0;; esac; done
for arg in "$@"; do case "${arg,,}" in -h|--help) . ./lib/0000_usage.sh; usage; exit 0;; esac; done
for arg in "$@"; do case "${arg,,}" in -v|--version) . ./lib/0002_version.sh; version; exit 0;; esac; done
# TODO: Check ok.
### PRE SCAN FOR DEBUG MODE
. ./meta_loader_debug.sh
pre_scan_debug "$@"
### SOURCING BASH OPTIONS
. ./var/bash.var.sh
umask 0022
# TODO: Check till line #68 ok.
### ALL CHECKS DONE. READY TO START THE SCRIPT.
declare -grx VAR_SETUP="true"
umask 0022
### SOURCING FUNCTIONS, LIBRARIES, VARIABLES.
if [[ "${VAR_SETUP}" == "true" ]]; then
### SOURCING VARIABLES
. ./meta_loader_var.sh
### SOURCING FUNCTIONS
. ./meta_loader_func.sh
### SOURCING LIBRARIES
. ./meta_loader_lib.sh
fi
### PREPARING DIRECTORIES AND FILES
gen_dir_files
### ADVISORY LOCK
exec 127>/var/lock/ciss_debian_installer.lock || {
printf "%s❌ Cannot open lockfile for writing! Bye... %s%s" "${RED}" "${RES}" "${NL}" >&2
exit "${ERR_FLOCK_PROTECTED}"
}
if ! flock -x -n 127; then
printf "%s❌ Another instance is running! Bye...%s%s" "${RED}" "${RES}" "${NL}" >&2
exit "${ERR_FLOCK_COLLISION}"
fi
### PRE SCAN FOR DEBUG MODE
pre_scan_debug "$@"
### CHECK FOR AUTO INSTALL MODE
for arg in "$@"; do case "${arg,,}" in -a|--autoinstall) declare -gx VAR_AUTO_INSTALL="true";; esac; done; unset arg
@@ -87,37 +107,11 @@ for arg in "$@"; do case "${arg,,}" in -a|--autoinstall) declare -gx VAR_AUTO_IN
check_pkgs
check_git
### ADVISORY LOCK
exec 127>/var/lock/ciss_debian_installer.lock || {
. ./meta_loader_early.sh
printf "%s❌ Cannot open lockfile for writing! Bye... %s%s" "${RED}" "${RES}" "${NL}" >&2
exit "${ERR_FLOCK_PROTECTED}"
}
if ! flock -x -n 127; then
. ./meta_loader_early.sh
printf "%s❌ Another instance is running! Bye...%s%s" "${RED}" "${RES}" "${NL}" >&2
exit "${ERR_FLOCK_COLLISION}"
fi
### SOURCING FUNCTIONS, LIBRARIES, VARIABLES
if [[ "${VAR_SETUP}" == "true" ]]; then
### SOURCING FUNCTIONS
. ./meta_loader_func.sh
### SOURCING LIBRARIES
. ./meta_loader_lib.sh
### SOURCING VARIABLES
. ./meta_loader_var.sh
fi
### ACTIVATING TRAPS
trap 'trap_exit "$?"' EXIT
trap 'trap_int' INT
trap 'trap_err "$?" "${BASH_SOURCE[0]}" "${LINENO}" "${FUNCNAME[0]:-main}" "${BASH_COMMAND}"' ERR
### PREPARING DIRECTORIES AND FILES
gen_dir_files
### INTERACTIVE MODE NOTES AND KERNEL SELECTION
# TODO: Update 0110_check_kernel.sh & sourcing
# TODO: Update 0120_check_provider.sh & sourcing

View File

@@ -15,8 +15,8 @@ guard_sourcing
#######################################
# Generic safe wrapper for external commands.
# Arguments:
# $*: full command (array, quoted!)
# $2: ERR_CONST on failure
# *: full command (array, quoted!)
# 2: ERR_CONST on failure
#######################################
safe_exec() {
declare -a ary_cmd=("${@:1:$#-1}") # All but last arg.

View File

@@ -16,12 +16,19 @@ 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() {
### MAKE DIRS
@@ -41,5 +48,7 @@ gen_dir_files() {
touch "${DIR_LOG}/cpu.log" && chmod 0600 "${DIR_LOG}/cpu.log"
touch "${DIR_LOG}/ext4.log" && chmod 0600 "${DIR_LOG}/ext4.log"
touch "${DIR_LOG}/sshd_config.log" && chmod 0600 "${DIR_LOG}/sshd_config.log"
return 0
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -18,9 +18,6 @@ guard_sourcing
# None
#######################################
pre_scan_debug() {
# shellcheck disable=SC2155
declare script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "${script_dir}/0100_arg_mismatch.sh"
declare args=("$@")
declare dbg_index=-1
declare dbg_count=0
@@ -29,8 +26,7 @@ pre_scan_debug() {
for i in "${!args[@]}"; do
if [[ "${args[i]}" == "-d" || "${args[i]}" == "--debug" ]]; then
dbg_index=${i}
. "${script_dir}/0051_debug_var_dump.sh"
declare -grx LOG_VAR="/tmp/ciss_debian_installer_$$_var.log"
declare -grx LOG_VAR="{DIR_LOG}/ciss_debian_installer_$$_var.log"
touch "${LOG_VAR}" && chmod 0600 "${LOG_VAR}"
dump_vars_initial
break
@@ -43,14 +39,10 @@ pre_scan_debug() {
case "${args[j],,}" in
xtrace)
declare -gx VAR_DEBUG_TRACE="true"
. "${script_dir}/0052_debug_trace.sh"
. "${script_dir}/0053_debug_trace_header.sh"
debug_trace "$@"
;;
trap)
declare -gx VAR_DEBUG_TRAP="true"
. "${script_dir}/0054_debug_trap.sh"
. "${script_dir}/0055_debug_trap_header.sh"
trap 'debug_trap' DEBUG
;;
*)

View File

@@ -21,7 +21,7 @@ guard_sourcing
#######################################
dump_vars_initial() {
# shellcheck disable=SC2155
declare -grx VAR_DUMP_VARS_INITIAL=$(mktemp)
declare -grx VAR_DUMP_VARS_INITIAL="$(mktemp --tmpdir --mode=0600 /tmp/var_dump_vars_initial.XXXXXXXX)"
# shellcheck disable=SC2312
{
declare var
@@ -43,7 +43,7 @@ dump_vars_initial() {
dump_vars_exiting() {
### Capture the final snapshot of all variables (excluding '^(BASH|_).*')
# shellcheck disable=SC2155
declare var_dump_vars_final=$(mktemp)
declare var_dump_vars_final="$(mktemp --tmpdir --mode=0600 /tmp/var_dump_vars_final.XXXXXXXX)"
set +x
# shellcheck disable=SC2312
{

View File

@@ -10,6 +10,8 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
# TODO: Update this module
guard_sourcing
#######################################

View File

@@ -10,6 +10,8 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
# TODO: Update this module
guard_sourcing
#######################################
@@ -20,9 +22,9 @@ guard_sourcing
check_provider() {
clear
cat << 'EOF' >| "${VAR_NOTES}"
Build: Master V8.03.768.2025.06.17
Build: Master V8.00.000.2025.06.17
Press 'EXIT' to continue with CISS.debian.live.builder.
Press 'EXIT' to continue with CISS.debian.installer.
When you provision ISO images using the Netcup provider, you MUST always supply a globally unique identifier
for each image via the --control argument. If you omit this flag or reuse an existing identifier, Netcup's
@@ -58,7 +60,7 @@ EOF
dialog --no-collapse \
--ascii-lines \
--clear \
--backtitle "CISS.debian.live.builder" \
--backtitle "CISS.debian.installer" \
--title "Important Notes" \
--scrollbar \
--textbox "${VAR_NOTES}" 32 128

View File

@@ -1,20 +0,0 @@
#!/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
. ./lib/0050_debug_pre_scan.sh
. ./lib/0051_debug_var_dump.sh
. ./lib/0052_debug_trace.sh
. ./lib/0053_debug_trace_header.sh
. ./lib/0054_debug_trap.sh
. ./lib/0055_debug_trap_header.sh
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -14,6 +14,13 @@
. ./lib/0020_gen_dir_files.sh
. ./lib/0030_check_pkgs.sh
. ./lib/0031_check_git.sh
. ./lib/0040_check_var.sh
. ./lib/0050_debug_pre_scan.sh
. ./lib/0051_debug_var_dump.sh
. ./lib/0052_debug_trace.sh
. ./lib/0053_debug_trace_header.sh
. ./lib/0054_debug_trap.sh
. ./lib/0055_debug_trap_header.sh
. ./lib/0060_trap_err.sh
. ./lib/0070_trap_exit.sh
. ./lib/0080_trap_int.sh
@@ -23,6 +30,8 @@
. ./lib/0102_arg_parser.sh
. ./lib/0103_arg_priority_check.sh
. ./lib/0104_arg_nuke_converter.sh
#. ./lib/0110_check_kernel.sh
#. ./lib/0120_check_provider.sh
. ./lib/0200_dialog_helper.sh
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -10,6 +10,7 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
. ./var/bash.var.sh
. ./var/colors.var.sh
. ./var/errors.var.sh
. ./var/global.var.sh

View File

@@ -25,10 +25,10 @@ declare -grx VAR_SETUP_FULL="$(cd "$(dirname "${0}")" && pwd)/${0##*/}" # '/opt/
### Initialize variables of different directories
declare -grx DIR_BAK="/tmp/.ciss/backup"
declare -grx DIR_CNF="${VAR_SETUP_PATH}/.preseed"
declare -grx DIR_INS="${VAR_SETUP_PATH}"
declare -grx DIR_LOG="/tmp/.ciss/log"
declare -grx DIR_TMP="/tmp/.ciss/tmp"
declare -grx DIR_CNF="${VAR_SETUP_PATH}/.preseed"
declare -grx DIR_INS="${VAR_SETUP_PATH}"
### Initialize variables for logging
declare -grx LOG_ERR="${DIR_LOG}/ciss_debian_installer_$$_error.log"