From 79a99d1bc832ab812dc82492912da0a093865fd7 Mon Sep 17 00:00:00 2001 From: cyteen Date: Wed, 11 Mar 2026 01:43:33 +0000 Subject: [PATCH] Address the FIXME.. --- 020_slim.sh | 74 +++++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/020_slim.sh b/020_slim.sh index 0507a2e..870f129 100755 --- a/020_slim.sh +++ b/020_slim.sh @@ -1,43 +1,51 @@ #!/usr/bin/env bash -echo "FIXME: does not start session on clean install, use lightdm until you fix this." -exit 0 +# Define variables for the script +USER_NAME="devuan" +auto_login="no" +SLIM_CONFIG="/etc/slim.conf" +DEST="/home/${USER_NAME}" -set -x -DEST=${1:-/etc/skel} -USER_NAME=${2:-default} - -cat > ${DEST}/.xinitrc <<'EOF' +# --- Create the .xinitrc --- +conf_print_xinitrc() { + cat <<'EOF' +# 1. Define variables DEFAULT_SESSION=enlightenment_start +session=${1:-$DEFAULT_SESSION} -session=$1 - -case $session in - enlightenment ) exec enlightenment_start ;; - xfce|xfce4 ) exec startxfce4 ;; - * ) exec $DEFAULT_SESSION ;; -esac - -if [ -d ${HOME}/.xinitrc.d ]; then - for f in ${HOME}/.xinitrc.d/*; do - [ -x "$f" ] && . "$f" - done - unset f +# 2. Run helper scripts +if [ -d "${HOME}/.xinitrc.d" ]; then + for f in "${HOME}/.xinitrc.d/"*; do + [ -x "$f" ] && . "$f" + done + unset f fi + +# 3. Export to DBus +if command -v dbus-update-activation-environment >/dev/null; then + dbus-update-activation-environment --systemd --all +fi + +# 4. EXECUTE the session +case $session in + enlightenment) exec enlightenment_start ;; + xfce|xfce4) exec startxfce4 ;; + *) exec $session ;; +esac EOF +} -# Set enlightenment as the default session. -apt install -y slim +# Ensure the destination exists and write the file +mkdir -p "${DEST}" +conf_print_xinitrc >"${DEST}/.xinitrc" +chown "${USER_NAME}:${USER_NAME}" "${DEST}/.xinitrc" +chmod +x "${DEST}/.xinitrc" +# --- Configure SLiM --- +# Note: Using '|' as a sed delimiter to avoid conflicts with path slashes +sed -i "s|^.*auto_login.*|auto_login ${auto_login}|" "${SLIM_CONFIG}" +sed -i "s|^.*login_cmd.*|login_cmd exec /bin/bash -login ~/.xinitrc %session|" "${SLIM_CONFIG}" +sed -i "s|^.*default_user.*|default_user ${USER_NAME}|" "${SLIM_CONFIG}" -## /etc/slim.conf -# login_cmd exec /bin/bash -login /etc/X11/Xsession %session -# sessiondir /usr/share/xsessions/ # contains enlightenment.desktop:Exec=/usr/bin/enlightenment and xfce.desktop:Exec=startxfce4 -# default_user devuan -auto_login=no -SLIM_CONFIG=/etc/slim.conf -#sed -i "s/^.*auto_login.*/auto_login\ no/" ${SLIM_CONFIG} && \ -sed -i "s/^.*auto_login.*/auto_login\ ${auto_login}/" ${SLIM_CONFIG} && \ -sed -i "s|^.*login_cmd.*|login_cmd exec /bin/sh - ~/.xinitrc \%session|" ${SLIM_CONFIG} && \ -sed -i "s/^.*default_user.*/default_user\ ${USER_NAME}/" ${SLIM_CONFIG} && \ -sed -i "/${sessiondir}/s/^/# /g" ${SLIM_CONFIG} +# Comment out sessiondir to force SLiM to use your .xinitrc logic instead of /usr/share/xsessions +sed -i "s|^sessiondir|# sessiondir|" "${SLIM_CONFIG}"