From c967ebfc4e43fb16a0c2c140c66900712be95ab7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 1 May 2010 13:31:18 +0200 Subject: [PATCH] Merging casper 1.216. --- Makefile | 2 +- bin/live-preseed | 23 ++++++---- bin/live-set-selections | 92 +++++++++++++++++++++++++++++++++++++ debian/copyright | 20 ++++++++ docs/ChangeLog.casper | 19 ++++++++ hooks/live | 1 + scripts/live | 29 ++++++++++++ scripts/live-bottom/10adduser | 29 ++++++------ scripts/live-bottom/22sslcert | 1 + scripts/live-bottom/24preseed | 12 ++--- scripts/live-bottom/30accessibility | 21 +-------- scripts/live-functions | 13 ++++++ 12 files changed, 211 insertions(+), 51 deletions(-) create mode 100755 bin/live-set-selections diff --git a/Makefile b/Makefile index 73bf2ba..a03d75f 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ install: test build cp bin/live-getty bin/live-login bin/live-new-uuid bin/live-snapshot bin/live-swapfile $(DESTDIR)/sbin mkdir -p $(DESTDIR)/usr/share/live-initramfs - cp bin/live-preseed bin/live-reconfigure contrib/languagelist $(DESTDIR)/usr/share/live-initramfs + cp bin/live-preseed bin/live-reconfigure bin/live-set-selections contrib/languagelist $(DESTDIR)/usr/share/live-initramfs mkdir -p $(DESTDIR)/usr/share/initramfs-tools cp -r hooks scripts $(DESTDIR)/usr/share/initramfs-tools diff --git a/bin/live-preseed b/bin/live-preseed index d98c4f3..add29bd 100755 --- a/bin/live-preseed +++ b/bin/live-preseed @@ -4,22 +4,29 @@ set -e PATH=/usr/sbin:/usr/bin:/sbin:/bin +# Only do this once +if [ -z "${DEBCONF_REDIR}" ] +then + exec <&4 + export DEBIAN_HAS_FRONTEND=1 + export DEBCONF_REDIR=1 +fi + root="${1}" +. "$root/usr/share/debconf/confmodule" + question="${2}" value="${3}" seen="${4}" [ "${seen}" ] || seen=true -if ! (echo "SET ${question} ${value}"; echo "FSET ${question} seen ${seen}") | chroot "${1}" /usr/bin/debconf-communicate -fnoninteractive live-initramfs >/dev/null +if ! db_set "${question}" "${value}" then - -chroot "${1}" /usr/bin/debconf-communicate -fnoninteractive live-initramfs >/dev/null << EOF -REGISTER debian-installer/dummy ${question} -SET ${question} ${value} -FSET ${question} seen ${seen} -EOF - + db_register debian-installer/dummy "${question}" + db_set "${question}" "${value}" fi +db_fset "${question}" seen "${seen}" + exit 0 diff --git a/bin/live-set-selections b/bin/live-set-selections new file mode 100755 index 0000000..c4c38dd --- /dev/null +++ b/bin/live-set-selections @@ -0,0 +1,92 @@ +#!/bin/sh +# Cloned-and-hacked from preseed/debconf-set-selections for live-initramfs. +set -e + +OLDIFS="$IFS" +CR=$(echo -en "\r") +NL=" +" + +. /scripts/live-functions +load_confmodule + +# Returns the first field in the current line +first_field() { + echo "$line" | grep -q "[[:space:]]" || return 1 + echo "$line" | sed -r 's/^([^[:space:]]*).*/\1/' +} + +# Returns any fields after the first field in the current line +rest_line() { + if echo "$line" | grep -q "[[:space:]]"; then + echo "$line" | sed 's/^[^[:space:]]*[[:space:]]*//' + fi +} + +SEEN=1 +if [ "$1" = --unseen ]; then + SEEN= + shift +fi + +file="$1" + +parse_error() { + echo "Error parsing preconfiguration file: $*" >&2 + exit 1 +} + +IFS="$NL" +multiline="" +# TODO: this squashes \r elsewhere in the line too +for line in $(grep -v '^#\|^[[:space:]]*$' "$file" | sed "s/$CR//g"); do + IFS="$OLDIFS" + + line="$(echo "$line" | sed 's/^[[:space:]]*//')" + if echo "$line" | grep -q '\\$'; then + multiline="${multiline:+$multiline }$(echo "$line" | \ + sed 's/[[:space:]]*\\$//')" + continue + elif [ -n "$multiline" ]; then + line="$multiline $line" + multiline="" + fi + + package="" + var="" + type="" + val="" + if ! package="$(first_field)"; then + parse_error "Syntax error: unable to determine template owner" + fi + line="$(rest_line)" + if ! var="$(first_field)"; then + parse_error "Syntax error: unable to determine template name" + fi + line="$(rest_line)" + if ! type="$(first_field)"; then + # Allow for lines without separator before an empty value + if [ "$line" ]; then + type="$line" + else + parse_error "Syntax error: unable to determine template type" + fi + fi + line="$(rest_line)" + val="$line" + + if [ "$type" = seen ]; then + # Set seen flag. + db_fset "$var" "$type" "$val" || true # how to handle this error? + else + if ! db_set "$var" "$val"; then + # Question does not exist yet. + db_register debian-installer/dummy "$var" + db_set "$var" "$val" + db_subst "$var" ID "$var" + fi + if [ "$SEEN" ]; then + db_fset "$var" seen true + fi + fi +done diff --git a/debian/copyright b/debian/copyright index 539feb2..3babe1c 100644 --- a/debian/copyright +++ b/debian/copyright @@ -27,3 +27,23 @@ License: GPL-3+ . On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-3 file. + +Files: bin/live-set-selections +Copyright: Joey Hess +License: GPL-2+ + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + . + On Debian systems, the complete text of the GNU General Public License + can be found in /usr/share/common-licenses/GPL-2 file. diff --git a/docs/ChangeLog.casper b/docs/ChangeLog.casper index 2bed515..da88148 100644 --- a/docs/ChangeLog.casper +++ b/docs/ChangeLog.casper @@ -1,3 +1,22 @@ +casper (1.216) lucid; urgency=low + + [ Luke Yelavich ] + * scripts/casper-bottom/30accessibility && ubiquity-hooks/30accessibility: + - Remove code to disable pulseaudio, as it is no longer needed, and + the supporting code in the pulseaudio package was removed a long time + ago. + - Set the default empathy theme to classic for blindness and braille + accessibility profiles. + + [ Jamie Bennett ] + * Speed up work around debconf-communicate. Replace several calls to + debconf-communicate with one persistent invocation followed by + confmodule calls. + * Disable guest account by rm'ing rather than waiting for dpkg to + remove it. + + -- Colin Watson Wed, 03 Feb 2010 16:41:57 -0800 + casper (1.215) lucid; urgency=low [ Mario Limonciello ] diff --git a/hooks/live b/hooks/live index 5973d20..a018d95 100755 --- a/hooks/live +++ b/hooks/live @@ -44,6 +44,7 @@ mkdir -p "${DESTDIR}"/lib/live-initramfs # Executables copy_exec /usr/share/live-initramfs/live-reconfigure /bin copy_exec /usr/share/live-initramfs/live-preseed /bin +copy_exec /usr/share/live-initramfs/live-set-selections /bin # Scripts cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts diff --git a/scripts/live b/scripts/live index 6f4f5c1..26a6a46 100755 --- a/scripts/live +++ b/scripts/live @@ -1885,6 +1885,28 @@ mountroot () mount -n -o bind /dev "${rootmnt}/dev" fi + # Open up two fifo's fd's for debconf-communicate to use. Speeds up + # the live-initramfs process considerably. + log_begin_msg "Creating debconf-communicate fifo mechanism" + mkfifo /tmp/debconf-in.fifo + mkfifo /tmp/debconf-out.fifo + + chroot /root debconf-communicate -fnoninteractive live-initramfs > /tmp/debconf-out.fifo < /tmp/debconf-in.fifo & + + # Save the PID so it can be killed later. + DEBCONF_COMMUNICATE_PID="$!" + + if [ ! -p /tmp/debconf-in.fifo ] || [ ! -p /tmp/debconf-out.fifo ] + then + log_warning_msg "failed to setup debconf-communicate channel" + fi + log_end_msg + + # Order matters! + # These file descriptors must stay open until we're finished with + # debconf-communicate. + exec 4/tmp/debconf-in.fifo + maybe_break live-bottom log_begin_msg "Running /scripts/live-bottom\n" @@ -1896,6 +1918,13 @@ mountroot () umount "${rootmnt}/dev" fi + # Kill the debconf-communicate instance and close fd's associated with· + # debconf-communicate. + kill $DEBCONF_COMMUNICATE_PID + exec 3>&- 4<&- + rm -f /tmp/debconf-in.fifo + rm -f /tmp/debconf-out.fifo + exec 1>&6 6>&- exec 2>&7 7>&- kill ${tailpid} diff --git a/scripts/live-bottom/10adduser b/scripts/live-bottom/10adduser index c7adad2..51868d4 100755 --- a/scripts/live-bottom/10adduser +++ b/scripts/live-bottom/10adduser @@ -26,6 +26,7 @@ then fi . /scripts/live-functions +load_confmodule log_begin_msg "Adding live session user" @@ -34,14 +35,12 @@ log_begin_msg "Adding live session user" user_crypted="8Ab05sVQ4LLps" # as in $(echo "live" | mkpasswd -s) # U6aMy0wojraho is just a blank password -chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF -set passwd/make-user true -set passwd/root-password-crypted * -set passwd/user-password-crypted ${user_crypted} -set passwd/user-fullname ${USERFULLNAME} -set passwd/username ${USERNAME} -set passwd/user-uid 1000 -EOF +db_set passwd/make-user true +db_set passwd/root-password-crypted '*' +db_set passwd/user-password-crypted ${user_crypted} +db_set passwd/user-fullname "$USERFULLNAME" +db_set passwd/username "$USERNAME" +db_set passwd/user-uid 999 chroot /root /usr/bin/env -i HOME="/root" \ TERM="${TERM}" PATH="/usr/sbin:/usr/bin:/sbin:/bin" \ @@ -49,14 +48,12 @@ chroot /root /usr/bin/env -i HOME="/root" \ | grep -v "Shadow passwords are now on" # Clear out debconf database again to avoid confusing ubiquity later. -chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF -set passwd/make-user -set passwd/root-password-crypted -set passwd/user-password-crypted -set passwd/user-fullname -set passwd/username -set passwd/user-uid -EOF +db_set passwd/make-user +db_set passwd/root-password-crypted +db_set passwd/user-password-crypted +db_set passwd/user-fullname +db_set passwd/username +db_set passwd/user-uid if ! grep -qs "${USERNAME}" /root/etc/passwd then diff --git a/scripts/live-bottom/22sslcert b/scripts/live-bottom/22sslcert index 1950eef..d54dc29 100755 --- a/scripts/live-bottom/22sslcert +++ b/scripts/live-bottom/22sslcert @@ -21,6 +21,7 @@ esac # live-initramfs header . /scripts/live-functions +load_confmodule log_begin_msg "Regenerating SSL certificate..." diff --git a/scripts/live-bottom/24preseed b/scripts/live-bottom/24preseed index 7dd6394..9a77ef5 100755 --- a/scripts/live-bottom/24preseed +++ b/scripts/live-bottom/24preseed @@ -26,6 +26,7 @@ then fi . /scripts/live-functions +load_confmodule log_begin_msg "Loading preseed file" @@ -33,14 +34,14 @@ log_begin_msg "Loading preseed file" if [ -e /preseed.cfg ] then - chroot /root debconf-set-selections < /preseed.cfg + live-set-selections /preseed.cfg fi if [ -n "${LOCATIONS}" ] then for item in ${LOCATIONS} do - chroot /root debconf-set-selections < "/root${ITEM}" + live-set-selections "/root$item" done fi @@ -55,12 +56,9 @@ then done fi -reply="$(echo "GET preseed/early_command" | chroot /root debconf-communicate -fnoninteractive live-initramfs)" - -if [ "${reply#0 }" != "${reply}" ] +if db_get preseed/early_command && [ "$RET" ] then - reply="${reply#0 }" - sh -c "${reply}" + sh -c "$RET" fi # Clear out debconf database backup files to save memory. diff --git a/scripts/live-bottom/30accessibility b/scripts/live-bottom/30accessibility index 4624077..75bfae4 100755 --- a/scripts/live-bottom/30accessibility +++ b/scripts/live-bottom/30accessibility @@ -109,20 +109,12 @@ case ${ACCESS} in gct -s -t bool /desktop/gnome/interface/accessibility true gct -s -t bool /desktop/gnome/applications/at/visual/startup true gct -s -t string /desktop/gnome/applications/at/visual/exec orca + gct -s -t string /apps/empathy/conversation/theme classic gct -s -t bool /apps/gksu/disable-grab true gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers remove_applet fast_user_switch - if [ -x /root/usr/bin/pulse-session ] - then - mkdir -p /root/var/lib/pulseaudio - touch /root/var/lib/pulseaudio/pulse_a11y_nostart - chroot /root chown root.root /var/lib/pulseaudio/pulse_a11y_nostart - mkdir -p /root/home/$USERNAME/.pulse - echo "autospawn = no" > /root/home/$USERNAME/.pulse/client.conf - chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.pulse - fi if [ -x /root/usr/bin/orca ] then mkdir -p /root/home/$USERNAME/.orca @@ -137,6 +129,7 @@ case ${ACCESS} in gct -s -t string /desktop/gnome/applications/at/visual/exec orca gct -s -t bool /apps/gksu/disable-grab true gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity + gct -s -t string /apps/empathy/conversation/theme classic sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers if [ -x /root/usr/bin/orca ] @@ -149,16 +142,6 @@ case ${ACCESS} in chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca fi - if [ -x /root/usr/bin/pulse-session ] - then - mkdir -p /root/var/lib/pulseaudio - touch /root/var/lib/pulseaudio/pulse_a11y_nostart - chroot /root chown root.root /var/lib/pulseaudio/pulse_a11y_nostart - mkdir -p /root/home/$USERNAME/.pulse - echo "autospawn = no" > /root/home/$USERNAME/.pulse/client.conf - chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.pulse - fi - remove_applet fast_user_switch ;; diff --git a/scripts/live-functions b/scripts/live-functions index 4a23e69..4c37f4b 100644 --- a/scripts/live-functions +++ b/scripts/live-functions @@ -111,3 +111,16 @@ panic() { . /scripts/functions panic "$@" } + +load_confmodule () +{ + # Only do this once + if [ -z "$DEBCONF_REDIR" ] + then + exec <&4 + export DEBIAN_HAS_FRONTEND=1 + export DEBCONF_REDIR=1 + fi + + . /root/usr/share/debconf/confmodule +} -- 2.1.4