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

55 lines
1.3 KiB
Text
Raw Normal View History

#!/bin/sh
PREREQ=""
DESCRIPTION="Setting up automatic login"
[ -r /scripts/functions ] && . /scripts/functions
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
log_begin_msg "$DESCRIPTION"
# Enable autologin for getty(1).
if [ -f ${rootmnt}//lib/systemd/system/getty@.service ]; then
sed -i -e "s|agetty|casper-getty|g" \
${rootmnt}//lib/systemd/system/getty@.service
fi
2011-02-16 18:23:10 +00:00
# Configure GDM autologin
if [ -d ${rootmnt}/etc/gdm ]; then
GDMCustomFile=${rootmnt}/etc/gdm/custom.conf
AutologinParameters="AutomaticLoginEnable=true\nAutomaticLogin=$USERNAME"
# 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
2011-02-16 18:23:10 +00:00
# Configure lightdm autologin. Autologin doesn't seem to work
# with lightdm-0.2.3, will be enabled when it's fixed.
log_end_msg
exit 0
if [ -r ${rootmnt}/etc/lightdm.conf ]; then
2011-02-16 18:23:10 +00:00
sed -i -e "s|^\#\(default-user=\).*|\1$USERNAME|" \
${rootmnt}/etc/lightdm.conf
2011-02-16 18:23:10 +00:00
sed -i -e "s|^\#\(default-user-timeout=\).*|\10|" \
${rootmnt}/etc/lightdm.conf
2011-02-16 18:23:10 +00:00
fi
log_end_msg