b0ce90d85a363b3ebc6c996cefefe93f6912391d
[live-boot-grml.git] / scripts / live-bottom / 15autologin
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 . /scripts/live-functions
24
25 log_begin_msg "Setting up automatic login..."
26
27 # live-initramfs script
28
29 if [ -n "${NOXAUTOLOGIN}" ]
30 then
31         exit 0
32 fi
33
34 # chroot needed to handle symlinks correctly
35 if chroot /root [ -f /etc/gdm/gdm-cdd.conf ]
36 then
37         GDMCONF=/etc/gdm/gdm-cdd.conf
38 else
39         GDMCONF=/etc/gdm/gdm.conf
40 fi
41
42 # chroot needed to handle symlinks correctly
43 if chroot /root [ -f ${GDMCONF} ]
44 then
45         if [ "${BUILD_SYSTEM}" = "Debian" ]
46         then
47                 # true hack ! -- nohar
48                 chroot /root cp /usr/share/gdm/defaults.conf /etc/gdm/gdm.conf
49         fi
50
51         # Configure GDM autologin
52         chroot /root \
53         sed -i -e "s/^AutomaticLoginEnable=.*\$/AutomaticLoginEnable=true/" \
54                -e "s/^AutomaticLogin=.*\$/AutomaticLogin=${USERNAME}/" \
55                -e "s/^TimedLoginEnable=.*\$/TimedLoginEnable=true/" \
56                -e "s/^TimedLogin=.*\$/TimedLogin=${USERNAME}/" \
57                -e "s/^TimedLoginDelay=.*\$/TimedLoginDelay=10/" \
58         ${GDMCONF}
59 fi
60
61 if [ -f /root/etc/kde3/kdm/kdmrc ]
62 then
63         # Configure KDM autologin
64         sed -i -r -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \
65                   -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=${USERNAME}/" \
66                   -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \
67         /root/etc/kde3/kdm/kdmrc
68 fi
69
70 log_end_msg