- <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"/>
+ <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"/>