void-packages/srcpkgs/xbps-casper/files/scripts/casper-bottom/15autologin

47 lines
1,003 B
Text
Raw Normal View History

#!/bin/sh
PREREQ=""
DESCRIPTION="Setting up automatic login"
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
. /scripts/casper-functions
log_begin_msg "$DESCRIPTION"
# Enable autologin for getty(1).
if [ -f "${rootmnt}/etc/inittab" ]; then
sed -i -e "s|agetty|casper-getty|g" "${rootmnt}/etc/inittab"
fi
if [ -d /root/etc/gdm ]; then
# Configure GDM autologin
GDMCustomFile=/root/etc/gdm/custom.conf
AutologinParameters="AutomaticLoginEnable=true\n\
AutomaticLogin=$USERNAME\n\
TimedLoginEnable=true\n\
TimedLogin=$USERNAME\n\
TimedLoginDelay=10"
# Prevent from updating if parameters already present (persistent usb key)
if ! `grep -qs 'AutomaticLoginEnable' $GDMCustomFile` ; then
if ! `grep -qs '\[daemon\]' $GDMCustomFile` ; then
echo '[daemon]' >> $GDMCustomFile
fi
sed -i "s/\[daemon\]/\[daemon\]\n$AutologinParameters/" $GDMCustomFile
fi
fi
log_end_msg