home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / initramfs-tools / scripts / casper-bottom / 15autologin < prev    next >
Encoding:
Text File  |  2006-05-11  |  1.5 KB  |  63 lines

  1. #!/bin/sh
  2.  
  3. PREREQ=""
  4. DESCRIPTION="Setting up automatic login..."
  5.  
  6. . /scripts/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. if chroot /root [ -f /etc/gdm/gdm-cdd.conf ]; then
  24.     GDMCONF=/etc/gdm/gdm-cdd.conf
  25. else
  26.     GDMCONF=/etc/gdm/gdm.conf
  27. fi
  28.  
  29. if chroot /root [ -f ${GDMCONF} ]; then
  30.     # Configure GDM autologin
  31.     chroot /root sed -i \
  32.         -e "s/^AutomaticLoginEnable=.*\$/AutomaticLoginEnable=true/" \
  33.         -e "s/^AutomaticLogin=.*\$/AutomaticLogin=$USERNAME/" \
  34.         -e "s/^TimedLoginEnable=.*\$/TimedLoginEnable=true/" \
  35.         -e "s/^TimedLogin=.*\$/TimedLogin=$USERNAME/" \
  36.         -e "s/^TimedLoginDelay=.*\$/TimedLoginDelay=10/" \
  37.         ${GDMCONF}
  38. fi
  39.  
  40. if [ -f /root/etc/kde3/kdm/kdmrc ]; then
  41.     # Configure KDM autologin
  42.     sed -i -r \
  43.         -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \
  44.         -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=$USERNAME/" \
  45.         -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \
  46.         /root/etc/kde3/kdm/kdmrc
  47. fi
  48.  
  49. if chroot /root /usr/bin/which kpersonalizer >/dev/null; then
  50.     # Disable first-login wizard for KDE
  51.     if [ ! -f /root/etc/kde3/kpersonalizerrc ]; then
  52.         cat > /root/etc/kde3/kpersonalizerrc <<EOF
  53. [General]
  54. FirstLogin=false
  55. EOF
  56.     else
  57.         echo "I'm not smart enough to disable kpersonalizer startup" >&2
  58.         echo "Because kpersonalizerrc already exists" >&2
  59.     fi
  60. fi
  61.  
  62. log_end_msg
  63.