Merging casper 1.201.
[live-boot-grml.git] / scripts / live-bottom / 44pk_allow
index 84c4b6b..a211880 100755 (executable)
@@ -27,6 +27,7 @@ log_begin_msg "Grant administrative PolicyKit pivilieges to default user"
 # live-initramfs script
 
 # 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 -*- -->
 
@@ -39,12 +40,32 @@ cat << EOF > /root/etc/PolicyKit/PolicyKit.conf
        <match user="root">
                <return result="yes"/>
        </match>
+EOF
+
+if [ -n "${USERNAME}" ]
+then
+       cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
        <!-- don't ask password for user in live session -->
        <match user="$USERNAME">
                <return result="yes"/>
        </match>
+EOF
+fi
+
+cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
        <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