diff options
Diffstat (limited to 'system-config/components')
36 files changed, 2792 insertions, 0 deletions
diff --git a/system-config/components/0010-debconf b/system-config/components/0010-debconf new file mode 100755 index 0000000..b579941 --- /dev/null +++ b/system-config/components/0010-debconf @@ -0,0 +1,93 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.debconf-preseed=*|debconf-preseed=*) + LIVE_DEBCONF_PRESEED="${_PARAMETER#*debconf-preseed=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/debconf.list ] || \ + [ -e /var/lib/live/config/debconf ] + then + exit 0 + fi + + echo -n " debconf" +} + +Config () +{ + if [ -z "${LIVE_DEBCONF_PRESEED}" ] + then + exit 0 + fi + + for _PRESEED in $(echo ${LIVE_DEBCONF_PRESEED} | sed -e 's/|/ /g') + do + case "${_PRESEED}" in + filesystem) + if ls /lib/live/config-preseed/* 2>&1 + then + _PRESEEDS="${_PRESEEDS} $(for _FILE in /lib/live/config-preseed/*; do echo file://${_FILE}; done)" + fi + ;; + + medium) + if ls /lib/live/mount/medium/live/config-preseed/* 2>&1 + then + _PRESEEDS="${_PRESEEDS} $(for _FILE in /lib/live/mount/medium/live/config-preseed/*; do echo file://${_FILE}; done)" + fi + ;; + + *) + _PRESEEDS="${_PRESEEDS} ${_PRESEED}" + ;; + esac + done + + for _PRESEED in ${_PRESEEDS} + do + _TMPFILE="$(mktemp -t live-config.XXXXXXXX)" + + if echo "${_PRESEED}" | grep -qs file:// + then + # local file + cp $(echo ${_PRESEED} | sed 's|file://||') "${_TMPFILE}" + else + # remote file + Setup_network + + wget --quiet "${_PRESEED}" -O "${_TMPFILE}" + fi + + debconf-set-selections < "${_TMPFILE}" + rm -f "${_TMPFILE}" + done + + # Creating state file + touch /var/lib/live/config/debconf +} + +Cmdline +Init +Config diff --git a/system-config/components/0020-hostname b/system-config/components/0020-hostname new file mode 100755 index 0000000..6ffc603 --- /dev/null +++ b/system-config/components/0020-hostname @@ -0,0 +1,101 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.hostname=*|hostname=*) + LIVE_HOSTNAME="${_PARAMETER#*hostname=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ -z "${LIVE_HOSTNAME}" ] || \ + [ -e /var/lib/live/config/hostname ] + then + exit 0 + fi + + echo -n " hostname" +} + +Config () +{ + # Change hostname only if it is not set + if [ ! -e /etc/hostname ] || \ + grep -qs localhost\.localdomain /etc/hostname + then + # Supporting variables within hostnames + if [ -e /bin/ip ] + then + LINK="$(ip -oneline -family link address show dev eth0 | awk '{ print $13 }' | sed -e "s|:|${_IP_SEPARATOR}|g")" + INET="$(ip -oneline -family inet address show dev eth0 | awk '{ print $4 }' | sed -e "s|\.|${_IP_SEPARATOR}|g" -e 's|/.*||')" + INET6="$(ip -oneline -family inet6 address show dev eth0 | awk '{ print $4 }' | sed -e "s|:|${_IP_SEPARATOR}|g" -e 's|/.*||' -e 's|--|-|')" + + eval LIVE_HOSTNAME="${LIVE_HOSTNAME}" + fi + + echo "${LIVE_HOSTNAME}" > /etc/hostname + else + LIVE_HOSTNAME="$(cat /etc/hostname)" + fi + + # Updating hostname in /etc/hosts + if [ -s /etc/hosts ] + then + # /etc/hosts exists but has no 127.0.0.1 + if ! grep -Eq "^ *127.0.0.1" /etc/hosts + then + mv /etc/hosts /etc/hosts.tmp + + echo "127.0.0.1 localhost ${LIVE_HOSTNAME}" > /etc/hosts + cat /etc/hosts.tmp >> /etc/hosts + + rm -f /etc/hosts.tmp + # /etc/hosts exists and has no matching 127.0.0.1 + elif ! grep -Eq "^ *127.0.0.1.*${LIVE_HOSTNAME}" /etc/hosts + then + _HOSTS="$(grep -E "^ *127.0.0.1" /etc/hosts | awk '{ $1=""; print $0 }' | sed -e 's|localhost||')" + _HOSTS="$(echo localhost ${_HOSTS} ${LIVE_HOSTNAME} | sed -e 's|^ ||' -e 's| | |g')" + + sed -i -e "s|^ *127.0.0.1.*|127.0.0.1 ${_HOSTS}|" /etc/hosts + fi + else + # /etc/hosts does not exist + +cat > /etc/hosts << EOF +127.0.0.1 localhost ${LIVE_HOSTNAME} +::1 localhost ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +EOF + + fi + + hostname "${LIVE_HOSTNAME}" || true + + # Creating state file + touch /var/lib/live/config/hostname +} + +Cmdline +Init +Config diff --git a/system-config/components/0030-live-debconfig_passwd b/system-config/components/0030-live-debconfig_passwd new file mode 100755 index 0000000..d4d767a --- /dev/null +++ b/system-config/components/0030-live-debconfig_passwd @@ -0,0 +1,100 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.user-default-groups=*|user-default-groups=*) + LIVE_USER_DEFAULT_GROUPS="${_PARAMETER#*user-default-groups=}" + ;; + + live-config.user-fullname=*|user-fullname=*) + LIVE_USER_FULLNAME="${_PARAMETER#*user-fullname=}" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/live-debconfig.list ] || \ + [ -e /var/lib/live/config/live-debconfig_passwd ] + then + exit 0 + fi + + echo -n " live-debconfig (passwd)" +} + +Config () +{ + # Checking if package is already configured differently + if grep -q "^${LIVE_USERNAME}:" /etc/passwd + then + exit 0 + fi + + # Adjust formating of groups + if [ -n "${LIVE_USER_DEFAULT_GROUPS}" ] + then + LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|,| |g')" + fi + + # Make sure user is not in sudo group if sudo is disabled + case "${LIVE_CONFIG_NOROOT}" in + true) + LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|sudo||')" + ;; + esac + + # Default password is: live + # passwords can be generated with 'echo "live" | mkpasswd -s', + # a blank password is 'U6aMy0wojraho'. + _PASSWORD="8Ab05sVQ4LLps" + +cat > /tmp/live-config.cfg << EOF +live-debconfig live-debconfig/passwd/shadow boolean on +#live-debconfig live-debconfig/passwd/root-password password +#live-debconfig live-debconfig/passwd/root-password-again password +live-debconfig live-debconfig/passwd/root-password-crypted string * +live-debconfig live-debconfig/passwd/user-name string ${LIVE_USERNAME} +live-debconfig live-debconfig/passwd/user-fullname string ${LIVE_USER_FULLNAME} +#live-debconfig live-debconfig/passwd/user-password password +#live-debconfig live-debconfig/passwd/user-password-again password +live-debconfig live-debconfig/passwd/user-password-crypted string ${_PASSWORD} +live-debconfig live-debconfig/passwd/user-home string /home/user +live-debconfig live-debconfig/passwd/user-uid string 1000 +live-debconfig live-debconfig/passwd/user-gid string 1000 +live-debconfig live-debconfig/passwd/user-default-groups string ${LIVE_USER_DEFAULT_GROUPS} +live-debconfig live-debconfig/passwd/user-system-user boolean false +EOF + + live-debconfig-set-selections /tmp/live-config.cfg + rm -f /tmp/live-config.cfg + + live-debconfig --debconfig=passwd + + # Creating state file + touch /var/lib/live/config/live-debconfig_passwd +} + +Cmdline +Init +Config diff --git a/system-config/components/0030-user-setup b/system-config/components/0030-user-setup new file mode 100755 index 0000000..bcd3cb9 --- /dev/null +++ b/system-config/components/0030-user-setup @@ -0,0 +1,97 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.user-default-groups=*|user-default-groups=*) + LIVE_USER_DEFAULT_GROUPS="${_PARAMETER#*user-default-groups=}" + ;; + + live-config.user-fullname=*|user-fullname=*) + LIVE_USER_FULLNAME="${_PARAMETER#*user-fullname=}" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/user-setup.list ] || \ + [ -e /var/lib/live/config/user-setup ] + then + exit 0 + fi + + echo -n " user-setup" +} + +Config () +{ + # Checking if package is already configured differently + if grep -q "^${LIVE_USERNAME}:" /etc/passwd + then + exit 0 + fi + + # Adjust formating of groups + if [ -n "${LIVE_USER_DEFAULT_GROUPS}" ] + then + LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|,| |g')" + fi + + # Make sure user is not in sudo group if sudo is disabled + case "${LIVE_CONFIG_NOROOT}" in + true) + LIVE_USER_DEFAULT_GROUPS="$(echo ${LIVE_USER_DEFAULT_GROUPS} | sed -e 's|sudo||')" + ;; + esac + + # Default password is: live + # passwords can be generated with 'echo "live" | mkpasswd -s', + # a blank password is 'U6aMy0wojraho'. + _PASSWORD="8Ab05sVQ4LLps" + +cat > /tmp/live-config.cfg << EOF +user-setup passwd/make-user boolean true +user-setup passwd/root-password-crypted string * +user-setup passwd/user-password-crypted string ${_PASSWORD} +user-setup passwd/user-default-groups string ${LIVE_USER_DEFAULT_GROUPS} +user-setup passwd/user-fullname string ${LIVE_USER_FULLNAME} +user-setup passwd/username string ${LIVE_USERNAME} +user-setup passwd/user-uid string 1000 +EOF + + debconf-set-selections < /tmp/live-config.cfg + rm -f /tmp/live-config.cfg + + # Workaround for bug in shadow + set +e + /usr/lib/user-setup/user-setup-apply 2>&1 \ + | grep -v "Shadow passwords are now on" + set -e + + # Creating state file + touch /var/lib/live/config/user-setup +} + +Cmdline +Init +Config diff --git a/system-config/components/0040-sudo b/system-config/components/0040-sudo new file mode 100755 index 0000000..8b828cb --- /dev/null +++ b/system-config/components/0040-sudo @@ -0,0 +1,97 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 or already configured + if [ ! -e /var/lib/dpkg/info/sudo.list ] || \ + [ -e /var/lib/live/config/sudo ] + then + exit 0 + fi + + echo -n " sudo" + +} + +Config () +{ + # Skip sudo configuration if username is root + case "${LIVE_USERNAME}" in + root) + exit 0 + ;; + esac + + # Checking if package is already configured differently + if grep -qs "^${LIVE_USERNAME}" /etc/sudoers.d/live + then + exit 0 + fi + + echo "${LIVE_USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/live + chmod 0440 /etc/sudoers.d/live + + sudo -u "${LIVE_USERNAME}" sh -c "echo 'SU_TO_ROOT_SU=sudo' >> /home/${LIVE_USERNAME}/.su-to-rootrc" + + if [ -x /usr/bin/gconftool-2 ] + then + sudo -u "${LIVE_USERNAME}" gconftool-2 -s -t bool /apps/gksu/sudo-mode true + sudo -u "${LIVE_USERNAME}" gconftool-2 -s -t bool /apps/gksu/display-no-pass-info false + fi + + sudo -u "${LIVE_USERNAME}" sh -c "umask 0077 && mkdir -p /home/${LIVE_USERNAME}/.kde/share/config && cat > /home/${LIVE_USERNAME}/.kde/share/config/kdesurc" << EOF +[super-user-command] +super-user-command=sudo +EOF + + if [ -e /usr/share/apps/konsole/sumc.desktop ] + then + sudo -u "${LIVE_USERNAME}" sh -c "umask 0077 && mkdir -p /home/${LIVE_USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo mc -c/' /usr/share/apps/konsole/sumc.desktop > /home/${LIVE_USERNAME}/.kde/share/apps/konsole/sumc.desktop" + fi + + if [ -e /usr/share/apps/konsole/su.desktop ] + then + sudo -u "${LIVE_USERNAME}" sh -c "umask 0077 && mkdir -p /home/${LIVE_USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo -i/' /usr/share/apps/konsole/su.desktop > /home/${LIVE_USERNAME}/.kde/share/apps/konsole/su.desktop" + fi + + # Creating state file + touch /var/lib/live/config/sudo +} + +Cmdline +Init +Config diff --git a/system-config/components/0050-locales b/system-config/components/0050-locales new file mode 100755 index 0000000..583d4a1 --- /dev/null +++ b/system-config/components/0050-locales @@ -0,0 +1,71 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.locales=*|locales=*) + LIVE_LOCALES="${_PARAMETER#*locales=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/locales.list ] || \ + [ -e /var/lib/live/config/locales ] + then + exit 0 + fi + + echo -n " locales" +} + +Config () +{ + if echo "${LIVE_LOCALES}" | grep -qs "," + then + # multiple locales specified + _LOCALE="$(echo ${LIVE_LOCALES} | sed -e 's|,.*||')" + _LOCALES="$(echo ${LIVE_LOCALES} | sed -e "s|^${_LOCALE},||" -e 's|,| |g')" + else + # one or no locale specified + _LOCALE="${LIVE_LOCALES:-en_US.UTF-8}" + _LOCALES="" + fi + + echo "LANG=${_LOCALE}" > /etc/default/locale + + if [ -e /etc/locale.gen ] + then + for _LOCALE in ${_LOCALE} ${_LOCALES} + do + _CHARSET="$(echo ${_LOCALE} | awk -F. '{ print $2 }')" + + sed -i -e "s|# ${_LOCALE} ${_CHARSET}|${_LOCALE} ${_CHARSET}|" /etc/locale.gen + done + fi + + locale-gen --keep-existing > /dev/null 2>&1 + + # Creating state file + touch /var/lib/live/config/locales +} + +Cmdline +Init +Config diff --git a/system-config/components/0060-locales-all b/system-config/components/0060-locales-all new file mode 100755 index 0000000..e7a12ac --- /dev/null +++ b/system-config/components/0060-locales-all @@ -0,0 +1,60 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.locales=*|locales=*) + LIVE_LOCALES="${_PARAMETER#*locales=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/locales-all.list ] || \ + [ -e /var/lib/live/config/locales-all ] + then + exit 0 + fi + + echo -n " locales-all" +} + +Config () +{ + if [ -n "${LIVE_LOCALES}" ] + then + LIVE_LOCALES="$(echo ${LIVE_LOCALES} | awk -F, '{ print $1 }')" + else + LIVE_LOCALES="en_US.UTF-8" + fi + + if [ -e /etc/progress-linux_version ] + then + sed -i -e "s|^ *export LANG=.*|export LANG=\"${LIVE_LOCALES}\"|" /etc/profile + else + printf 'export LANG="%s"\n' "${_LOCALE}" > /etc/profile.d/zz-live-config_locales-all.sh + fi + + # Creating state file + touch /var/lib/live/config/locales-all +} + +Cmdline +Init +Config diff --git a/system-config/components/0070-tzdata b/system-config/components/0070-tzdata new file mode 100755 index 0000000..ac4864a --- /dev/null +++ b/system-config/components/0070-tzdata @@ -0,0 +1,59 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.timezone=*|timezone=*) + LIVE_TIMEZONE="${_PARAMETER#*timezone=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/tzdata.list ] || \ + [ -e /var/lib/live/config/tzdata ] + then + exit 0 + fi + + echo -n " tzdata" +} + +Config () +{ + if [ -n "${LIVE_TIMEZONE}" ] + then + _AREA="$(echo ${LIVE_TIMEZONE} | cut -f1 -d '/')" + _ZONE="$(echo ${LIVE_TIMEZONE} | cut -f2 -d '/')" + else + _AREA="Etc" + _ZONE="UTC" + fi + + echo "${_AREA}/${_ZONE}" > /etc/timezone + rm -f /etc/localtime + dpkg-reconfigure -f noninteractive -p critical tzdata + + # Creating state file + touch /var/lib/live/config/tzdata +} + +Cmdline +Init +Config diff --git a/system-config/components/0080-gdm3 b/system-config/components/0080-gdm3 new file mode 100755 index 0000000..bef4774 --- /dev/null +++ b/system-config/components/0080-gdm3 @@ -0,0 +1,85 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nox11autologin|nox11autologin) + LIVE_CONFIG_NOX11AUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables graphical autologin, no matter what mechanism + case "${LIVE_CONFIG_NOX11AUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/gdm3.list ] || \ + [ -e /var/lib/live/config/gdm3 ] + then + exit 0 + fi + + echo -n " gdm3" +} + +Config () +{ + # Checking if package is already configured + if grep -qs AutomaticLoginEnable=true /etc/gdm3/daemon.conf + then + exit 0 + fi + + _GDM3_OPTIONS="AutomaticLoginEnable=true\n\ +AutomaticLogin=${LIVE_USERNAME}\n\ +TimedLoginEnable=true\n\ +TimedLogin=${LIVE_USERNAME}\n\ +TimedLoginDelay=5" + + sed -i -e "s|\[daemon\]|\[daemon\]\n${_GDM3_OPTIONS}|" /etc/gdm3/daemon.conf + + # Avoid xinit + touch /var/lib/live/config/xinit + + # Creating state file + touch /var/lib/live/config/gdm3 +} + +Cmdline +Init +Config diff --git a/system-config/components/0090-kdm b/system-config/components/0090-kdm new file mode 100755 index 0000000..5be0695 --- /dev/null +++ b/system-config/components/0090-kdm @@ -0,0 +1,92 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nox11autologin|nox11autologin) + LIVE_CONFIG_NOX11AUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables graphical autologin, no matter what mechanism + case "${LIVE_CONFIG_NOX11AUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/kdm.list ] || \ + [ -e /var/lib/live/config/kdm ] + then + exit 0 + fi + + echo -n " kdm" +} + +Config () +{ + if [ ! -e /etc/kde4/kdm/kdmrc ] + then + exit 0 + fi + + # autologin + if [ -n "${LIVE_USERNAME}" ] + then + sed -i -r -e "s|^#.*AutoLoginEnable=.*\$|AutoLoginEnable=true|" \ + -e "s|^#.*AutoLoginAgain=.*\$|AutoLoginAgain=true|" \ + -e "s|^#.*AutoLoginUser=.*\$|AutoLoginUser=${LIVE_USERNAME}|" \ + /etc/kde4/kdm/kdmrc + fi + + # language + if [ -n "${_LANGUAGE}" ] + then + sed -i -r -e "s|^#.*Language=.*\$|Language=${_LANGUAGE}|" \ + /etc/kde4/kdm/kdmrc + fi + + # Avoid xinit + touch /var/lib/live/config/xinit + + # Creating state file + touch /var/lib/live/config/kdm +} + +Cmdline +Init +Config diff --git a/system-config/components/0100-lightdm b/system-config/components/0100-lightdm new file mode 100755 index 0000000..cb25f97 --- /dev/null +++ b/system-config/components/0100-lightdm @@ -0,0 +1,78 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nox11autologin|nox11autologin) + LIVE_CONFIG_NOX11AUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables graphical autologin, no matter what mechanism + case "${LIVE_CONFIG_NOX11AUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/lightdm.list ] || \ + [ -e /var/lib/live/config/lightdm ] + then + exit 0 + fi + + echo -n " lightdm" +} + +Config () +{ + if [ -e /etc/lightdm/lightdm.conf ] + then + sed -i -r -e "s|^#.*autologin-user=.*\$|autologin-user=${LIVE_USERNAME}|" \ + -e "s|^#.*autologin-user-timeout=.*\$|autologin-user-timeout=0|" \ + /etc/lightdm/lightdm.conf + fi + + # Avoid xinit + touch /var/lib/live/config/xinit + + # Creating state file + touch /var/lib/live/config/lightdm +} + +Cmdline +Init +Config diff --git a/system-config/components/0110-lxdm b/system-config/components/0110-lxdm new file mode 100755 index 0000000..64cb197 --- /dev/null +++ b/system-config/components/0110-lxdm @@ -0,0 +1,79 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nox11autologin|nox11autologin) + LIVE_CONFIG_NOX11AUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables graphical autologin, no matter what mechanism + case "${LIVE_CONFIG_NOX11AUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/lxdm.list ] || \ + [ -e /var/lib/live/config/lxdm ] + then + exit 0 + fi + + echo -n " lxdm" +} + +Config () +{ + # Configure autologin + if [ -e /etc/lxdm/lxdm.conf ] + then + sed -i -r -e "s|^#.*autologin=.*\$|autologin=${LIVE_USERNAME}|" \ + -e "s|^#.*session.*\$|session|" \ + /etc/lxdm/lxdm.conf + fi + + # Avoid xinit + touch /var/lib/live/config/xinit + + # Creating state file + touch /var/lib/live/config/lxdm +} + +Cmdline +Init +Config diff --git a/system-config/components/0120-nodm b/system-config/components/0120-nodm new file mode 100755 index 0000000..b6e5a65 --- /dev/null +++ b/system-config/components/0120-nodm @@ -0,0 +1,84 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nox11autologin|nox11autologin) + LIVE_CONFIG_NOX11AUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables graphical autologin, no matter what mechanism + case "${LIVE_CONFIG_NOX11AUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/nodm.list ] || \ + [ -e /var/lib/live/config/nodm ] + then + exit 0 + fi + + echo -n " nodm" +} + +Config () +{ + # autologin + sed -i -r -e "s|^NODM_ENABLED=.*\$|NODM_ENABLED=true|" \ + -e "s|^NODM_USER=.*\$|NODM_USER=${LIVE_USERNAME}|" \ + /etc/default/nodm + +cat > /tmp/live-config.cfg << EOF +nodm nodm/enabled boolean true +nodm nodm/user string ${LIVE_USERNAME} +EOF + + debconf-set-selections < /tmp/live-config.cfg + rm -f /tmp/live-config.cfg + + # Avoid xinit + touch /var/lib/live/config/xinit + + # Creating state file + touch /var/lib/live/config/nodm +} + +Cmdline +Init +Config diff --git a/system-config/components/0130-slim b/system-config/components/0130-slim new file mode 100755 index 0000000..04bbd7d --- /dev/null +++ b/system-config/components/0130-slim @@ -0,0 +1,82 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nox11autologin|nox11autologin) + LIVE_CONFIG_NOX11AUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables graphical autologin, no matter what mechanism + case "${LIVE_CONFIG_NOX11AUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/slim.list ] || \ + [ -e /var/lib/live/config/slim ] + then + exit 0 + fi + + echo -n " slim" +} + +Config () +{ + # Checking if package is already configured differently + if grep -qs "^auto_login" /etc/slim.conf + then + exit 0 + fi + + # autologin + sed -i -r -e "s|^#.*auto_login.*\$|auto_login yes|" \ + -e "s|^#.*default_user.*\$|default_user ${LIVE_USERNAME}|" \ + /etc/slim.conf + + # Avoid xinit + touch /var/lib/live/config/xinit + + # Creating state file + touch /var/lib/live/config/slim +} + +Cmdline +Init +Config diff --git a/system-config/components/0140-xinit b/system-config/components/0140-xinit new file mode 100755 index 0000000..01deca4 --- /dev/null +++ b/system-config/components/0140-xinit @@ -0,0 +1,94 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nox11autologin|nox11autologin) + LIVE_CONFIG_NOX11AUTOLOGIN="true" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables graphical autologin, no matter what mechanism + case "${LIVE_CONFIG_NOX11AUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if a display manager has been configured + case "${_X11}" in + true) + rm -f /etc/profile.d/zz-live-config_xinit.sh + + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/xinit.list ] || \ + [ -e /var/lib/live/config/xinit ] + then + exit 0 + fi + + echo -n " xinit" +} + +Config () +{ + # Checking if package is already configured differently + if [ -e /etc/profile.d/zz-live-config_xinit.sh ] + then + exit 0 + fi + +cat > /etc/profile.d/zz-live-config_xinit.sh << EOF +if [ -z "\${DISPLAY}" ] && [ \$(tty) = /dev/tty1 ] +then + while true + do + if grep -qs quiet /proc/cmdline + then + startx > /dev/null 2>&1 + else + startx + fi + done +fi +EOF + + # Creating state file + touch /var/lib/live/config/xinit +} + +Cmdline +Init +Config diff --git a/system-config/components/0150-keyboard-configuration b/system-config/components/0150-keyboard-configuration new file mode 100755 index 0000000..52537f7 --- /dev/null +++ b/system-config/components/0150-keyboard-configuration @@ -0,0 +1,92 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.keyboard-layouts=*|keyboard-layouts=*) + LIVE_KEYBOARD_LAYOUTS="${_PARAMETER#*keyboard-layouts=}" + ;; + + live-config.keyboard-model=*|keyboard-model=*) + LIVE_KEYBOARD_MODEL="${_PARAMETER#*keyboard-model=}" + ;; + + live-config.keyboard-options=*|keyboard-options=*) + LIVE_KEYBOARD_OPTIONS="${_PARAMETER#*keyboard-options=}" + ;; + + live-config.keyboard-variants=*|keyboard-variants=*) + LIVE_KEYBOARD_VARIANTS="${_PARAMETER#*keyboard-variants=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/keyboard-configuration.list ] || \ + [ -e /var/lib/live/config/keyboard-configuration ] + then + exit 0 + fi + + echo -n " keyboard-configuration" +} + +Config () +{ + if [ -n "${LIVE_KEYBOARD_LAYOUTS}" ] + then + echo "keyboard-configuration keyboard-configuration/layoutcode select ${LIVE_KEYBOARD_LAYOUTS}" >> /tmp/live-config.cfg + + sed -i -e "s|^XKBLAYOUT=.*$|XKBLAYOUT=\"${LIVE_KEYBOARD_LAYOUTS}\"|" /etc/default/keyboard + fi + + if [ -n "${LIVE_KEYBOARD_MODEL}" ] + then + echo "keyboard-configuration keyboard-configuration/modelcode select ${LIVE_KEYBOARD_MODEL}" >> /tmp/live-config.cfg + + sed -i -e "s|^XKBMODEL=.*$|XKBMODEL=\"${LIVE_KEYBOARD_MODEL}\"|" /etc/default/keyboard + fi + + if [ -n "${LIVE_KEYBOARD_OPTIONS}" ] + then + echo "keyboard-configuration keyboard-configuration/optionscode string ${LIVE_KEYBOARD_OPTIONS}" >> /tmp/live-config.cfg + + sed -i -e "s|^XKBOPTIONS=.*$|XKBOPTIONS=\"${LIVE_KEYBOARD_OPTIONS}\"|" /etc/default/keyboard + fi + + if [ -n "${LIVE_KEYBOARD_VARIANTS}" ] + then + echo "keyboard-configuration keyboard-configuration/variantcode select ${LIVE_KEYBOARD_VARIANTS}" >> /tmp/live-config.cfg + + sed -i -e "s|^XKBVARIANT=.*$|XKBVARIANT=\"${LIVE_KEYBOARD_VARIANTS}\"|" /etc/default/keyboard + fi + + if [ -e /tmp/live-config.cfg ] + then + debconf-set-selections < /tmp/live-config.cfg + rm -f /tmp/live-config.cfg + + # Creating state file + touch /var/lib/live/config/keyboard-configuration + fi +} + +Cmdline +Init +Config diff --git a/system-config/components/0160-sysvinit b/system-config/components/0160-sysvinit new file mode 100755 index 0000000..3831e37 --- /dev/null +++ b/system-config/components/0160-sysvinit @@ -0,0 +1,76 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nottyautologin|nottyautologin) + LIVE_CONFIG_NOTTYAUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables console autologin, no matter what mechanism + case "${LIVE_CONFIG_NOTTYAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/sysvinit.list ] || \ + [ -e /var/lib/live/config/sysvinit ] + then + exit 0 + fi + + echo -n " sysvinit" +} + +Config () +{ + # Configure autologin + if [ -n "${LIVE_USERNAME}" ] + then + sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(ttyS\?[0-9]*\).*$|\1:/bin/login -f ${LIVE_USERNAME} </dev/\2 >/dev/\2 2>\&1|" /etc/inittab + + init q + fi + + # Creating state file + touch /var/lib/live/config/sysvinit +} + +Cmdline +Init +Config diff --git a/system-config/components/0170-systemd b/system-config/components/0170-systemd new file mode 100755 index 0000000..42999bc --- /dev/null +++ b/system-config/components/0170-systemd @@ -0,0 +1,96 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.debug|debug) + LIVE_CONFIG_DEBUG="true" + ;; + + live-config.noautologin|noautologin) + LIVE_CONFIG_NOAUTOLOGIN="true" + ;; + + live-config.nottyautologin|nottyautologin) + LIVE_CONFIG_NOTTYAUTOLOGIN="true" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Disables both console and graphical autologin. + case "${LIVE_CONFIG_NOAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Disables console autologin, no matter what mechanism + case "${LIVE_CONFIG_NOTTYAUTOLOGIN}" in + true) + exit 0 + ;; + esac + + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/systemd.list ] || \ + [ -e /var/lib/live/config/systemd ] + then + exit 0 + fi + + echo -n " systemd" +} + +Config () +{ + # Configure autologin + if [ -n "${LIVE_USERNAME}" ] + then + for NUMBER in $(seq 1 6) + do + mkdir -p /etc/systemd/system/getty@tty${NUMBER}.service.d + +cat > /etc/systemd/system/getty@tty${NUMBER}.service.d/live-config_autologin.conf << EOF +[Service] +Type=idle +ExecStart= +ExecStart=-/sbin/agetty --autologin ${LIVE_USERNAME} --noclear %I \$TERM +EOF + + case "${LIVE_CONFIG_DEBUG}" in + true) + echo "TTYVTDisallocate=no" >> /etc/systemd/system/getty@tty${NUMBER}.service.d/live-config_autologin.conf + ;; + esac + done + + systemctl --no-block daemon-reload + fi + + # Creating state file + touch /var/lib/live/config/systemd +} + +Cmdline +Init +Config diff --git a/system-config/components/0180-sysv-rc b/system-config/components/0180-sysv-rc new file mode 100755 index 0000000..96f803d --- /dev/null +++ b/system-config/components/0180-sysv-rc @@ -0,0 +1,55 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.sysv-rc=*|sysv-rc=*) + LIVE_SYSV_RC="${_PARAMETER#*sysv-rc=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/sysv-rc.list ] || \ + [ -e /var/lib/live/config/sysv-rc ] + then + exit 0 + fi + + echo -n " sysv-rc" +} + +Config () +{ + if [ -n "${LIVE_SYSV_RC}" ] + then + for _SERVICE in $(echo ${LIVE_SYSV_RC} | sed -e 's|,| |g') + do + update-rc.d -f ${_SERVICE} remove | \ + grep -v "update-rc.d: using dependency based boot sequencing" || true + done + fi + + # Creating state file + touch /var/lib/live/config/sysv-rc +} + +Cmdline +Init +Config diff --git a/system-config/components/1010-apport b/system-config/components/1010-apport new file mode 100755 index 0000000..1f89439 --- /dev/null +++ b/system-config/components/1010-apport @@ -0,0 +1,35 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/apport.list ] || \ + [ -e /var/lib/live/config/apport ] + then + exit 0 + fi + + echo -n " apport" +} + +Config () +{ + # Enabling detection of crashes + sed -i -e 's|enabled=0|enabled=1|' /etc/default/apport + + # Creating state file + touch /var/lib/live/config/apport +} + +Init +Config diff --git a/system-config/components/1020-gnome-panel-data b/system-config/components/1020-gnome-panel-data new file mode 100755 index 0000000..bb71df0 --- /dev/null +++ b/system-config/components/1020-gnome-panel-data @@ -0,0 +1,48 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/gnome-panel-data.list ] || \ + [ -e /var/lib/live/config/gnome-panel-data ] + then + exit 0 + fi + + echo -n " gnome-panel-data" +} + +Config () +{ + sudo -u "${LIVE_USERNAME}" gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true + + # Creating state file + touch /var/lib/live/config/gnome-panel-data +} + +Cmdline +Init +Config diff --git a/system-config/components/1030-gnome-power-manager b/system-config/components/1030-gnome-power-manager new file mode 100755 index 0000000..190a4d4 --- /dev/null +++ b/system-config/components/1030-gnome-power-manager @@ -0,0 +1,50 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/gnome-power-manager.list ] || \ + [ -e /var/lib/live/config/gnome-power-manager ] + then + exit 0 + fi + + echo -n " gnome-power-manager" +} + +Config () +{ + # Not authorizing the user to hibernate the computer + # (might damage existing swap partitions). + sudo -u "${LIVE_USERNAME}" gconftool-2 -s -t bool /apps/gnome-power-manager/general/can_hibernate false + + # Creating state file + touch /var/lib/live/config/gnome-power-manager +} + +Cmdline +Init +Config diff --git a/system-config/components/1040-gnome-screensaver b/system-config/components/1040-gnome-screensaver new file mode 100755 index 0000000..8b2a647 --- /dev/null +++ b/system-config/components/1040-gnome-screensaver @@ -0,0 +1,49 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/gnome-screensaver.list ] || \ + [ -e /var/lib/live/config/gnome-screensaver ] + then + exit 0 + fi + + echo -n " gnome-screensaver" +} + +Config () +{ + # Disabling to lock the screen when the screensaver goes active. + sudo -u "${LIVE_USERNAME}" dbus-launch --exit-with-session gsettings set org.gnome.desktop.screensaver lock-enabled false + + # Creating state file + touch /var/lib/live/config/gnome-screensaver +} + +Cmdline +Init +Config diff --git a/system-config/components/1050-kaboom b/system-config/components/1050-kaboom new file mode 100755 index 0000000..e8658a2 --- /dev/null +++ b/system-config/components/1050-kaboom @@ -0,0 +1,48 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/kaboom.list ] || \ + [ -e /var/lib/live/config/kaboom ] + then + exit 0 + fi + + echo -n " kaboom" +} + +Config () +{ + sudo -u "${LIVE_USERNAME}" sh -c "mkdir -p /home/${LIVE_USERNAME}/.local && touch /home/${LIVE_USERNAME}/.local/kaboom" + + # Creating state file + touch /var/lib/live/config/kaboom +} + +Cmdline +Init +Config diff --git a/system-config/components/1060-kde-services b/system-config/components/1060-kde-services new file mode 100755 index 0000000..f287391 --- /dev/null +++ b/system-config/components/1060-kde-services @@ -0,0 +1,96 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.keyboard-layouts=*|keyboard-layouts=*) + LIVE_KEYBOARD_LAYOUTS="${_PARAMETER#*keyboard-layouts=}" + ;; + + live-config.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /usr/bin/kwriteconfig ] || \ + [ -e /var/lib/live/config/kde-services ] + then + exit 0 + fi + + echo -n " kde-services" +} + +Config () +{ + # Enabling keyboard selector + if echo "${LIVE_KEYBOARD_LAYOUTS}" | grep -qs ',' + then + if [ ! -e "/home/${LIVE_USERNAME}/.kde/share/config/kxkbrc" ] + then + mkdir -p "/home/${LIVE_USERNAME}/.kde/share/config/" + +cat > "/home/${LIVE_USERNAME}/.kde/share/config/kxkbrc" << EOF +[Layout] +DisplayNames=${LIVE_KEYBOARD_LAYOUTS} +IndicatorOnly=false +LayoutList=${LIVE_KEYBOARD_LAYOUTS} +ShowFlag=false +SwitchMode=Global +Use=true +EOF + + chown ${LIVE_USERNAME}:${LIVE_USERNAME} "/home/${LIVE_USERNAME}/.kde" -R + fi + fi + + # Disable addressbook migrator + sudo -u "${LIVE_USERNAME}" kwriteconfig --file kres-migratorrc --group Migration --key Enabled --type bool false + + # Disable korganizer reminder daemon + sudo -u "${LIVE_USERNAME}" kwriteconfig --file korgacrc --group "General" --key "Autostart" --type bool false + sudo -u "${LIVE_USERNAME}" kwriteconfig --file korgacrc --group "General" --key "Enabled" --type bool false + + # Disable nepomuk + sudo -u "${LIVE_USERNAME}" kwriteconfig --file nepomukserverrc --group "Basic Settings" --key "Start Nepomuk" --type bool false + + # Disbable nepomuk krunner plugin (depends on nepomuk) + #sudo -u "${LIVE_USERNAME}" kwriteconfig --file krunnerrc --group "Plugins" --key "nepomuksearchEnabled" --type bool false + + # Disable freespace notifier + sudo -u "${LIVE_USERNAME}" kwriteconfig --file kdedrc --group Module-freespacenotifier --key autoload --type bool false + + # Disable searching contacts through krunner (depends on akonadi) + sudo -u "${LIVE_USERNAME}" kwriteconfig --file krunnerrc --group "Plugins" --key "kabccontactsEnabled" --type bool false + + # Disable searching calendar events through krunner (depends on akonadi) + sudo -u "${LIVE_USERNAME}" kwriteconfig --file krunnerrc --group "Plugins" --key "org.kde.events_runnerEnabled" --type bool false + + # should enable kxkb in ~/.kde/share/config/kxkbrc + # if multiple layouts are specified. gnome does it per default. + + # Creating state file + touch /var/lib/live/config/kde-services +} + +Cmdline +Init +Config diff --git a/system-config/components/1080-policykit b/system-config/components/1080-policykit new file mode 100755 index 0000000..9a154ec --- /dev/null +++ b/system-config/components/1080-policykit @@ -0,0 +1,105 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 +<?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> +EOF + + if [ -n "${LIVE_USERNAME}" ] + then + +cat >> /etc/PolicyKit/PolicyKit.conf << EOF + <!-- don't ask password for user in live session --> + <match user="${LIVE_USERNAME}"> + <return result="yes"/> + </match> +EOF + + fi + +cat >> /etc/PolicyKit/PolicyKit.conf << EOF + <define_admin_auth group="adm"/> +</config> +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 diff --git a/system-config/components/1090-ssl-cert b/system-config/components/1090-ssl-cert new file mode 100755 index 0000000..2e065ac --- /dev/null +++ b/system-config/components/1090-ssl-cert @@ -0,0 +1,37 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 + +Init () +{ + # Checking if package is installed + if [ ! -e /var/lib/dpkg/info/ssl-cert.list ] || \ + [ -e /var/lib/live/config/ssl-cert ] + then + exit 0 + fi + + echo -n " ssl-cert" +} + +Config () +{ + if [ ! -e /etc/ssl/certs/ssl-cert-snakeoil.pem ] && [ ! -e /etc/ssl/private/ssl-cert-snakeoil.key ] + then + make-ssl-cert generate-default-snakeoil --force-overwrite + fi + + # Creating state file + touch /var/lib/live/config/ssl-cert +} + +Init +Config diff --git a/system-config/components/1110-anacron b/system-config/components/1110-anacron new file mode 100755 index 0000000..5b18be0 --- /dev/null +++ b/system-config/components/1110-anacron @@ -0,0 +1,43 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 + +Init () +{ + # Checking if package is installed + if [ ! -e /var/lib/dpkg/info/anacron.list ] || \ + [ -e /var/lib/live/config/anacron ] + then + exit 0 + fi + + echo -n " anacron" +} + +Config () +{ + # This has the nice side effect of the cron.{daily,weekly,monthly} jobs + # in /etc/crontab remaining disabled, yet also not run by anacron + + # Diverting /usr/sbin/anacron + if [ ! -e /usr/sbin/anacron.orig.anacron ] + then + dpkg-divert --quiet --package live-config --add --rename --divert /usr/sbin/anacron.orig.anacron /usr/sbin/anacron + + ln -s /bin/true /usr/sbin/anacron + fi + + # Creating state file + touch /var/lib/live/config/anacron +} + +Init +Config diff --git a/system-config/components/1120-util-linux b/system-config/components/1120-util-linux new file mode 100755 index 0000000..8bb45e5 --- /dev/null +++ b/system-config/components/1120-util-linux @@ -0,0 +1,73 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.utc=*|utc=*) + LIVE_UTC="${_PARAMETER#*utc=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed + if [ ! -e /var/lib/dpkg/info/util-linux.list ] || \ + [ -e /var/lib/live/config/util-linux ] + then + exit 0 + fi + + echo -n " util-linux" +} + +Config () +{ + rm -f /etc/rc?.d/*hwclock* + + if [ -n "${LIVE_UTC}" ] + then + case "${LIVE_UTC}" in + yes) + +cat > /etc/adjtime << EOF +0.0 0 0.0 +0 +UTC +EOF + + ;; + + no) + +cat > /etc/adjtime << EOF +0.0 0 0.0 +0 +LOCAL +EOF + + ;; + esac + fi + + # Creating state file + touch /var/lib/live/config/util-linux +} + +Cmdline +Init +Config diff --git a/system-config/components/1130-login b/system-config/components/1130-login new file mode 100755 index 0000000..616f473 --- /dev/null +++ b/system-config/components/1130-login @@ -0,0 +1,35 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 + +Init () +{ + # Checking if package is installed + if [ ! -e /var/lib/dpkg/info/login.list ] || \ + [ -e /var/lib/live/config/login ] + then + exit 0 + fi + + echo -n " login" +} + +Config () +{ + # lastlog with autologin doesn't make sense + sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /etc/pam.d/login + + # Creating state file + touch /var/lib/live/config/login +} + +Init +Config diff --git a/system-config/components/1140-xserver-xorg b/system-config/components/1140-xserver-xorg new file mode 100755 index 0000000..529d78a --- /dev/null +++ b/system-config/components/1140-xserver-xorg @@ -0,0 +1,232 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 () +{ + for _PARAMETER in ${LIVE_CONFIG_CMDLINE} + do + case "${_PARAMETER}" in + live-config.keyboard-layouts=*|keyboard-layouts=*) + LIVE_KEYBOARD_LAYOUTS="${_PARAMETER#*keyboard-layouts=}" + ;; + + live-config.keyboard-model=*|keyboard-model=*) + LIVE_KEYBOARD_MODEL="${_PARAMETER#*keyboard-model=}" + ;; + + live-config.keyboard-options=*|keyboard-options=*) + LIVE_KEYBOARD_OPTIONS="${_PARAMETER#*keyboard-options=}" + ;; + + live-config.keyboard-variants=*|keyboard-variants=*) + LIVE_KEYBOARD_VARIANTS="${_PARAMETER#*keyboard-variants=}" + ;; + + live-config.xorg-xsession-manager=*|x-session-manager=*) + LIVE_X_SESSION_MANAGER="${_PARAMETER#*x-session-manager=}" + ;; + + live-config.xorg-driver=*|xorg-driver=*) + LIVE_XORG_DRIVER="${_PARAMETER#*xorg-driver=}" + ;; + + live-config.xorg-resolution=*|xorg-resolution=*) + LIVE_XORG_RESOLUTION="${_PARAMETER#*xorg-resolution=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed + if [ ! -e /var/lib/dpkg/info/xserver-xorg.list ] || \ + [ -e /var/lib/live/config/xserver-xorg ] + then + exit 0 + fi + + echo -n " xserver-xorg" +} + +Config () +{ + if [ -n "${LIVE_KEYBOARD_MODEL}" ] + then + echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/model select ${LIVE_KEYBOARD_MODEL}" >> /tmp/live-config.cfg + fi + + if [ -n "${LIVE_KEYBOARD_LAYOUTS}" ] + then + echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/layout select ${LIVE_KEYBOARD_LAYOUTS}" >> /tmp/live-config.cfg + fi + + if [ -n "${LIVE_KEYBOARD_VARIANTS}" ] + then + echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/variant select ${LIVE_KEYBOARD_VARIANTS}" >> /tmp/live-config.cfg + fi + + if [ -n "${LIVE_KEYBOARD_OPTIONS}" ] + then + echo "xserver-xorg xserver-xorg/config/inputdevice/keyboard/options string ${LIVE_KEYBOARD_OPTIONS}" >> /tmp/live-config.cfg + fi + + if [ -n "${LIVE_X_SESSION_MANAGER}" ] + then + case "${LIVE_X_SESSION_MANAGER}" in + none) + _DM_FILE="/etc/X11/default-display-manager" + if [ -e "${_DM_FILE}" ] + then + sed -i "s|\(.*\)|\1 # disabled by live-config:|" -- "${_DM_FILE}" + fi + ;; + + *) + update-alternatives --quiet --set x-session-manager "${LIVE_X_SESSION_MANAGER}" + ;; + esac + fi + + if [ -z "${LIVE_XORG_DRIVER}" ] && [ -e /usr/bin/lspci ] + then + # pci-id of the first graphic card + _DEVICE="$(lspci -mn | awk '/0300/ { print $3$4 }' | sed -e 's|\"||g' | tr [a-z] [A-Z] | head -n1)" + + if [ -n "${_DEVICE}" ] + then + if ls /usr/share/live/config/xserver-xorg/*.ids > /dev/null 2>&1 + then + # xorg-driver manual overrides + for _OVERRIDE_IDS in /usr/share/live/config/xserver-xorg/*.ids + do + if [ -e "${_OVERRIDE_IDS}" ] + then + if grep -qs "${_DEVICE}" "${_OVERRIDE_IDS}" + then + LIVE_XORG_DRIVER="$(basename ${_OVERRIDE_IDS} .ids)" + + break + fi + fi + done + fi + + if [ -z "${LIVE_XORG_DRIVER}" ] + then + # xorg-driver automatic override for virtualbox + if [ -e /var/lib/dpkg/info/virtualbox-guest-x11.list ] && echo "${_DEVICE}" | grep -qs '^80EEBEEF' + then + LIVE_XORG_DRIVER="vboxvideo" + fi + + # xorg-driver automatic override for fglrx + if echo "${_DEVICE}" | grep -qs '^1002' + then + if grep -qs "${_DEVICE}" /usr/share/fglrx/fglrx.ids + then + LIVE_XORG_DRIVER="fglrx" + fi + fi + + # xorg-driver automatic override for nvidia + if echo "${_DEVICE}" | grep -qs -E '^(10DE|12D2)' + then + for _NVIDIA_IDS in /usr/lib/nvidia/current/nvidia.ids $(ls /usr/lib/nvidia/legacy-*/nvidia.ids | sort -V -r) + do + if [ -e "${_NVIDIA_IDS}" ] + then + if grep -qs "${_DEVICE}" ${_NVIDIA_IDS} + then + _NVIDIA_VERSION="$(basename $(dirname ${_NVIDIA_IDS}))" + _NVIDIA_MODULE="$(echo nvidia-${_NVIDIA_VERSION} | sed -e 's|-current$||')" + + break + fi + fi + done + + if [ -n "${_NVIDIA_VERSION}" ] + then + LIVE_XORG_DRIVER="nvidia" + fi + fi + fi + fi + fi + + if [ -n "${LIVE_XORG_DRIVER}" ] + then + mkdir -p /etc/X11/xorg.conf.d + + if [ -e "/usr/share/live/config/xserver-xorg/${LIVE_XORG_DRIVER}.conf" ] + then + # xorg-driver manual override + cp "/usr/share/live/config/xserver-xorg/${LIVE_XORG_DRIVER}.conf" /etc/X11/xorg.conf.d/zz-live-config_xserver-xorg.conf + else + + # xorg-driver automatic override + +cat > /etc/X11/xorg.conf.d/zz-live-config_xserver-xorg.conf << EOF +Section "Device" + Identifier "Default screen" + Driver "${LIVE_XORG_DRIVER}" +EndSection +EOF + + fi + + case "${LIVE_XORG_DRIVER}" in + fglrx) + update-alternatives --quiet --set glx /usr/lib/fglrx + + modprobe --ignore-install fglrx || true + ;; + + nvidia) + update-alternatives --quiet --set glx /usr/lib/nvidia + update-alternatives --quiet --set nvidia /usr/lib/nvidia/${_NVIDIA_VERSION:-current} + + modprobe --ignore-install ${_NVIDIA_MODULE:-nvidia} || true + ;; + + *) + update-alternatives --quiet --set glx /usr/lib/mesa-diverted + ;; + esac + fi + + if [ -n "${LIVE_XORG_RESOLUTION}" ] + then + echo "xrandr -s ${LIVE_XORG_RESOLUTION} || /bin/true" >> /etc/X11/Xsession.d/21xvidemode + else + rm -f /etc/X11/Xsession.d/21xvidemode + fi + + if [ -e /tmp/live-config.cfg ] + then + debconf-set-selections < /tmp/live-config.cfg + rm -f /tmp/live-config.cfg + + dpkg-reconfigure -f noninteractive -p critical \ + xserver-xorg 2>&1 \ + | grep -v "overwriting possibly-customised configuration" \ + | grep -v "file; backup in /etc/X11/xorg.conf" || true + + # Creating state file + touch /var/lib/live/config/xserver-xorg + fi +} + +Cmdline +Init +Config diff --git a/system-config/components/1160-openssh-server b/system-config/components/1160-openssh-server new file mode 100755 index 0000000..80bc201 --- /dev/null +++ b/system-config/components/1160-openssh-server @@ -0,0 +1,49 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/openssh-server.list ] || \ + [ -e /var/lib/live/config/openssh-server ] + then + exit 0 + fi + + echo -n " openssh-server" +} + +Config () +{ + for _PROTOCOL in dsa rsa ecdsa ed25519 + do + if [ ! -e /etc/ssh/ssh_host_${_PROTOCOL}_key ] && + grep -qs ssh_host_${_PROTOCOL}_key /etc/ssh/sshd_config + then + ssh-keygen -q -f /etc/ssh/ssh_host_${_PROTOCOL}_key -N "" -t ${_PROTOCOL} + + _SSH="true" + fi + done + + sed -i -e 's|#\(PasswordAuthentication\) yes|\1 no|' /etc/ssh/sshd_config + + case "${_SSH}" in + true) + # Creating state file + touch /var/lib/live/config/openssh-server + ;; + esac +} + +Init +Config diff --git a/system-config/components/1170-xfce4-panel b/system-config/components/1170-xfce4-panel new file mode 100755 index 0000000..447cad8 --- /dev/null +++ b/system-config/components/1170-xfce4-panel @@ -0,0 +1,52 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/xfce4-panel.list ] || \ + [ -e /var/lib/live/config/xfce4-panel ] + then + exit 0 + fi + + echo -n " xfce4-panel" +} + +Config () +{ + if [ ! -e /home/"${LIVE_USERNAME}"/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml ] + then + sudo -u "${LIVE_USERNAME}" mkdir -p /home/"${LIVE_USERNAME}"/.config/xfce4/xfconf/xfce-perchannel-xml + sudo -u "${LIVE_USERNAME}" cp /etc/xdg/xfce4/panel/default.xml /home/"${LIVE_USERNAME}"/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml + fi + + # Creating state file + touch /var/lib/live/config/xfce4-panel +} + +Cmdline +Init +Config diff --git a/system-config/components/1180-xscreensaver b/system-config/components/1180-xscreensaver new file mode 100755 index 0000000..b4ecdf3 --- /dev/null +++ b/system-config/components/1180-xscreensaver @@ -0,0 +1,51 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.username=*|username=*) + LIVE_USERNAME="${_PARAMETER#*username=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed or already configured + if [ ! -e /var/lib/dpkg/info/xscreensaver.list ] || \ + [ -e /var/lib/live/config/xscreensaver ] + then + exit 0 + fi + + echo -n " xscreensaver" +} + +Config () +{ + if ! grep -qs '^lock:' "/home/${LIVE_USERNAME}/.xscreensaver" + then + echo "lock: False" >> "/home/${LIVE_USERNAME}/.xscreensaver" + fi + + # Creating state file + touch /var/lib/live/config/xscreensaver +} + +Cmdline +Init +Config diff --git a/system-config/components/1190-broadcom-sta b/system-config/components/1190-broadcom-sta new file mode 100755 index 0000000..6f27f7f --- /dev/null +++ b/system-config/components/1190-broadcom-sta @@ -0,0 +1,114 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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 () +{ + for _PARAMETER in ${LIVE_CONFIG_CMDLINE} + do + case "${_PARAMETER}" in + live-config.wlan-driver=*|wlan-driver=*) + LIVE_WLAN_DRIVER="${_PARAMETER#*wlan-driver=}" + ;; + esac + done +} + +Init () +{ + # Checking if package is installed + if [ ! -e /var/lib/dpkg/info/broadcom-sta-common.list ] || \ + [ -e /var/lib/live/config/broadcom-sta-common ] + then + exit 0 + fi + + echo -n " broadcom-sta-common" +} + +Config () +{ + if [ -z "${LIVE_WLAN_DRIVER}" ] && [ -e /usr/bin/lspci ] + then + # pci-id of pci class "network controller" subclass "network controller" + _DEVICE="$(lspci -mn | awk '$2 == "\"0280\"" { gsub ("\"",""); print $3$4 }' | uniq)" + + if [ -n "${_DEVICE}" ] + then + if ls /usr/share/live/config/broadcom-sta/*.ids > /dev/null 2>&1 + then + # wlan-driver manual overrides + for _OVERRIDE_IDS in /usr/share/live/config/broadcom-sta/*.ids + do + if [ -e "${_OVERRIDE_IDS}" ] + then + if grep -qs "${_DEVICE}" "${_OVERRIDE_IDS}" + then + LIVE_WLAN_DRIVER="$(basename ${_OVERRIDE_IDS} .ids)" + + break + fi + fi + done + fi + + if [ -z "${LIVE_WLAN_DRIVER}" ] + then + # wlan-driver automatic override for broadcom-sta + if echo "${_DEVICE}" | grep -qs '^14e4' + then + if grep -qs "${_DEVICE}" /usr/share/broadcom-sta/broadcom-sta.ids + then + LIVE_WLAN_DRIVER="broadcom-sta" + fi + fi + fi + fi + fi + + if [ -n "${LIVE_WLAN_DRIVER}" ] + then + mkdir -p /etc/modprobe.d + + if [ -e "/usr/share/live/config/broadcom-sta/${LIVE_WLAN_DRIVER}.conf" ] + then + # wlan-driver manual override + cp "/usr/share/live/config/broadcom-sta/${LIVE_WLAN_DRIVER}.conf" /etc/modprobe.d/broadcom-sta-dkms.conf + else + # wlan-driver automatic override + if [ -e /etc/modprobe.d/broadcom-sta-dkms.conf ] + then + case "${LIVE_WLAN_DRIVER}" in + broadcom-sta) + sed -i -e 's|^ *blacklist|# blacklist|' /etc/modprobe.d/broadcom-sta-dkms.conf + + if ! grep -qs "^blacklist wl" /etc/modprobe.d/broadcom-sta-dkms.conf + then + echo "blacklist wl" >> /etc/modprobe.d/broadcom-sta-dkms.conf + fi + ;; + + *) + sed -i -e 's|^# *blacklist|blacklist|g' /etc/modprobe.d/broadcom-sta-dkms.conf + sed -i -e 's|^blacklist wl|#blacklist wl|g' /etc/modprobe.d/broadcom-sta-dkms.conf + ;; + esac + fi + fi + + # Creating state file + touch /var/lib/live/config/broadcom-sta + fi +} + +Cmdline +Init +Config diff --git a/system-config/components/9990-hooks b/system-config/components/9990-hooks new file mode 100755 index 0000000..26d071d --- /dev/null +++ b/system-config/components/9990-hooks @@ -0,0 +1,84 @@ +#!/bin/sh + +## live-config(7) - System Configuration Components +## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch> +## +## 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.hooks=*|hooks=*) + LIVE_HOOKS="${_PARAMETER#*hooks=}" + ;; + esac + done +} + +Init () +{ + if [ -z "${LIVE_HOOKS}" ] + then + exit 0 + fi + + echo -n " hooks" +} + +Config () +{ + for _HOOK in $(echo ${LIVE_HOOKS} | sed -e 's/|/ /g') + do + case "${_HOOK}" in + filesystem) + if ls /lib/live/config-hooks/* 2>&1 + then + _HOOKS="${_HOOKS} $(for _FILE in /lib/live/config-hooks/*; do echo file://${_FILE}; done)" + fi + ;; + + medium) + if ls /lib/live/mount/medium/live/config-hooks/* 2>&1 + then + _HOOKS="${_HOOKS} $(for _FILE in /lib/live/mount/medium/live/config-hooks/*; do echo file://${_FILE}; done)" + fi + ;; + + *) + _HOOKS="${_HOOKS} ${_HOOK}" + ;; + esac + done + + for _HOOK in ${_HOOKS} + do + _TMPFILE="$(mktemp -t live-config.XXXXXXXX)" + + if echo "${_HOOK}" | grep -qs file:// + then + # local file + cp $(echo ${_HOOK} | sed 's|file://||') "${_TMPFILE}" + else + # remote file + Setup_network + + wget --quiet "${_HOOK}" -O "${_TMPFILE}" + fi + + chmod 0755 "${_TMPFILE}" + "${_TMPFILE}" + rm -f "${_TMPFILE}" + done +} + +Cmdline +Init +Config |