Releasing debian version 1.236.2-1.
[live-boot-grml.git] / scripts / live-bottom / 44pk_allow
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 . /scripts/live-functions
24
25 log_begin_msg "Grant administrative PolicyKit pivilieges to default user"
26
27 # live-initramfs script
28
29 # configure PolicyKit in live session
30 mkdir -p /root/etc/PolicyKit
31 cat << EOF > /root/etc/PolicyKit/PolicyKit.conf
32 <?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
33
34 <!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
35 "http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">
36
37 <!-- See the manual page PolicyKit.conf(5) for file format -->
38
39 <config version="0.1">
40         <match user="root">
41                 <return result="yes"/>
42         </match>
43 EOF
44
45 if [ -n "${USERNAME}" ]
46 then
47         cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
48         <!-- don't ask password for user in live session -->
49         <match user="$USERNAME">
50                 <return result="yes"/>
51         </match>
52 EOF
53 fi
54
55 cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
56         <define_admin_auth group="admin"/>
57 </config>
58 EOF
59
60 mkdir -p /root/var/lib/polkit-1/localauthority/10-vendor.d
61 cat << EOF > /root/var/lib/polkit-1/localauthority/10-vendor.d/10-live-cd.pkla
62 # Policy to allow the livecd user to bypass policykit
63 [Live CD user permissions]
64 Identity=unix-user:$USERNAME
65 Action=*
66 ResultAny=no
67 ResultInactive=no
68 ResultActive=yes
69 EOF
70
71 log_end_msg