home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / initramfs-tools / scripts / casper-bottom / 15autologin < prev    next >
Encoding:
Text File  |  2009-04-18  |  1.2 KB  |  52 lines

  1. #!/bin/sh
  2.  
  3. PREREQ=""
  4. DESCRIPTION="Setting up automatic login..."
  5.  
  6. . /scripts/casper-functions
  7.  
  8. prereqs()
  9. {
  10.        echo "$PREREQ"
  11. }
  12.  
  13. case $1 in
  14. # get pre-requisites
  15. prereqs)
  16.        prereqs
  17.        exit 0
  18.        ;;
  19. esac
  20.  
  21. log_begin_msg "$DESCRIPTION"
  22.  
  23. # chroot needed to handle symlinks correctly
  24. if chroot /root [ -f /etc/gdm/gdm-cdd.conf ]; then
  25.     GDMCONF=/etc/gdm/gdm-cdd.conf
  26. else
  27.     GDMCONF=/etc/gdm/gdm.conf
  28. fi
  29.  
  30. # chroot needed to handle symlinks correctly
  31. if chroot /root [ -f ${GDMCONF} ]; then
  32.     # Configure GDM autologin
  33.     chroot /root sed -i \
  34.         -e "s/^AutomaticLoginEnable=.*\$/AutomaticLoginEnable=true/" \
  35.         -e "s/^AutomaticLogin=.*\$/AutomaticLogin=$USERNAME/" \
  36.         -e "s/^TimedLoginEnable=.*\$/TimedLoginEnable=true/" \
  37.         -e "s/^TimedLogin=.*\$/TimedLogin=$USERNAME/" \
  38.         -e "s/^TimedLoginDelay=.*\$/TimedLoginDelay=10/" \
  39.         ${GDMCONF}
  40. fi
  41.  
  42. if [ -f /root/etc/kde4/kdm/kdmrc ]; then
  43.     # Configure KDM autologin
  44.     sed -i -r \
  45.         -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \
  46.         -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=$USERNAME/" \
  47.         -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \
  48.         /root/etc/kde4/kdm/kdmrc
  49. fi
  50.  
  51. log_end_msg
  52.