V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 2m6s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 2m6s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -49,77 +49,84 @@ readonly -f final_commands
|
||||
|
||||
#######################################
|
||||
# description
|
||||
# Globals:
|
||||
# RECOVERY
|
||||
# TARGET
|
||||
# VAR_RUN_RECOVERY
|
||||
# Arguments:
|
||||
# None
|
||||
# None
|
||||
# Returns:
|
||||
# 0 ...
|
||||
# 0: on success
|
||||
#######################################
|
||||
ciss_enforce_multi_user_target() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare -a ary_dm_units=()
|
||||
declare var_target="${TARGET}"
|
||||
|
||||
### Check for TARGET / RECOVERY.
|
||||
[[ "${VAR_RUN_RECOVERY}" == "true" ]] && var_target="${RECOVERY}"
|
||||
|
||||
declare var_dm="" var_unit_dir="" var_link="${var_target}/etc/systemd/system/default.target"
|
||||
# shellcheck disable=SC2016
|
||||
chroot_script "${var_target}" '
|
||||
declare var_dm="" var_unit_dir="" var_link="/etc/systemd/system/default.target"
|
||||
|
||||
### Determine the canonical systemd unit dir inside TARGET.
|
||||
if [[ -d "${TARGET}/lib/systemd/system" ]]; then
|
||||
### Determine the canonical systemd unit dir inside TARGET.
|
||||
if [[ -d /lib/systemd/system ]]; then
|
||||
|
||||
var_unit_dir="${TARGET}/lib/systemd/system"
|
||||
var_unit_dir=/lib/systemd/system
|
||||
|
||||
elif [[ -d "${TARGET}/usr/lib/systemd/system" ]]; then
|
||||
elif [[ -d /usr/lib/systemd/system ]]; then
|
||||
|
||||
var_unit_dir="${TARGET}/usr/lib/systemd/system"
|
||||
var_unit_dir=/usr/lib/systemd/system
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
### Enforce 'default.target' -> 'multi-user.target' as a symlink.
|
||||
if [[ -e "${var_link}" ]] && [[ ! -L "${var_link}" ]]; then
|
||||
|
||||
### A regular file here is wrong; we remove it to avoid vendor fallback to graphical.
|
||||
rm -f -- "${var_link}"
|
||||
|
||||
fi
|
||||
|
||||
if [[ ! -L "${var_link}" ]]; then
|
||||
|
||||
ln -s "${var_unit_dir}/multi-user.target" "${var_link}"
|
||||
|
||||
else
|
||||
|
||||
### Ensure it points to multi-user.
|
||||
# shellcheck disable=SC2312
|
||||
if [[ "$(readlink -f "${var_link}")" != "${var_unit_dir}/multi-user.target" ]]; then
|
||||
### Enforce default.target -> multi-user.target as a symlink.
|
||||
if [[ -e "${var_link}" ]] && [[ ! -L "${var_link}" ]]; then
|
||||
|
||||
### A regular file here is wrong; we remove it to avoid vendor fallback to graphical.
|
||||
rm -f -- "${var_link}"
|
||||
|
||||
fi
|
||||
|
||||
if [[ ! -L "${var_link}" ]]; then
|
||||
|
||||
ln -s "${var_unit_dir}/multi-user.target" "${var_link}"
|
||||
|
||||
fi
|
||||
else
|
||||
|
||||
fi
|
||||
### Ensure it points to multi-user.
|
||||
|
||||
### Hard-block any display manager (mask via /dev/null symlink). Include common DMs, and the generic alias:
|
||||
ary_dm_units=(
|
||||
"display-manager.service"
|
||||
"gdm.service" "gdm3.service"
|
||||
"sddm.service"
|
||||
"lightdm.service"
|
||||
"xdm.service"
|
||||
"lxdm.service"
|
||||
"slim.service"
|
||||
)
|
||||
if [[ "$(readlink -f "${var_link}")" != "${var_unit_dir}/multi-user.target" ]]; then
|
||||
|
||||
for var_dm in "${ary_dm_units[@]}"; do
|
||||
rm -f -- "${var_link}"
|
||||
ln -s "${var_unit_dir}/multi-user.target" "${var_link}"
|
||||
|
||||
if [[ ! -L "${TARGET}/etc/systemd/system/${var_dm}" ]]; then
|
||||
|
||||
ln -s /dev/null "${TARGET}/etc/systemd/system/${var_dm}"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
### Hard-block any display manager (mask via /dev/null symlink). Include common DMs, and the generic alias:
|
||||
ary_dm_units=(
|
||||
"display-manager.service"
|
||||
"gdm.service"
|
||||
"gdm3.service"
|
||||
"sddm.service"
|
||||
"lightdm.service"
|
||||
"xdm.service"
|
||||
"lxdm.service"
|
||||
"slim.service"
|
||||
)
|
||||
|
||||
for var_dm in "${ary_dm_units[@]}"; do
|
||||
|
||||
if [[ ! -L "/etc/systemd/system/${var_dm}" ]]; then
|
||||
|
||||
ln -s /dev/null "/etc/systemd/system/${var_dm}"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
'
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -21,11 +21,7 @@ version() {
|
||||
# shellcheck disable=SC2155
|
||||
declare -r var_repo_ver="$(git log --format='%h %ci' -1 2>/dev/null | awk '{ print $1" "$2" "$3 }')"
|
||||
# shellcheck disable=SC2155
|
||||
declare -r var_ds_ver="$(debootstrap --version)"
|
||||
# shellcheck disable=SC2155
|
||||
declare -r var_host="$(uname -n)"
|
||||
# shellcheck disable=SC2155
|
||||
declare -r var_bash_ver="$(bash --version | head -n1 | awk '{print $4" "$5" "$6}')"
|
||||
|
||||
clear
|
||||
cat << EOF
|
||||
@@ -43,9 +39,9 @@ $(echo -e "\e[97m EUPL-1.2 permitted. USAGE w/o ANY WARRANTY. USE IT AT YOUR OW
|
||||
$(echo -e "\e[95m https://git.coresecret.dev/msw/CISS.debian.live.builder/issues \e[0m")
|
||||
$(echo -e "\e[97m################################################################################\e[0m")
|
||||
|
||||
Using : debootstrap (${var_ds_ver})
|
||||
Using : debootstrap (${VAR_DS_VER})
|
||||
on : ${var_host}
|
||||
Bash : ${var_bash_ver}
|
||||
Bash : ${VAR_BASH_VER}
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -77,6 +77,11 @@ trap_exit_zero() {
|
||||
if [[ "${VAR_SCRIPT_SUCCESS}" == "true" ]]; then
|
||||
printf "%b" "${NL}"
|
||||
printf "%b✅ CISS.debian.installer Script successful. %b%b" "${GRE}" "${RES}" "${NL}"
|
||||
printf "%b✅ Git Commit : [%s] %b%b" "${GRE}" "${VAR_GIT_REL}" "${RES}" "${NL}"
|
||||
printf "%b✅ Version : [%s] %b%b" "${GRE}" "${VAR_VERSION}" "${RES}" "${NL}"
|
||||
printf "%b✅ Hostsystem : [%s] %b%b" "${GRE}" "${VAR_SYSTEM}" "${RES}" "${NL}"
|
||||
printf "%b✅ Bash : [%s] %b%b" "${GRE}" "${VAR_BASH_VER}" "${RES}" "${NL}"
|
||||
printf "%b✅ Debootstrap : [%s] %b%b" "${GRE}" "${VAR_DS_VER}" "${RES}" "${NL}"
|
||||
printf "%b✅ Exited with Status : [%s] %b%b" "${GRE}" "${var_trap_exit_zero_code}" "${RES}" "${NL}"
|
||||
printf "%b✅ Script Runtime : [%s] %b%b" "${GRE}" "${VAR_SCRIPT_RUNTIME}" "${RES}" "${NL}"
|
||||
printf "%b" "${NL}"
|
||||
@@ -151,6 +156,7 @@ trap_exit_non_zero() {
|
||||
|
||||
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then dump_vars_exiting; fi
|
||||
|
||||
# shellcheck disable=SC2249
|
||||
case "${VAR_IN_DIALOG_WR}" in
|
||||
box ) dialog_box_cleaner ;;
|
||||
gauge ) dialog_gauge_cleaner ;;
|
||||
|
||||
@@ -13,10 +13,14 @@
|
||||
guard_sourcing
|
||||
|
||||
### Definition of MUST set early variables.
|
||||
# shellcheck disable=SC2155
|
||||
declare -grx VAR_BASH_VER="$(bash --version | head -n1 | awk '{print $4" "$5" "$6}')"
|
||||
declare -grx VAR_CONTACT="security@coresecret.eu"
|
||||
# shellcheck disable=SC2155
|
||||
declare -grx VAR_DS_VER="$(debootstrap --version)"
|
||||
declare -grx VAR_VERSION="Master V8.00.000.2025.06.17"
|
||||
# shellcheck disable=SC2155
|
||||
declare -grx VAR_SYSTEM="$(uname -a)"
|
||||
declare -grx VAR_SYSTEM="$(uname -mnosv)"
|
||||
declare -gx VAR_ARG_SANITIZED=""
|
||||
declare -gx VAR_AUTO_INSTALL="false"
|
||||
declare -gx VAR_DEBUG_TRACE="false"
|
||||
|
||||
Reference in New Issue
Block a user