Removing ubuntu support.
[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         # true hack ! -- nohar
46         chroot /root cp /usr/share/gdm/defaults.conf /etc/gdm/gdm.conf
47
48         # Configure GDM autologin
49         chroot /root \
50         sed -i -e "s/^AutomaticLoginEnable=.*\$/AutomaticLoginEnable=true/" \
51                -e "s/^AutomaticLogin=.*\$/AutomaticLogin=${USERNAME}/" \
52                -e "s/^TimedLoginEnable=.*\$/TimedLoginEnable=true/" \
53                -e "s/^TimedLogin=.*\$/TimedLogin=${USERNAME}/" \
54                -e "s/^TimedLoginDelay=.*\$/TimedLoginDelay=10/" \
55         ${GDMCONF}
56 fi
57
58 if [ -f /root/etc/kde3/kdm/kdmrc ]
59 then
60         # Configure KDM autologin
61         sed -i -r -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \
62                   -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=${USERNAME}/" \
63                   -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \
64         /root/etc/kde3/kdm/kdmrc
65 fi
66
67 log_end_msg