Address the FIXME..

This commit is contained in:
cyteen 2026-03-11 01:43:33 +00:00
parent 104735f1b9
commit 79a99d1bc8
1 changed files with 41 additions and 33 deletions

View File

@ -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}"