Modify sed strings for autologin detection to make them more robust against unexpected file contents.

This commit is contained in:
Simon Long 2016-10-21 15:10:56 +01:00
parent 2103410cef
commit 31f0efc521
1 changed files with 3 additions and 3 deletions

View File

@ -797,7 +797,7 @@ get_autologin() {
fi fi
else else
# booting to desktop - check the autologin for lightdm */ # booting to desktop - check the autologin for lightdm */
if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then if grep -q "^autologin-user=pi" /etc/lightdm/lightdm.conf ; then
echo 0 echo 0
else else
echo 1 echo 1
@ -846,7 +846,7 @@ do_boot_behaviour() {
else else
update-rc.d lightdm enable 2 update-rc.d lightdm enable 2
fi fi
sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=pi/#autologin-user=/" sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/"
disable_raspi_config_at_boot disable_raspi_config_at_boot
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
@ -862,7 +862,7 @@ do_boot_behaviour() {
else else
update-rc.d lightdm enable 2 update-rc.d lightdm enable 2
fi fi
sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/" sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=pi/"
disable_raspi_config_at_boot disable_raspi_config_at_boot
else else
whiptail --msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2 whiptail --msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2