V8.13.272.2025.10.22
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m45s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m45s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -13,6 +13,66 @@ set -Ceuo pipefail
|
||||
|
||||
printf "\e[95m++++ ++++ ++++ ++++ ++++ ++++ ++ 🧪 '%s' starting ... \e[0m\n" "${0}"
|
||||
|
||||
declare var_dm="" var_unit_dir="" var_link="/etc/systemd/system/default.target"
|
||||
|
||||
### Determine the canonical systemd unit dir inside chroot.
|
||||
if [[ -d /lib/systemd/system ]]; then
|
||||
|
||||
var_unit_dir=/lib/systemd/system
|
||||
|
||||
elif [[ -d /usr/lib/systemd/system ]]; then
|
||||
|
||||
var_unit_dir=/usr/lib/systemd/system
|
||||
|
||||
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
|
||||
|
||||
rm -f -- "${var_link}"
|
||||
ln -s "${var_unit_dir}/multi-user.target" "${var_link}"
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
### 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
|
||||
|
||||
rm -f /root/ciss_xdg_tmp.sh
|
||||
|
||||
printf "\e[92m++++ ++++ ++++ ++++ ++++ ++++ ++ ✅ '%s' applied successfully. \e[0m\n" "${0}"
|
||||
|
||||
Reference in New Issue
Block a user