Address the FIXME..
This commit is contained in:
parent
104735f1b9
commit
79a99d1bc8
74
020_slim.sh
74
020_slim.sh
|
|
@ -1,43 +1,51 @@
|
||||||
#!/usr/bin/env bash
|
#!/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
|
# --- Create the .xinitrc ---
|
||||||
DEST=${1:-/etc/skel}
|
conf_print_xinitrc() {
|
||||||
USER_NAME=${2:-default}
|
cat <<'EOF'
|
||||||
|
# 1. Define variables
|
||||||
cat > ${DEST}/.xinitrc <<'EOF'
|
|
||||||
DEFAULT_SESSION=enlightenment_start
|
DEFAULT_SESSION=enlightenment_start
|
||||||
|
session=${1:-$DEFAULT_SESSION}
|
||||||
|
|
||||||
session=$1
|
# 2. Run helper scripts
|
||||||
|
if [ -d "${HOME}/.xinitrc.d" ]; then
|
||||||
case $session in
|
for f in "${HOME}/.xinitrc.d/"*; do
|
||||||
enlightenment ) exec enlightenment_start ;;
|
[ -x "$f" ] && . "$f"
|
||||||
xfce|xfce4 ) exec startxfce4 ;;
|
done
|
||||||
* ) exec $DEFAULT_SESSION ;;
|
unset f
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -d ${HOME}/.xinitrc.d ]; then
|
|
||||||
for f in ${HOME}/.xinitrc.d/*; do
|
|
||||||
[ -x "$f" ] && . "$f"
|
|
||||||
done
|
|
||||||
unset f
|
|
||||||
fi
|
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
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
# Set enlightenment as the default session.
|
# Ensure the destination exists and write the file
|
||||||
apt install -y slim
|
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
|
# Comment out sessiondir to force SLiM to use your .xinitrc logic instead of /usr/share/xsessions
|
||||||
# login_cmd exec /bin/bash -login /etc/X11/Xsession %session
|
sed -i "s|^sessiondir|# sessiondir|" "${SLIM_CONFIG}"
|
||||||
# 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}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue