fix(autologin): Retrieve user by id

This will always retrieve the first user created on the system and
doesn't rely on there only being one user in the home directory
This commit is contained in:
RJ Trujillo 2023-07-15 09:02:14 -06:00
parent bdfe7ad369
commit fd5f0a3b9c
2 changed files with 4 additions and 10 deletions

View File

@ -1,16 +1,13 @@
#!/usr/bin/env bash
NUM_USERS=$(ls /home | wc -l)
USER=$(ls /home)
USER=$(id -nu 1000)
# SteamOS SDDM config
SDDM_CONF='/etc/sddm.conf.d/steamos.conf'
# Configure autologin
sed -i 's/.*Session=.*/Session=gamescope-session.desktop/g' ${SDDM_CONF}
if [ ${NUM_USERS} -eq 1 ]; then
sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF}
fi
sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF}
# Remove sddm.conf if it exists
if [ -f '/etc/sddm.conf' ]; then

View File

@ -1,16 +1,13 @@
#!/usr/bin/env bash
NUM_USERS=$(ls /home | wc -l)
USER=$(ls /home)
USER=$(id -nu 1000)
# SteamOS SDDM config
SDDM_CONF='/etc/sddm.conf.d/steamos.conf'
# Configure autologin
sed -i 's/.*Session=.*/Session=plasmax11.desktop/g' ${SDDM_CONF}
if [ ${NUM_USERS} -eq 1 ]; then
sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF}
fi
sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF}
# Remove sddm.conf if it exists
if [ -f '/etc/sddm.conf' ]; then