diff --git a/features.in/live/config.mk b/features.in/live/config.mk index be682d16..8c2cb361 100644 --- a/features.in/live/config.mk +++ b/features.in/live/config.mk @@ -4,8 +4,13 @@ use/live: use/stage2 sub/stage2/live use/live/base: use/live use/syslinux/ui-menu @$(call add,LIVE_LISTS,$(call tags,base && (live || network))) -use/live/icewm: use/live/base - @$(call add,LIVE_LISTS,\ +# NB: there's an unconditional live/image-scripts.d/40-autologin script +# *but* it only configures some of the *existing* means; let's add one +use/live/autologin: use/live/base + @$(call add,LIVE_PACKAGES,autologin xinit) + +use/live/icewm: use/live/autologin + @$(call add,LIVE_LISTS, \ $(call tags,(base || desktop) && (live || network || icewm))) # this is a manual installation script (text-based) diff --git a/features.in/live/live/image-scripts.d/40-autologin b/features.in/live/live/image-scripts.d/40-autologin new file mode 100755 index 00000000..2f01ea4a --- /dev/null +++ b/features.in/live/live/image-scripts.d/40-autologin @@ -0,0 +1,34 @@ +#!/bin/sh -ef +USER=altlinux + +# setup runlevel +INITTAB=/etc/inittab +if [ -f "$INITTAB" ]; then + [ -z "$runlevel" ] && runlevel=5 + subst "s,^\(id:\)\(.*\)\(:initdefault.*\),\\1$runlevel\\3," "$INITTAB" +fi + +# autologin^2 +if [ -x /usr/sbin/autologin ]; then + cat << E_O_F >> /etc/sysconfig/autologin +USER=$USER +AUTOLOGIN=yes +E_O_F +fi + +# gdm2 autologin +GDM_CONF=/etc/X11/gdm/custom.conf +if [ -f "$GDM_CONF" ]; then + sed -i -e '/\[daemon\]/aAutomaticLoginEnable=true\nAutomaticLogin='$USER \ + "$GDM_CONF" +fi + +# kdm3 autologin +# TODO: iterate over kdm{,4} if feasible +KDMRC=/etc/X11/kdm/kdmrc +if [ -f "$KDMRC" ]; then + sed -i \ + -e '/AutoLoginEnable/ s,^.*$,AutoLoginEnable=true,' \ + -e '/AutoLoginUser/ s,^.*$,AutoLoginUser='$USER',' \ + "$KDMRC" +fi