V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
81
lib/cdi_0030_checks/0030_check_pkgs.sh
Normal file
81
lib/cdi_0030_checks/0030_check_pkgs.sh
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/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
|
||||
|
||||
#######################################
|
||||
# Check for required Deb Packages to run the script.
|
||||
# Globals:
|
||||
# VAR_AUTO_INSTALL
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
check_pkgs() {
|
||||
apt-get update -y #> /dev/null 2>&1
|
||||
|
||||
# TODO: Only activate in case CISS.debian.live.builder does not include the following packages as per default.
|
||||
### Define HashMap: command -> package
|
||||
# shellcheck disable=SC2154
|
||||
#declare -A hmp_command_packages=(
|
||||
# [apt-transport-https]=apt-transport-https
|
||||
# [bzip2]=bzip2
|
||||
# [ca-certificates]=ca-certificates
|
||||
# [curl]=curl
|
||||
# [expect]=expect
|
||||
# [fdisk]=fdisk
|
||||
# [gdisk]=gdisk
|
||||
# [git]=git
|
||||
# [gpg]=gnupg
|
||||
# [lsb_release]=lsb-release
|
||||
# [mkfs.btrfs]=btrfs-progs
|
||||
# [mkfs.ext4]=e2fsprogs
|
||||
# [mkfs.fat]=dosfstools
|
||||
# [mkswap]=util-linux
|
||||
# [mkfs.xfs]=xfsprogs
|
||||
# [parted]=parted
|
||||
# [pwgen]=pwgen
|
||||
# [tar]=tar
|
||||
# [wget]=wget
|
||||
# [whois]=whois
|
||||
# [xz]=xz-utils
|
||||
# [yq]=yq
|
||||
#)
|
||||
|
||||
### Iterate over HashMap
|
||||
#declare var_cmd var_pkg
|
||||
#for var_cmd in "${!hmp_command_packages[@]}"; do
|
||||
# var_pkg="${hmp_command_packages[${var_cmd}]}"
|
||||
# if ! command -v "${var_cmd}" &>/dev/null; then
|
||||
# apt-get install -y --no-install-recommends "${var_pkg}"
|
||||
# do_log "info" "file_only" "Installing ${var_pkg} done."
|
||||
# else
|
||||
# do_log "info" "file_only" "${var_cmd} already installed."
|
||||
# fi
|
||||
#done
|
||||
|
||||
#if [[ -z "$(command -v debootstrap || true)" ]]; then
|
||||
# if grep -RqsE '^[[:space:]]*deb .*backports' /etc/apt/sources.list /etc/apt/sources.list.d; then
|
||||
# # shellcheck disable=SC2155
|
||||
# declare codename=$(lsb_release -sc)
|
||||
# apt-get install -y -t "${codename}-backports" debootstrap
|
||||
# else
|
||||
# apt-get install -y debootstrap
|
||||
# fi
|
||||
#fi
|
||||
|
||||
#if [[ -z "$(command -v dialog || true)" ]]; then
|
||||
# if ! "${VAR_AUTO_INSTALL}"; then apt-get install -y --no-install-recommends dialog; fi
|
||||
#fi
|
||||
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
36
lib/cdi_0030_checks/0031_check_git.sh
Normal file
36
lib/cdi_0030_checks/0031_check_git.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
#######################################
|
||||
# Define Git Repo related Variables.
|
||||
# Globals:
|
||||
# VAR_GIT_HEAD
|
||||
# VAR_GIT_REL
|
||||
# VAR_GIT_REL_DATE
|
||||
# VAR_GIT_REL_DATE_TIME
|
||||
# VAR_GIT_REL_SHORT
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
check_git() {
|
||||
# shellcheck disable=SC2155
|
||||
if git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||
declare -grx VAR_GIT_REL="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $1" "$2" "$3 }')"
|
||||
declare -grx VAR_GIT_REL_SHORT="${VAR_GIT_REL%% *}"
|
||||
declare -grx VAR_GIT_REL_DATE_TIME="${VAR_GIT_REL#* }"
|
||||
declare -grx VAR_GIT_REL_DATE="${VAR_GIT_REL_DATE_TIME% *}"
|
||||
declare -grx VAR_GIT_HEAD="$(git rev-parse HEAD)"
|
||||
fi
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
49
lib/cdi_0030_checks/0040_check_var.sh
Normal file
49
lib/cdi_0030_checks/0040_check_var.sh
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/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
|
||||
|
||||
#######################################
|
||||
# Unbound Variable Check.
|
||||
# Globals:
|
||||
# ERR_UNBOUND_VARIABLE
|
||||
# GRE
|
||||
# NL
|
||||
# RED
|
||||
# RES
|
||||
# Arguments:
|
||||
# 1: VAR_NAME to check NOT the variable itself.
|
||||
# Returns:
|
||||
# ERR_UNBOUND_VARIABLE
|
||||
#######################################
|
||||
check_var() {
|
||||
declare var_name_to_check="$1"
|
||||
|
||||
### First check: Is the passed-in variable name itself set?
|
||||
if ! [[ -v var_name_to_check ]]; then
|
||||
printf "%b❌ Error: Variable NOT set: '%s'. Exiting Script. %b%b" "${RED}" "${var_name_to_check}" "${RES}" "${NL}" >&2
|
||||
return "${ERR_UNBOUND_VARIABLE}"
|
||||
fi
|
||||
|
||||
### Second check: Is the variable referenced by var_name_to_check declared?
|
||||
if [[ -v "${var_name_to_check}" ]]; then
|
||||
if [[ -n "${!var_name_to_check}" ]]; then
|
||||
printf "%b✅ Variable: '%s' exists and is NOT empty: '%s'. %b%b" "${GRE}" "${var_name_to_check}" "${!var_name_to_check}" "${RES}" "${NL}"
|
||||
else
|
||||
printf "%b✅ Variable: '%s' exists but is empty. %b%b" "${GRE}" "${var_name_to_check}" "${RES}" "${NL}"
|
||||
fi
|
||||
else
|
||||
printf "%b❌ Error: Variable NOT declared: '%s'. Exiting Script. %b%b" "${RED}" "${var_name_to_check}" "${RES}" "${NL}" >&2
|
||||
return "${ERR_UNBOUND_VARIABLE}"
|
||||
fi
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user