#!/bin/sh ## live-config(7) - System Configuration Components ## Copyright (C) 2006-2015 Daniel Baumann ## ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. ## This is free software, and you are welcome to redistribute it ## under certain conditions; see COPYING for details. #set -e Cmdline () { # Reading kernel command line for _PARAMETER in ${LIVE_CONFIG_CMDLINE} do case "${_PARAMETER}" in live-config.noroot|noroot) LIVE_CONFIG_NOROOT="true" ;; live-config.username=*|username=*) LIVE_USERNAME="${_PARAMETER#*username=}" ;; esac done } Init () { # Disable root access, no matter what mechanism case "${LIVE_CONFIG_NOROOT}" in true) exit 0 ;; esac # Checking if package is installed if [ ! -e /var/lib/dpkg/info/policykit-1.list ] || \ [ -e /var/lib/live/config/policykit ] then exit 0 fi echo -n " policykit" } Config () { # Grant administrative PolicyKit pivilieges to default user # Configure PolicyKit in live session mkdir -p /etc/PolicyKit cat > /etc/PolicyKit/PolicyKit.conf << EOF EOF if [ -n "${LIVE_USERNAME}" ] then cat >> /etc/PolicyKit/PolicyKit.conf << EOF EOF fi cat >> /etc/PolicyKit/PolicyKit.conf << EOF EOF mkdir -p /var/lib/polkit-1/localauthority/10-vendor.d cat > /var/lib/polkit-1/localauthority/10-vendor.d/10-live-cd.pkla << EOF # Policy to allow the livecd user to bypass policykit [Live CD user permissions] Identity=unix-user:${LIVE_USERNAME} Action=* ResultAny=no ResultInactive=no ResultActive=yes EOF # Creating state file touch /var/lib/live/config/policykit } Cmdline Init Config