From 31f0efc5213a6d64463184258e8d6212f67cc95d Mon Sep 17 00:00:00 2001 From: Simon Long Date: Fri, 21 Oct 2016 15:10:56 +0100 Subject: [PATCH] Modify sed strings for autologin detection to make them more robust against unexpected file contents. --- raspi-config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/raspi-config b/raspi-config index 650f91b..f8a8397 100755 --- a/raspi-config +++ b/raspi-config @@ -797,7 +797,7 @@ get_autologin() { fi else # 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 else echo 1 @@ -846,7 +846,7 @@ do_boot_behaviour() { else update-rc.d lightdm enable 2 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 else 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 update-rc.d lightdm enable 2 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 else whiptail --msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2