xbps-casper: enable GDM autologin, full perms via polkit for GNOME. Bumpver.

This commit is contained in:
Juan RP 2010-11-11 02:50:41 +01:00
parent f37b5f1feb
commit 399de5ee1f
3 changed files with 81 additions and 4 deletions

View file

@ -1,9 +1,7 @@
#!/bin/sh
PREREQ=""
DESCRIPTION="Setting up automatic login"
[ -r /scripts/casper-functions ] && . /scripts/casper-functions
DESCRIPTION="Setting up automatic login..."
prereqs()
{
@ -18,8 +16,31 @@ prereqs)
;;
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

View file

@ -0,0 +1,56 @@
#!/bin/sh
PREREQ=""
DESCRIPTION="Grant administrative PolicyKit pivilieges to default user..."
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
. /scripts/casper-functions
log_begin_msg "$DESCRIPTION"
# configure PolicyKit in live session
mkdir -p /root/etc/PolicyKit
cat << EOF > /root/etc/PolicyKit/PolicyKit.conf
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">
<!-- See the manual page PolicyKit.conf(5) for file format -->
<config version="0.1">
<match user="root">
<return result="yes"/>
</match>
<!-- don't ask password for user in live session -->
<match user="$USERNAME">
<return result="yes"/>
</match>
<define_admin_auth group="admin"/>
</config>
EOF
mkdir -p /root/var/lib/polkit-1/localauthority/10-vendor.d
cat << EOF > /root/var/lib/polkit-1/localauthority/10-vendor.d/10-live-cd.pkla
# Policy to allow the livecd user to bypass policykit
[Live CD user permissions]
Identity=unix-user:$USERNAME
Action=*
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF
log_end_msg

View file

@ -1,6 +1,6 @@
# Template file for 'xbps-casper'
pkgname=xbps-casper
version=0.5.ubuntu1.236
version=0.6.ubuntu1.236
build_style=custom-install
short_desc="Run a live preinstalled system from read-only media"
maintainer="Juan RP <xtraeme@gmail.com>"