fail boot to scratch/boot to desktop if pi user was removed

As reported in #30
This commit is contained in:
Alex Bradbury 2013-12-16 20:55:23 +00:00
parent 83aba18a70
commit 9a741ded9f

View File

@ -477,10 +477,14 @@ do_boot_behaviour() {
;; ;;
Desktop) Desktop)
if [ -e /etc/init.d/lightdm ]; then if [ -e /etc/init.d/lightdm ]; then
update-rc.d lightdm enable 2 if id -u pi > /dev/null 2>&1; then
sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/" update-rc.d lightdm enable 2
disable_boot_to_scratch sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/"
disable_raspi_config_at_boot disable_boot_to_scratch
disable_raspi_config_at_boot
else
whiptail --msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2
fi
else else
whiptail --msgbox "Do sudo apt-get install lightdm to allow configuration of boot to desktop" 20 60 2 whiptail --msgbox "Do sudo apt-get install lightdm to allow configuration of boot to desktop" 20 60 2
return 1 return 1
@ -488,9 +492,13 @@ do_boot_behaviour() {
;; ;;
Scratch) Scratch)
if [ -e /usr/bin/scratch ]; then if [ -e /usr/bin/scratch ]; then
[ -e /etc/init.d/lightdm ] && update-rc.d lightdm disable 2 if id -u pi > /dev/null 2>&1; then
disable_raspi_config_at_boot [ -e /etc/init.d/lightdm ] && update-rc.d lightdm disable 2
enable_boot_to_scratch disable_raspi_config_at_boot
enable_boot_to_scratch
else
whiptail --msgbox "The pi user has been removed, can't set up boot to scratch" 20 60 2
fi
else else
whiptail --msgbox "Do sudo apt-get install scratch to allow configuration of boot to scratch" 20 60 2 whiptail --msgbox "Do sudo apt-get install scratch to allow configuration of boot to scratch" 20 60 2
fi fi