vmklive-display-manager-autologin.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
  3. # ex: ts=8 sw=4 sts=4 et filetype=sh
  4. USERNAME=$(getarg live.user)
  5. [ -z "$USERNAME" ] && USERNAME=anon
  6. # Configure GDM autologin
  7. if [ -d ${NEWROOT}/etc/gdm ]; then
  8. GDMCustomFile=${NEWROOT}/etc/gdm/custom.conf
  9. AutologinParameters="AutomaticLoginEnable=true\nAutomaticLogin=$USERNAME"
  10. # Prevent from updating if parameters already present (persistent usb key)
  11. if ! `grep -qs 'AutomaticLoginEnable' $GDMCustomFile` ; then
  12. if ! `grep -qs '\[daemon\]' $GDMCustomFile` ; then
  13. echo '[daemon]' >> $GDMCustomFile
  14. fi
  15. sed -i "s/\[daemon\]/\[daemon\]\n$AutologinParameters/" $GDMCustomFile
  16. fi
  17. fi
  18. # Configure lightdm autologin.
  19. if [ -r ${NEWROOT}/etc/lightdm.conf ]; then
  20. sed -i -e "s|^\#\(default-user=\).*|\1$USERNAME|" \
  21. ${NEWROOT}/etc/lightdm.conf
  22. sed -i -e "s|^\#\(default-user-timeout=\).*|\10|" \
  23. ${NEWROOT}/etc/lightdm.conf
  24. fi
  25. # Configure lxdm autologin.
  26. if [ -r ${NEWROOT}/etc/lxdm/lxdm.conf ]; then
  27. sed -i -e "s|^\#\# \(autologin=\).*|\1$USERNAME|" \
  28. ${NEWROOT}/etc/lxdm/lxdm.conf
  29. fi