config() { NEW="$1" OLD="$(dirname $NEW)/$(basename $NEW .new)" # If there's no config file by that name, mv it over: if [ ! -r $OLD ]; then mv $NEW $OLD elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy rm $NEW fi # Otherwise, we leave the .new copy for the admin to consider... } # Create the daemon account and homedirectory otherwise SDDM won't start: sddmuid=64 sddmgid=64 sddmhome=/var/lib/sddm if ! chroot . getent group sddm > /dev/null; then chroot . groupadd -g $sddmgid sddm res=$? if [ $res -ne 0 ]; then cat < /dev/null; then useradd -c "SDDM Daemon Owner" -d $sddmhome -u $sddmuid \ -g sddm -s /bin/false sddm res=$? if [ $res -ne 0 ]; then cat < /dev/null chroot . gpasswd -a sddm video > /dev/null fi fi mkdir -p $sddmhome chown -R sddm:sddm $sddmhome > /dev/null # Generate a new configuration file if it does not exist: chroot . sddm --example-config > /etc/sddm.conf.new if ! grep -q "Current=breeze" etc/sddm.conf.new ; then # Set the KDE5 theme 'breeze' as default, integrates better with Plasma 5: sed -i -e "/\[Theme\]/,/^\[/s/^Current.*/Current=breeze/" etc/sddm.conf.new fi if ! grep -q "MinimumVT=7" etc/sddm.conf.new ; then # SDDM follows the systemd convention of starting the first graphical session # on tty1. We prefer the old convention where tty1 through tty6 # are reserved for text consoles: cat <> etc/sddm.conf.new [XDisplay] MinimumVT=7 EOT fi # Move over the new confguration file if needed: if [ -f etc/sddm.conf.new ]; then config etc/sddm.conf.new fi