mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-10-31 13:08:06 +00:00
LXDE: add Custom packages option and respect existing display manager
- New 'LXDE Custom (Choose packages)' menu entry: fixed base (lxde-core + xserver-xorg, lightdm only when no display manager is configured) plus a data-driven checklist of 16 extras. - lxterminal, polkitd, notification-daemon and light-locker stay out of the checklist: they arrive via lxde-core Recommends (verified against packages.debian.org/trixie, 2026-10-16). - Full/Core/Custom now honor an already-configured display manager via _existing_display_manager (GNOME/KDE pattern): no debconf preseed, no lightdm install, no enable over an existing DM. - Extract _select_packages_checklist helper to utils.sh; XFCE Custom consumes it with no functional change. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,8 @@ lxde_menu() {
|
|||||||
local -a lx_items=()
|
local -a lx_items=()
|
||||||
lx_items+=("1" "LXDE (Full Desktop)")
|
lx_items+=("1" "LXDE (Full Desktop)")
|
||||||
lx_items+=("2" "LXDE Core (Minimal Install)")
|
lx_items+=("2" "LXDE Core (Minimal Install)")
|
||||||
lx_items+=("3" "Back")
|
lx_items+=("3" "LXDE Custom (Choose packages)")
|
||||||
|
lx_items+=("4" "Back")
|
||||||
local choice
|
local choice
|
||||||
choice=$(_menu "LXDE" \
|
choice=$(_menu "LXDE" \
|
||||||
"Select an option:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
"Select an option:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
||||||
@@ -19,27 +20,140 @@ lxde_menu() {
|
|||||||
case "$choice" in
|
case "$choice" in
|
||||||
1) _install_lxde_full ;;
|
1) _install_lxde_full ;;
|
||||||
2) _install_lxde_core ;;
|
2) _install_lxde_core ;;
|
||||||
3) break ;;
|
3) _install_lxde_custom ;;
|
||||||
|
4) break ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
_install_lxde_full() {
|
_install_lxde_full() {
|
||||||
echo -e "${GREEN}Installing LXDE (Full) + LightDM...${NC}"
|
# Pre-apply summary: confirm the selection before any
|
||||||
echo "lightdm shared/default-x-display-manager select lightdm" | sudo debconf-set-selections
|
# debconf or apt transaction starts.
|
||||||
|
_confirm_install_list "LXDE Full Desktop" lxde lightdm || return
|
||||||
|
|
||||||
|
echo -e "${GREEN}Installing LXDE (Full Desktop)...${NC}"
|
||||||
|
|
||||||
|
# Keep an already-configured display manager intact.
|
||||||
|
local target_dm="lightdm"
|
||||||
|
local keep_dm
|
||||||
|
keep_dm=$(_existing_display_manager)
|
||||||
|
if [ -n "$keep_dm" ] && [ "$keep_dm" != "lightdm" ]; then
|
||||||
|
echo -e "${YELLOW}Display manager '${keep_dm}' is already configured — keeping it as default.${NC}"
|
||||||
|
target_dm="$keep_dm"
|
||||||
|
fi
|
||||||
|
echo "${target_dm} shared/default-x-display-manager select ${target_dm}" | sudo debconf-set-selections
|
||||||
|
_ensure_apt_updated
|
||||||
|
if [ "$target_dm" = "lightdm" ]; then
|
||||||
_run_cmd "LXDE Full" "sudo apt install -y lxde lightdm" \
|
_run_cmd "LXDE Full" "sudo apt install -y lxde lightdm" \
|
||||||
"Installing LXDE (Full Meta Package) + LightDM..."
|
"Installing LXDE (Full Meta Package) + LightDM..."
|
||||||
sudo systemctl enable lightdm
|
sudo systemctl enable lightdm
|
||||||
echo -e "${GREEN}LXDE installed. LightDM enabled.${NC}"
|
else
|
||||||
|
_run_cmd "LXDE Full" "sudo apt install -y lxde" \
|
||||||
|
"Installing LXDE (Full Meta Package)..."
|
||||||
|
fi
|
||||||
|
# Selection confirmed once above; release the
|
||||||
|
# per-package prompt suppression.
|
||||||
|
_SELECTION_CONFIRMED=0
|
||||||
|
echo -e "${GREEN}LXDE installed. Default display manager: ${target_dm}.${NC}"
|
||||||
_offer_pipewire_after_desktop
|
_offer_pipewire_after_desktop
|
||||||
}
|
}
|
||||||
|
|
||||||
_install_lxde_core() {
|
_install_lxde_core() {
|
||||||
echo -e "${GREEN}Installing LXDE Core + LightDM...${NC}"
|
# Pre-apply summary: confirm the selection before any
|
||||||
echo "lightdm shared/default-x-display-manager select lightdm" | sudo debconf-set-selections
|
# debconf or apt transaction starts.
|
||||||
|
_confirm_install_list "LXDE Core" lxde-core lightdm || return
|
||||||
|
|
||||||
|
echo -e "${GREEN}Installing LXDE Core (Minimal)...${NC}"
|
||||||
|
|
||||||
|
# Keep an already-configured display manager intact.
|
||||||
|
local target_dm="lightdm"
|
||||||
|
local keep_dm
|
||||||
|
keep_dm=$(_existing_display_manager)
|
||||||
|
if [ -n "$keep_dm" ] && [ "$keep_dm" != "lightdm" ]; then
|
||||||
|
echo -e "${YELLOW}Display manager '${keep_dm}' is already configured — keeping it as default.${NC}"
|
||||||
|
target_dm="$keep_dm"
|
||||||
|
fi
|
||||||
|
echo "${target_dm} shared/default-x-display-manager select ${target_dm}" | sudo debconf-set-selections
|
||||||
|
_ensure_apt_updated
|
||||||
|
if [ "$target_dm" = "lightdm" ]; then
|
||||||
_run_cmd "LXDE Core" "sudo apt install -y lxde-core lightdm" \
|
_run_cmd "LXDE Core" "sudo apt install -y lxde-core lightdm" \
|
||||||
"Installing LXDE Core (Minimal) + LightDM..."
|
"Installing LXDE Core (Minimal) + LightDM..."
|
||||||
sudo systemctl enable lightdm
|
sudo systemctl enable lightdm
|
||||||
echo -e "${GREEN}LXDE Core installed. LightDM enabled.${NC}"
|
else
|
||||||
|
_run_cmd "LXDE Core" "sudo apt install -y lxde-core" \
|
||||||
|
"Installing LXDE Core (Minimal)..."
|
||||||
|
fi
|
||||||
|
# Selection confirmed once above; release the
|
||||||
|
# per-package prompt suppression.
|
||||||
|
_SELECTION_CONFIRMED=0
|
||||||
|
echo -e "${GREEN}LXDE Core installed. Default display manager: ${target_dm}.${NC}"
|
||||||
|
_offer_pipewire_after_desktop
|
||||||
|
}
|
||||||
|
|
||||||
|
_install_lxde_custom() {
|
||||||
|
# Fixed base (not selectable); extras chosen from the checklist.
|
||||||
|
# lxterminal, polkitd, notification-daemon and light-locker are
|
||||||
|
# intentionally absent: they arrive via lxde-core's Recommends
|
||||||
|
# (verified on packages.debian.org/trixie, 2026-10-16).
|
||||||
|
local cleaned
|
||||||
|
cleaned=$(_select_packages_checklist "LXDE Custom" \
|
||||||
|
"Select the extra LXDE packages to install:" \
|
||||||
|
"lxappearance|Theme/appearance config" \
|
||||||
|
"lxappearance-obconf|Openbox theme settings" \
|
||||||
|
"lxrandr|Monitor configuration" \
|
||||||
|
"lxinput|Keyboard/mouse settings" \
|
||||||
|
"lxsession-edit|Session editor" \
|
||||||
|
"lxhotkey-gtk|Keyboard shortcuts config" \
|
||||||
|
"lxde-icon-theme|LXDE icon theme" \
|
||||||
|
"gpicview|Image viewer" \
|
||||||
|
"xarchiver|Archive manager" \
|
||||||
|
"galculator|Calculator" \
|
||||||
|
"mousepad|Text editor" \
|
||||||
|
"lxpolkit|PolicyKit authentication agent" \
|
||||||
|
"lxtask|Task manager" \
|
||||||
|
"numlockx|Enable NumLock on startup" \
|
||||||
|
"network-manager-applet|NetworkManager applet" \
|
||||||
|
"gnome-disk-utility|Disk utility")
|
||||||
|
[ -z "$cleaned" ] && return
|
||||||
|
# BH-004: reparse the space-separated selection into an array.
|
||||||
|
local -a lxde_pkgs=()
|
||||||
|
local _pkg
|
||||||
|
while IFS= read -r _pkg; do
|
||||||
|
[ -n "$_pkg" ] && lxde_pkgs+=("$_pkg")
|
||||||
|
done < <(echo "$cleaned" | tr ' ' '\n')
|
||||||
|
if [ ${#lxde_pkgs[@]} -eq 0 ]; then
|
||||||
|
_msg "LXDE Custom" "No extra packages selected — installing the\nfixed base only (equivalent to LXDE Core)." 10 60
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fixed base: lxde-core + xserver-xorg always; lightdm only
|
||||||
|
# when no display manager is configured yet — never force it
|
||||||
|
# over an existing one.
|
||||||
|
local -a base_pkgs=(lxde-core xserver-xorg)
|
||||||
|
local install_dm=0 keep_dm
|
||||||
|
keep_dm=$(_existing_display_manager)
|
||||||
|
if [ -z "$keep_dm" ]; then
|
||||||
|
base_pkgs+=(lightdm)
|
||||||
|
install_dm=1
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Display manager '${keep_dm}' is already configured — keeping it as default.${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pre-apply summary: confirm base + selection before any
|
||||||
|
# debconf or apt transaction starts.
|
||||||
|
_confirm_install_list "LXDE Custom" "${base_pkgs[@]}" "${lxde_pkgs[@]}" || return
|
||||||
|
|
||||||
|
if [ "$install_dm" -eq 1 ]; then
|
||||||
|
echo "lightdm shared/default-x-display-manager select lightdm" | sudo debconf-set-selections
|
||||||
|
fi
|
||||||
|
_ensure_apt_updated
|
||||||
|
_run_cmd "LXDE Custom" "sudo apt install -y ${base_pkgs[*]} ${lxde_pkgs[*]}" \
|
||||||
|
"Installing LXDE base + selected packages..."
|
||||||
|
if [ "$install_dm" -eq 1 ]; then
|
||||||
|
sudo systemctl enable lightdm
|
||||||
|
fi
|
||||||
|
# Selection confirmed once above; release the
|
||||||
|
# per-package prompt suppression.
|
||||||
|
_SELECTION_CONFIRMED=0
|
||||||
|
echo -e "${GREEN}LXDE installed (base: ${base_pkgs[*]}).${NC}"
|
||||||
_offer_pipewire_after_desktop
|
_offer_pipewire_after_desktop
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,27 +51,28 @@ _install_xfce_wayland() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_install_xfce_custom() {
|
_install_xfce_custom() {
|
||||||
local -a items=()
|
# BH-004: helper returns a space-separated selection;
|
||||||
for pkg in thunar xfdesktop4 xfwm4 xfce4-panel xfce4-terminal \
|
# reparsed into an array to avoid word splitting and injection.
|
||||||
xfce4-screenshooter ristretto mousepad xfce4-session \
|
|
||||||
xfce4-settings xfce4-power-manager; do
|
|
||||||
items+=("$pkg" "$pkg" "$(_state "$pkg")")
|
|
||||||
done
|
|
||||||
local choices
|
|
||||||
choices=$(_checklist "XFCE Custom" \
|
|
||||||
"Select the XFCE packages to install:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
|
||||||
"${items[@]}")
|
|
||||||
[ -z "$choices" ] && return
|
|
||||||
local cleaned
|
local cleaned
|
||||||
cleaned=$(echo "$choices" | tr -d '"')
|
cleaned=$(_select_packages_checklist "XFCE Custom" \
|
||||||
|
"Select the XFCE packages to install:" \
|
||||||
|
"thunar|File manager" \
|
||||||
|
"xfdesktop4|Desktop manager" \
|
||||||
|
"xfwm4|Window manager" \
|
||||||
|
"xfce4-panel|Panel" \
|
||||||
|
"xfce4-terminal|Terminal emulator" \
|
||||||
|
"xfce4-screenshooter|Screenshot tool" \
|
||||||
|
"ristretto|Image viewer" \
|
||||||
|
"mousepad|Text editor" \
|
||||||
|
"xfce4-session|Session manager" \
|
||||||
|
"xfce4-settings|Settings manager" \
|
||||||
|
"xfce4-power-manager|Power manager")
|
||||||
[ -z "$cleaned" ] && return
|
[ -z "$cleaned" ] && return
|
||||||
|
|
||||||
# BH-004: Convert to array to avoid word splitting and injection.
|
|
||||||
local -a xfce_pkgs=()
|
local -a xfce_pkgs=()
|
||||||
|
local _pkg
|
||||||
while IFS= read -r _pkg; do
|
while IFS= read -r _pkg; do
|
||||||
[ -n "$_pkg" ] && xfce_pkgs+=("$_pkg")
|
[ -n "$_pkg" ] && xfce_pkgs+=("$_pkg")
|
||||||
done < <(echo "$cleaned" | tr ' ' '\n')
|
done < <(echo "$cleaned" | tr ' ' '\n')
|
||||||
|
|
||||||
# Pre-apply summary: confirm the selection before
|
# Pre-apply summary: confirm the selection before
|
||||||
# the batch apt transaction starts.
|
# the batch apt transaction starts.
|
||||||
_confirm_install_list "XFCE Custom" "${xfce_pkgs[@]}" || return
|
_confirm_install_list "XFCE Custom" "${xfce_pkgs[@]}" || return
|
||||||
|
|||||||
@@ -805,6 +805,28 @@ _confirm_install_list() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Show a multi-select checklist of packages and return the
|
||||||
|
# selection as a space-separated string ("" on cancel/Esc).
|
||||||
|
# Args: title prompt "pkg|description" [pkg|description ...]
|
||||||
|
# Already-installed packages are pre-checked via _state.
|
||||||
|
_select_packages_checklist() {
|
||||||
|
local title="$1" prompt="$2"
|
||||||
|
shift 2
|
||||||
|
local -a items=() entry
|
||||||
|
for entry in "$@"; do
|
||||||
|
local pkg="${entry%%|*}"
|
||||||
|
items+=("$pkg" "${entry#*|}" "$(_state "$pkg")")
|
||||||
|
done
|
||||||
|
local choices
|
||||||
|
# _checklist swallows whiptail's cancel (Esc) exit code
|
||||||
|
# via `|| true`, so a cancelled dialog looks like an empty
|
||||||
|
# selection here; an empty result means "nothing to install".
|
||||||
|
choices=$(_checklist "$title" "$prompt" \
|
||||||
|
$TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA "${items[@]}")
|
||||||
|
choices=$(echo "$choices" | tr -d '"')
|
||||||
|
echo "$choices"
|
||||||
|
}
|
||||||
|
|
||||||
# Install a package with confirmation prompt.
|
# Install a package with confirmation prompt.
|
||||||
# Handles set -e: failures are caught and reported, not fatal.
|
# Handles set -e: failures are caught and reported, not fatal.
|
||||||
_install_pkg() {
|
_install_pkg() {
|
||||||
|
|||||||
Reference in New Issue
Block a user