#!/bin/sh

set -e

# Fix hardcoded autologin user of package pi-greeter
# See: https://github.com/raspberrypi-ui/pi-greeter/blob/master/debian/pi-greeter.postinst

if [ "$1" = "configure" ]; then
	if [ -z "$2" ]; then
		if [ -e /etc/lightdm/lightdm.conf ]; then
			sed -i -e "s/^autologin-user=pi$/#autologin-user=/" \
				/etc/lightdm/lightdm.conf
		fi
		# Set multiuser-target (console) and disable autologin, which was modified by rpd-common package
		raspi-config nonint do_boot_behaviour B1
	fi
fi

#DEBHELPER#

exit 0
