[SCM] live-config branch, debian, updated. debian/3.0_a39-1-3-g2bf4f94

Daniel Baumann daniel at debian.org
Thu Jun 14 06:03:05 UTC 2012


The following commit has been merged in the debian branch:
commit 7cd1de7edeed61b66c76db496730a9dee39661b0
Author: Daniel Baumann <daniel at debian.org>
Date:   Wed Jun 13 19:26:39 2012 +0200

    Integrating debconf backend into live-config.

diff --git a/Makefile b/Makefile
index ae3d0c9..0e1fd75 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,9 @@ build:
 
 install:
 	# Installing backends
+	mkdir -p $(DESTDIR)/lib/live
+	cp -a backends/debconf $(DESTDIR)/lib/live/debconfig
+
 	mkdir -p $(DESTDIR)/etc/init.d
 	cp backends/sysvinit/live-config.init $(DESTDIR)/etc/init.d/live-config
 	cp backends/sysvinit/live.init $(DESTDIR)/etc/init.d/live
@@ -68,6 +71,9 @@ install:
 
 	cp bin/boot-init.sh $(DESTDIR)/lib/live
 
+	mkdir -p $(DESTDIR)/sbin
+	cp bin/live-debconfig $(DESTDIR)/sbin
+
 	# Installing docs
 	mkdir -p $(DESTDIR)/usr/share/doc/live-config
 	cp -r COPYING examples $(DESTDIR)/usr/share/doc/live-config
diff --git a/backends/debconf/001-hostname b/backends/debconf/001-hostname
new file mode 100755
index 0000000..5364b1a
--- /dev/null
+++ b/backends/debconf/001-hostname
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+Defaults ()
+{
+	if [ -z "${_HOSTNAME}" ]
+	then
+		if [ -n "$(cat /etc/hostname 2> /dev/null)" ]
+		then
+			_HOSTNAME="$(cat /etc/hostname)"
+		elif [ -x /usr/bin/lsb_release ]
+		then
+			_HOSTNAME="$(lsb_release -is | tr [A-Z] [a-z])"
+		elif [ -e /etc/progress_version ]
+		then
+			_HOSTNAME="progress"
+		else
+			_HOSTNAME="debian"
+		fi
+	fi
+}
+
+db_get live-debconfig/hostname/hostname
+_HOSTNAME="${RET}" # string (w/o empty)
+
+Defaults
+
+db_set live-debconfig/hostname/hostname "${_HOSTNAME}"
+db_fset live-debconfig/hostname/hostname seen false
+
+db_settitle live-debconfig/title
+db_input high live-debconfig/hostname/hostname || true
+db_go
+
+db_get live-debconfig/hostname/hostname
+_HOSTNAME="${RET}" # string (w/o empty)
+
+Defaults
+
+db_stop
+
+# Set the hostname
+echo "${_HOSTNAME}" > /etc/hostname
diff --git a/backends/debconf/001-hostname.templates b/backends/debconf/001-hostname.templates
new file mode 100644
index 0000000..359572f
--- /dev/null
+++ b/backends/debconf/001-hostname.templates
@@ -0,0 +1,12 @@
+Template: live-debconfig/title
+Type: title
+Description: live-debconfig: System Configuration
+
+Template: live-debconfig/hostname/hostname
+Type: string
+Default: debian
+Description: live-debconfig: Hostname?
+ What should be the hostname of the current system?
+ .
+ This defaults to either /etc/hostname (if present), is automatically guessed
+ through lsb_release (if present), or otherwise set to 'debian'.
diff --git a/backends/debconf/002-ifupdown b/backends/debconf/002-ifupdown
new file mode 100755
index 0000000..bc3d129
--- /dev/null
+++ b/backends/debconf/002-ifupdown
@@ -0,0 +1,241 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+Defaults ()
+{
+	_ETH0_METHOD="${_ETH0_METHOD:-dhcp}"
+	_ETH0_ADDRESS="${_ETH0_ADDRESS:-192.168.1.2}"
+	_ETH0_BROADCAST="${_ETH0_BROADCAST:-192.168.1.0}"
+	_ETH0_GATEWAY="${_ETH0_GATEWAY:-192.168.1.1}"
+	_ETH0_NETMASK="${_ETH0_NETMASK:-255.255.255.0}"
+	_ETH0_NETWORK="${_ETH0_NETWORK:-192.168.1.255}"
+	_ETH0_NAMESERVERS="${_ETH0_NAMESERVERS:-192.168.1.1}"
+}
+
+#db_get live-debconfig/ifupdown/eth0-method
+#_ETH0_METHOD="${RET}" # select
+
+Defaults
+
+db_set live-debconfig/ifupdown/eth0-method "${_ETH0_METHOD}"
+db_fset live-debconfig/ifupdown/eth0-method seen false
+
+db_set live-debconfig/ifupdown/eth0-address "${_ETH0_ADDRESS}"
+db_fset live-debconfig/ifupdown/eth0-address seen false
+
+db_set live-debconfig/ifupdown/eth0-broadcast "${_ETH0_BROADCAST}"
+db_fset live-debconfig/ifupdown/eth0-broadcast seen false
+
+db_set live-debconfig/ifupdown/eth0-gateway "${_ETH0_GATEWAY}"
+db_fset live-debconfig/ifupdown/eth0-gateway seen false
+
+db_set live-debconfig/ifupdown/eth0-netmask "${_ETH0_NETMASK}"
+db_fset live-debconfig/ifupdown/eth0-netmask seen false
+
+db_set live-debconfig/ifupdown/eth0-network "${_ETH0_NETWORK}"
+db_fset live-debconfig/ifupdown/eth0-network seen false
+
+db_set live-debconfig/ifupdown/nameservers "${_NAMESERVERS}"
+db_fset live-debconfig/ifupdown/nameservers seen false
+
+db_settitle live-debconfig/title
+db_input high live-debconfig/ifupdown/eth0-method || true
+db_go
+
+db_get live-debconfig/ifupdown/eth0-method
+_ETH0_METHOD="${RET}" # select
+
+case "${_ETH0_METHOD}" in
+	none)
+		db_stop
+
+		exit
+		;;
+
+	dhcp)
+
+		;;
+
+	static)
+		db_settitle live-debconfig/title
+		db_input high live-debconfig/ifupdown/eth0-address || true
+		db_go
+
+		db_settitle live-debconfig/title
+		db_input high live-debconfig/ifupdown/eth0-broadcast || true
+		db_go
+
+		db_settitle live-debconfig/title
+		db_input high live-debconfig/ifupdown/eth0-gateway || true
+		db_go
+
+		db_settitle live-debconfig/title
+		db_input high live-debconfig/ifupdown/eth0-netmask || true
+		db_go
+
+		db_settitle live-debconfig/title
+		db_input high live-debconfig/ifupdown/eth0-network || true
+		db_go
+
+		db_settitle live-debconfig/title
+		db_input high live-debconfig/ifupdown/nameservers || true
+		db_go
+		;;
+esac
+
+_NUMBER="0"
+
+while db_get live-debconfig/ifupdown/eth${_NUMBER}-method && [ "${RET}" ]
+do
+	if db_get live-debconfig/ifupdown/eth${_NUMBER}-comment
+	then
+		eval _ETH${_NUMBER}_COMMENT="\"${RET}\"" # string (w/ empty)
+	fi
+
+	if db_get live-debconfig/ifupdown/eth${_NUMBER}-method
+	then
+		eval _ETH${_NUMBER}_METHOD="\"${RET}\"" # select
+	fi
+
+	if db_get live-debconfig/ifupdown/eth${_NUMBER}-address
+	then
+		eval _ETH${_NUMBER}_ADDRESS="\"${RET}\"" # string (w/o empty)
+	fi
+
+	if db_get live-debconfig/ifupdown/eth${_NUMBER}-broadcast
+	then
+		eval _ETH${_NUMBER}_BROADCAST="\"${RET}\"" # string (w/ empty)
+	fi
+
+	if db_get live-debconfig/ifupdown/eth${_NUMBER}-gateway
+	then
+		eval _ETH${_NUMBER}_GATEWAY="\"${RET}\"" # string (w/ empty)
+	fi
+
+	if db_get live-debconfig/ifupdown/eth${_NUMBER}-netmask
+	then
+		eval _ETH${_NUMBER}_NETMASK="\"${RET}\"" # string (w/ empty)
+	fi
+
+	if db_get live-debconfig/ifupdown/eth${_NUMBER}-network
+	then
+		eval _ETH${_NUMBER}_NETWORK="\"${RET}\"" # string (w/ empty)
+	fi
+
+	_NUMBER="$((${_NUMBER} + 1))"
+done
+
+_ETH_NUMBER="${_NUMBER}"
+
+db_get live-debconfig/ifupdown/nameservers
+_NAMESERVERS="${RET}" # string (w/ empty)
+
+Defaults
+
+db_stop
+
+# Create /etc/network/interfaces
+
+cat > /etc/network/interfaces << EOF
+# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
+# /usr/share/doc/ifupdown/examples for more information.
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+EOF
+
+for _NUMBER in $(seq 0 ${_ETH_NUMBER})
+do
+	eval _COMMENT="$`echo _ETH${_NUMBER}_COMMENT`"
+	eval _METHOD="$`echo _ETH${_NUMBER}_METHOD`"
+	eval _ADDRESS="$`echo _ETH${_NUMBER}_ADDRESS`"
+	eval _BROADCAST="$`echo _ETH${_NUMBER}_BROADCAST`"
+	eval _GATEWAY="$`echo _ETH${_NUMBER}_GATEWAY`"
+	eval _NETMASK="$`echo _ETH${_NUMBER}_NETMASK`"
+	eval _NETWORK="$`echo _ETH${_NUMBER}_NETWORK`"
+
+	if [ -z "${_METHOD}" ]
+	then
+		continue
+	fi
+
+	echo >> /etc/network/interfaces
+
+	if [ -n "${_COMMENT}" ]
+	then
+		echo "# ${_COMMENT}" >> /etc/network/interfaces
+	fi
+
+	case "${_METHOD}" in
+		dhcp)
+
+cat >> /etc/network/interfaces << EOF
+auto eth${_NUMBER}
+iface eth${_NUMBER} inet dhcp
+EOF
+
+			;;
+
+		static)
+
+cat >> /etc/network/interfaces << EOF
+auto eth${_NUMBER}
+iface eth${_NUMBER} inet static
+	address		${_ADDRESS}
+EOF
+
+			if [ -n "${_BROADCAST}" ]
+			then
+				echo "	broadcast	${_BROADCAST}" >> /etc/network/interfaces
+			fi
+
+			if [ -n "${_GATEWAY}" ]
+			then
+				echo "	gateway		${_GATEWAY}" >> /etc/network/interfaces
+			fi
+
+			echo "	netmask		${_NETMASK}" >> /etc/network/interfaces
+
+			if [ -n "${_NETWORK}" ]
+			then
+				echo "	network		${_NETWORK}" >> /etc/network/interfaces
+			fi
+			;;
+	esac
+
+	_NUMBER="$((${_NUMBER} + 1))"
+done
+
+# Create /etc/resolv.conf
+if [ -n "${_NAMESERVERS}" ]
+then
+	rm -f /etc/resolv.conf
+
+	for _NAMESERVER in $(echo ${_NAMESERVERS} | sed -e 's|,| |g')
+	do
+		echo "nameserver ${_NAMESERVER}" >> /etc/resolv.conf
+	done
+fi
+
+# Create /etc/hosts
+case "${_ETH0_METHOD}" in
+	static)
+
+cat > /etc/hosts << EOF
+127.0.0.1	localhost
+${_ETH0_ADDRESS}	$(cat /etc/hostname)
+
+# The following lines are desirable for IPv6 capable hosts
+::1     ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+EOF
+
+		;;
+esac
diff --git a/backends/debconf/002-ifupdown.templates b/backends/debconf/002-ifupdown.templates
new file mode 100644
index 0000000..21f39ce
--- /dev/null
+++ b/backends/debconf/002-ifupdown.templates
@@ -0,0 +1,61 @@
+Template: live-debconfig/title
+Type: title
+Description: live-debconfig: System Configuration
+
+Template: live-debconfig/ifupdown/eth0-method
+Type: select
+Choices: dhcp, static, none
+Default: dhcp
+Description: live-debconfig: Interface Method?
+ What method should be used to configure the interface?
+ .
+ This defaults to dhcp and will require that you run a dhcp-server in your network.
+
+Template: live-debconfig/ifupdown/eth0-address
+Type: string
+Default: 192.168.1.2
+Description: live-debconfig: IP Address?
+ What should be the IP address of the current system?
+ .
+ This defaults to 192.168.1.2.
+
+Template: live-debconfig/ifupdown/eth0-broadcast
+Type: string
+Default: 192.168.1.255
+Description: live-debconfig: Broadcast Address?
+ What should be the broadcast address of the current system?
+ .
+ This defaults to 192.168.1.255 but can be left empty.
+
+Template: live-debconfig/ifupdown/eth0-gateway
+Type: string
+Default: 192.168.1.1
+Description: live-debconfig: Gateway Address?
+ What should be the gateway address of the current system?
+ .
+ This defaults to 192.168.1.1 but can be left empty.
+
+Template: live-debconfig/ifupdown/eth0-netmask
+Type: string
+Default: 255.255.255.0
+Description: live-debconfig: Network Mask?
+ What should be the netmask of the current system?
+ .
+ This defaults to 255.255.255.0.
+
+Template: live-debconfig/ifupdown/eth0-network
+Type: string
+Default: 192.168.1.0
+Description: live-debconfig: Network Address?
+ What should be the network address of the current system?
+ .
+ This defaults to 192.168.1.0 but can be left empty.
+
+Template: live-debconfig/ifupdown/nameservers
+Type: string
+Default: 192.168.1.1
+Description: live-debconfig: Nameserver Addresses?
+ What should be the IP addresses of the nameservers of the current system?
+ .
+ This defaults to 192.168.1.1 but can be left empty.
+ Multiple nameservers can be separated by whitespace.
diff --git a/backends/debconf/003-openssh-server b/backends/debconf/003-openssh-server
new file mode 100755
index 0000000..fcd54dc
--- /dev/null
+++ b/backends/debconf/003-openssh-server
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Recreating openssh-server host keys
+for _PROTOCOL in dsa rsa ecdsa
+do
+	if [ ! -e /etc/ssh/ssh_host_${_PROTOCOL}_key ] && \
+	   grep -qs "ssh_host_${_PROTOCOL}_key" /etc/ssh/sshd_config
+	then
+		if [ -x /usr/bin/ssh-keygen ]
+		then
+			echo -n "P: Creating files /etc/ssh/ssh_host_${_PROTOCOL}_key /etc/ssh/ssh_host_${_PROTOCOL}_key.pub..."
+
+			ssh-keygen -q -f /etc/ssh/ssh_host_${_PROTOCOL}_key -N "" -t ${_PROTOCOL}
+		fi
+	fi
+done
diff --git a/backends/debconf/003-openssh-server.templates b/backends/debconf/003-openssh-server.templates
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/backends/debconf/003-openssh-server.templates
@@ -0,0 +1 @@
+
diff --git a/backends/debconf/004-selinux b/backends/debconf/004-selinux
new file mode 100755
index 0000000..840e7ca
--- /dev/null
+++ b/backends/debconf/004-selinux
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+Defaults ()
+{
+	if [ -z "${_ENABLE}" ]
+	then
+		if [ -n "$(cat /selinux/enforce 2> /dev/null)" ]
+		then
+			case "$(cat /selinux/enforce 2> /dev/null)" in
+				0)
+					_ENABLE="false"
+					;;
+
+				1)
+					_ENABLE="true"
+					;;
+			esac
+		else
+			_ENABLE="false"
+		fi
+	fi
+}
+
+#db_get live-debconfig/selinux/enable
+#_ENABLE="${RET}" # boolean
+
+Defaults
+
+db_set live-debconfig/selinux/enable "${_ENABLE}"
+db_fset live-debconfig/selinux/enable seen false
+
+db_settitle live-debconfig/title
+db_input high live-debconfig/selinux/enable || true
+db_go
+
+db_get live-debconfig/selinux/enable
+_ENABLE="${RET}" # boolean
+
+#Defaults
+
+db_stop
+
+case "${_ENABLE}" in
+	true)
+		rm -f /selinux/enforce
+		rmdir --ignore-fail-on-non-empty /selinux > /dev/null 2>&1 || true
+		;;
+
+	false)
+		mkdir -p /selinux
+		echo 0 > /selinux/enforce
+		;;
+esac
diff --git a/backends/debconf/004-selinux.templates b/backends/debconf/004-selinux.templates
new file mode 100644
index 0000000..8c7363c
--- /dev/null
+++ b/backends/debconf/004-selinux.templates
@@ -0,0 +1,11 @@
+Template: live-debconfig/title
+Type: title
+Description: live-debconfig: System Configuration
+
+Template: live-debconfig/selinux/enable
+Type: boolean
+Default: false
+Description: live-debconfig: Enable SELinux?
+ Should Security-Enhanced Linux (SELinux) be enabled?
+ .
+ This defaults to false.
diff --git a/backends/debconf/005-sysvinit b/backends/debconf/005-sysvinit
new file mode 100755
index 0000000..eff22c0
--- /dev/null
+++ b/backends/debconf/005-sysvinit
@@ -0,0 +1,140 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+Defaults ()
+{
+	_LXC_ENABLE="${_LXC_ENABLE:-false}"
+	_LXC_CONSOLES="${_LXC_CONSOLES:-6}"
+}
+
+#db_get live-debconfig/sysvinit/lxc-enable
+#_LXC_ENABLE="${RET}" # boolean
+
+Defaults
+
+db_set live-debconfig/sysvinit/lxc-enable "${_LXC_ENABLE}"
+db_fset live-debconfig/sysvinit/lxc-enable seen false
+
+db_set live-debconfig/sysvinit/lxc-consoles "${_LXC_CONSOLES}"
+db_fset live-debconfig/sysvinit/lxc-consoles seen false
+
+db_settitle live-debconfig/title
+db_input high live-debconfig/sysvinit/lxc-enable || true
+db_go
+
+db_get live-debconfig/sysvinit/lxc-enable
+_LXC_ENABLE="${RET}" # boolean
+
+case "${_LXC_ENABLE}" in
+	true)
+		db_settitle live-debconfig/title
+		db_input high live-debconfig/sysvinit/lxc-consoles || true
+		db_go
+
+		db_get live-debconfig/sysvinit/lxc-consoles
+		_LXC_CONSOLES="${RET}" # string (w/o empty)
+
+		Defaults
+		;;
+
+	false)
+
+		;;
+esac
+
+db_stop
+
+case "${_LXC_ENABLE}" in
+	true)
+		# Updating file /etc/inittab..."
+
+		# Disable sulogin
+		#   ~~:S:wait:/sbin/sulogin
+		sed -i -e 's|\(^[^#].*S:wait:.*$\)|#\1|' /etc/inittab
+
+		# Disable ctrlaltdel
+		#   ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
+		sed -i -e 's|\(^[^#].*:ctrlaltdel:.*$\)|#\1|' /etc/inittab
+
+		# Disable power
+		#   pf::powerwait:/etc/init.d/powerfail start
+		#   pn::powerfailnow:/etc/init.d/powerfail now
+		#   po::powerokwait:/etc/init.d/powerfail stop
+		sed -i -e 's|\(^[^#].*:power.*:.*$\)|#\1|' /etc/inittab
+
+		# Disable normal getty
+		#  1:2345:respawn:/sbin/getty 38400 tty1
+		#  2:23:respawn:/sbin/getty 38400 tty2
+		#  3:23:respawn:/sbin/getty 38400 tty3
+		#  ...
+		# Keep container getty
+		#  1:2345:respawn:/sbin/getty 38400 console
+		#  c1:23:respawn:/sbin/getty 38400 tty1
+		#  c2:23:respawn:/sbin/getty 38400 tty2
+		#  ...
+		sed -i -e 's|\(^[^#,^c].*:respawn:/sbin/getty.*[^console,linux]$\)|#\1|' /etc/inittab
+
+		# Enable container getty
+		#  1:2345:respawn:/sbin/getty 38400 console
+		#  c1:23:respawn:/sbin/getty 38400 tty1
+		#  c2:23:respawn:/sbin/getty 38400 tty2
+
+		# Assemble new entries
+		_CONSOLES="\n#-- live-debconfig begin\n1:2345:respawn:/sbin/getty 38400 console"
+
+		for _CONSOLE in $(seq 1 ${_LXC_CONSOLES})
+		do
+			_CONSOLES="${_CONSOLES}\nc${_CONSOLE}:12345:respawn:/sbin/getty 38400 tty${_CONSOLE} linux"
+		done
+
+		_CONSOLES="${_CONSOLES}\n#-- live-debconfig end"
+
+		# Remove old entries
+		sed -e '/#-- live-debconfig begin/,/#-- live-debconfig end/d' /etc/inittab > /etc/inittab.tmp
+		mv -f /etc/inittab.tmp /etc/inittab
+
+		# Add new entries
+		_CONSOLE="$(grep '#[0-9].*:respawn:/sbin/getty' /etc/inittab | tail -1)"
+
+		sed -e "s|\(${_CONSOLE}\)|\1${_CONSOLES}|" /etc/inittab > /etc/inittab.tmp
+		mv -f /etc/inittab.tmp /etc/inittab
+
+		# squeeze and newer only has /dev/tty and /dev/tty0 by default,
+		# therefore creating missing device nodes for tty1-4.
+		for _CONSOLE in $(seq 1 ${_LXC_CONSOLES})
+		do
+			if [ ! -e "/dev/tty${_CONSOLE}" ]
+			then
+				mknod "/dev/tty${_CONSOLE}" c 4 "${_CONSOLE}"
+			fi
+		done
+
+		# Remove pointless services in a container
+		for _SERVICE in checkroot.sh hwclockfirst.sh hwclock.sh module-init-tools umountfs umountroot
+		do
+			if [ -e "/etc/init.d/${_SERVICE}" ]
+			then
+				update-rc.d -f ${_SERVICE} disable | \
+				grep -v "update-rc.d: using dependency based boot sequencing" || true
+			fi
+		done
+		;;
+
+	false)
+		# Revert /etc/inittab
+		cp -p /usr/share/sysvinit/inittab /etc/inittab
+
+		# Renable services
+		for _SERVICE in checkroot.sh hwclockfirst.sh hwclock.sh module-init-tools umountfs umountroot
+		do
+			if [ -e "/etc/init.d/${_SERVICE}" ]
+			then
+				update-rc.d -f ${_SERVICE} defaults | \
+				grep -v "update-rc.d: using dependency based boot sequencing" || true
+			fi
+		done
+		;;
+esac
diff --git a/backends/debconf/005-sysvinit.templates b/backends/debconf/005-sysvinit.templates
new file mode 100644
index 0000000..3f42141
--- /dev/null
+++ b/backends/debconf/005-sysvinit.templates
@@ -0,0 +1,19 @@
+Template: live-debconfig/title
+Type: title
+Description: live-debconfig: System Configuration
+
+Template: live-debconfig/sysvinit/lxc-enable
+Type: boolean
+Default: false
+Description: live-debconfig: Enable LXC?
+ Should Linux Container (LXC) support  be enabled?
+ .
+ This defaults to false.
+
+Template: live-debconfig/sysvinit/lxc-consoles
+Type: string
+Default: 6
+Description: live-debconfig: How many consoles for LXC?
+ How many concurrent consoles should the current container provide?
+ .
+ This defaults to 6 and will result in six getty processes per container.
diff --git a/bin/live-debconfig b/bin/live-debconfig
new file mode 100755
index 0000000..04389fc
--- /dev/null
+++ b/bin/live-debconfig
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+set -e
+
+# Setup local debconf
+if [ ! -e /var/lib/live/debconfig ]
+then
+	mkdir -p /var/lib/live/debconfig
+	chmod 0700 /var/lib/live/debconfig
+fi
+
+if [ ! -e /var/lib/live/debconfig/systemrc ]
+then
+
+cat > /var/lib/live/debconfig/systemrc << EOF
+Config: configdb
+Templates: templatedb
+
+Name: config
+Driver: File
+Mode: 644
+Reject-Type: password
+Filename: /var/lib/live/debconfig/config.dat
+
+Name: passwords
+Driver: File
+Mode: 600
+Backup: false
+Required: false
+Accept-Type: password
+Filename: /var/lib/live/debconfig/passwords.dat
+
+Name: configdb
+Driver: Stack
+Stack: config, passwords
+
+Name: templatedb
+Driver: File
+Mode: 644
+Filename: /var/lib/live/debconfig/templates.dat
+EOF
+
+fi
+
+DEBCONF_SYSTEMRC="/var/lib/live/debconfig/systemrc"
+export DEBCONF_SYSTEMRC
+
+if [ "${1}" = "--noscripts" ]
+then
+	exit
+fi
+
+# Run debconf scripts
+for _SCRIPT in /lib/live/debconfig/*
+do
+	if [ -x "${_SCRIPT}" ]
+	then
+		# FIXME: make scripts a multiselect
+		"${_SCRIPT}"
+	fi
+done
diff --git a/debian/live-config.install b/debian/live-config.install
index 0c01afe..36b9f4d 100644
--- a/debian/live-config.install
+++ b/debian/live-config.install
@@ -1,2 +1,3 @@
+sbin
 lib
 var
diff --git a/debian/live-config.postrm b/debian/live-config.postrm
index 639d709..f8d577c 100644
--- a/debian/live-config.postrm
+++ b/debian/live-config.postrm
@@ -10,6 +10,7 @@ case "${1}" in
 		rm -f /etc/X11/xorg.conf.d/99-live_*.conf
 
 		rm -rf /var/lib/live/config
+		rm -rf /var/lib/live/debconfig
 		rmdir --ignore-fail-on-non-empty /var/lib/live > /dev/null 2>&1 || true
 		;;
 

-- 
live-config



More information about the debian-live-changes mailing list