void-packages/srcpkgs/xbps-casper/files/scripts/casper-bottom/15autologin
2011-03-11 12:37:22 +01:00

53 lines
1.3 KiB
Bash
Executable file

#!/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}/etc/inittab" ]; then
sed -i -e "s|agetty|casper-getty|g" "${rootmnt}/etc/inittab"
fi
# Configure GDM autologin
if [ -d /root/etc/gdm ]; then
GDMCustomFile=/root/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
# 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 /root/etc/lightdm.conf ]; then
sed -i -e "s|^\#\(default-user=\).*|\1$USERNAME|" \
/root/etc/lightdm.conf
sed -i -e "s|^\#\(default-user-timeout=\).*|\10|" \
/root/etc/lightdm.conf
fi
log_end_msg