Merge lp:~jamiebennett/casper/debconf-speedup-work into lp:casper

Proposed by Jamie Bennett
Status: Merged
Merge reported by: Stéphane Graber
Merged at revision: not available
Proposed branch: lp:~jamiebennett/casper/debconf-speedup-work
Merge into: lp:casper
Diff against target: 380 lines (+191/-26) (has conflicts)
12 files modified
bin/casper-preseed (+13/-6)
bin/casper-set-selections (+92/-0)
debian/casper.install (+1/-0)
debian/changelog (+13/-0)
debian/copyright (+10/-0)
hooks/casper (+1/-0)
scripts/casper (+28/-0)
scripts/casper-bottom/10adduser (+11/-14)
scripts/casper-bottom/22sslcert (+1/-0)
scripts/casper-bottom/24preseed (+9/-5)
scripts/casper-bottom/45disable_guest_account (+1/-1)
scripts/casper-functions (+11/-0)
Text conflict in debian/changelog
Text conflict in scripts/casper-bottom/24preseed
To merge this branch: bzr merge lp:~jamiebennett/casper/debconf-speedup-work
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+18561@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jamie Bennett (jamiebennett) wrote :

Investigations into speeding up the casper boot process revealed that a significant proportion of time was spent in debconf-communicate calls. To solve this, one persistent debconf-communicate call is made with subsequent scripts using the confmodule approach.

Also in this branch is a quicker way to disable the guest user account.

Revision history for this message
Colin Watson (cjwatson) wrote :

You have two sets of merge conflicts in here (I'm surprised bzr let you commit those without some effort, actually). Could you please resolve them?

review: Needs Fixing
Revision history for this message
Colin Watson (cjwatson) wrote :

Also, the version number should be 1.212 rather than 1.211ubuntu1 - and since this is associated with a bug report, it would be best to close that in the changelog in the usual way.

Revision history for this message
James Westby (james-w) wrote :

On Wed, 03 Feb 2010 23:38:26 -0000, Colin Watson <email address hidden> wrote:
> Review: Needs Fixing
> You have two sets of merge conflicts in here (I'm surprised bzr let you commit those without some effort, actually). Could you please resolve them?

The diff it is showing is the diff that would result if you did the
merge, so are the conflicts just conflicts between this branch and the
target?

Thanks,

James

Revision history for this message
Colin Watson (cjwatson) wrote :

Yes, you're right. Sorry about that. I'll merge this now, then.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/casper-preseed'
--- bin/casper-preseed 2006-10-16 15:05:58 +0000
+++ bin/casper-preseed 2010-02-03 20:58:09 +0000
@@ -2,18 +2,25 @@
2set -e2set -e
3PATH=/usr/sbin:/usr/bin:/sbin:/bin3PATH=/usr/sbin:/usr/bin:/sbin:/bin
44
5# Only do this once.
6if [ -z "$DEBCONF_REDIR" ]; then
7 exec <&4
8 export DEBIAN_HAS_FRONTEND=1
9 export DEBCONF_REDIR=1
10fi
11
5root="$1"12root="$1"
13. "$root/usr/share/debconf/confmodule"
14
6question="$2"15question="$2"
7value="$3"16value="$3"
8seen="$4"17seen="$4"
9[ "$seen" ] || seen=true18[ "$seen" ] || seen=true
1019
11if ! (echo "SET $question $value"; echo "FSET $question seen $seen") | chroot "$1" debconf-communicate -fnoninteractive casper >/dev/null; then20if ! db_set "$question" "$value"; then
12 chroot "$1" debconf-communicate -fnoninteractive casper >/dev/null <<EOF21 db_register debian-installer/dummy "$question"
13REGISTER debian-installer/dummy $question22 db_set "$question" "$value"
14SET $question $value
15FSET $question seen $seen
16EOF
17fi23fi
24db_fset "$question" seen "$seen"
1825
19exit 026exit 0
2027
=== added file 'bin/casper-set-selections'
--- bin/casper-set-selections 1970-01-01 00:00:00 +0000
+++ bin/casper-set-selections 2010-02-03 20:58:09 +0000
@@ -0,0 +1,92 @@
1#!/bin/sh
2# Cloned-and-hacked from preseed/debconf-set-selections for casper.
3set -e
4
5OLDIFS="$IFS"
6CR=$(echo -en "\r")
7NL="
8"
9
10. /scripts/casper-functions
11load_confmodule
12
13# Returns the first field in the current line
14first_field() {
15 echo "$line" | grep -q "[[:space:]]" || return 1
16 echo "$line" | sed -r 's/^([^[:space:]]*).*/\1/'
17}
18
19# Returns any fields after the first field in the current line
20rest_line() {
21 if echo "$line" | grep -q "[[:space:]]"; then
22 echo "$line" | sed 's/^[^[:space:]]*[[:space:]]*//'
23 fi
24}
25
26SEEN=1
27if [ "$1" = --unseen ]; then
28 SEEN=
29 shift
30fi
31
32file="$1"
33
34parse_error() {
35 echo "Error parsing preconfiguration file: $*" >&2
36 exit 1
37}
38
39IFS="$NL"
40multiline=""
41# TODO: this squashes \r elsewhere in the line too
42for line in $(grep -v '^#\|^[[:space:]]*$' "$file" | sed "s/$CR//g"); do
43 IFS="$OLDIFS"
44
45 line="$(echo "$line" | sed 's/^[[:space:]]*//')"
46 if echo "$line" | grep -q '\\$'; then
47 multiline="${multiline:+$multiline }$(echo "$line" | \
48 sed 's/[[:space:]]*\\$//')"
49 continue
50 elif [ -n "$multiline" ]; then
51 line="$multiline $line"
52 multiline=""
53 fi
54
55 package=""
56 var=""
57 type=""
58 val=""
59 if ! package="$(first_field)"; then
60 parse_error "Syntax error: unable to determine template owner"
61 fi
62 line="$(rest_line)"
63 if ! var="$(first_field)"; then
64 parse_error "Syntax error: unable to determine template name"
65 fi
66 line="$(rest_line)"
67 if ! type="$(first_field)"; then
68 # Allow for lines without separator before an empty value
69 if [ "$line" ]; then
70 type="$line"
71 else
72 parse_error "Syntax error: unable to determine template type"
73 fi
74 fi
75 line="$(rest_line)"
76 val="$line"
77
78 if [ "$type" = seen ]; then
79 # Set seen flag.
80 db_fset "$var" "$type" "$val" || true # how to handle this error?
81 else
82 if ! db_set "$var" "$val"; then
83 # Question does not exist yet.
84 db_register debian-installer/dummy "$var"
85 db_set "$var" "$val"
86 db_subst "$var" ID "$var"
87 fi
88 if [ "$SEEN" ]; then
89 db_fset "$var" seen true
90 fi
91 fi
92done
093
=== modified file 'debian/casper.install'
--- debian/casper.install 2009-09-23 14:21:43 +0000
+++ debian/casper.install 2010-02-03 20:58:09 +0000
@@ -3,6 +3,7 @@
3bin/casper-new-uuid sbin3bin/casper-new-uuid sbin
4bin/casper-preseed usr/share/casper4bin/casper-preseed usr/share/casper
5bin/casper-reconfigure usr/share/casper5bin/casper-reconfigure usr/share/casper
6bin/casper-set-selections usr/share/casper
6bin/casper-snapshot sbin7bin/casper-snapshot sbin
7hooks usr/share/initramfs-tools8hooks usr/share/initramfs-tools
8scripts usr/share/initramfs-tools9scripts usr/share/initramfs-tools
910
=== modified file 'debian/changelog'
--- debian/changelog 2010-01-27 13:56:03 +0000
+++ debian/changelog 2010-02-03 20:58:09 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1casper (1.211) UNRELEASED; urgency=low2casper (1.211) UNRELEASED; urgency=low
23
3 [ Mario Limonciello ]4 [ Mario Limonciello ]
@@ -12,6 +13,18 @@
1213
13 -- Jonathan Riddell <jriddell@ubuntu.com> Wed, 27 Jan 2010 13:55:42 +000014 -- Jonathan Riddell <jriddell@ubuntu.com> Wed, 27 Jan 2010 13:55:42 +0000
1415
16=======
17casper (1.211ubuntu1) lucid; urgency=low
18
19 * Speed up work around debconf-communicate. Replace several calls to
20 debconf-communicate with one persistent invocation followed by
21 confmodule calls.
22 * Disable guest account by rm'ing rather than waiting for dpkg to
23 remove it.
24
25 -- Jamie Bennett <jamie@linuxuk.org> Wed, 03 Feb 2010 12:37:53 -0800
26
27>>>>>>> MERGE-SOURCE
15casper (1.210) lucid; urgency=low28casper (1.210) lucid; urgency=low
1629
17 [ Scott James Remnant ]30 [ Scott James Remnant ]
1831
=== modified file 'debian/copyright'
--- debian/copyright 2009-01-13 18:56:31 +0000
+++ debian/copyright 2010-02-03 20:58:09 +0000
@@ -28,6 +28,16 @@
28 3. This notice may not be removed or altered from any source28 3. This notice may not be removed or altered from any source
29 distribution.29 distribution.
3030
31License (bin/casper-set-selections):
32
33 The Debian installer preseeder is copyright 2004 by Joey Hess
34 <joeyh@debian.org> and others.
35
36 This program is free software; you can redistribute it and/or modify
37 it under the terms of the GNU General Public License as published by
38 the Free Software Foundation; either version 2 of the License, or
39 (at your option) any later version.
40
31License (everything else):41License (everything else):
3242
33 Copyright (C) 2006 Marco Amadori <marco.amadori@gmail.com>43 Copyright (C) 2006 Marco Amadori <marco.amadori@gmail.com>
3444
=== modified file 'hooks/casper'
--- hooks/casper 2009-05-23 22:30:56 +0000
+++ hooks/casper 2010-02-03 20:58:09 +0000
@@ -33,6 +33,7 @@
33mkdir -p ${DESTDIR}/lib/casper33mkdir -p ${DESTDIR}/lib/casper
34copy_exec /usr/share/casper/casper-reconfigure /bin34copy_exec /usr/share/casper/casper-reconfigure /bin
35copy_exec /usr/share/casper/casper-preseed /bin35copy_exec /usr/share/casper/casper-preseed /bin
36copy_exec /usr/share/casper/casper-set-selections /bin
3637
37mkdir -p ${DESTDIR}/lib/udev38mkdir -p ${DESTDIR}/lib/udev
38copy_exec /lib/udev/cdrom_id /lib/udev39copy_exec /lib/udev/cdrom_id /lib/udev
3940
=== modified file 'scripts/casper'
--- scripts/casper 2009-10-06 12:07:52 +0000
+++ scripts/casper 2010-02-03 20:58:09 +0000
@@ -651,6 +651,27 @@
651 mount -n -o bind /dev "${rootmnt}/dev"651 mount -n -o bind /dev "${rootmnt}/dev"
652 fi652 fi
653653
654 # Open up two fifo's fd's for debconf-communicate to use. Speeds up
655 # the Casper process considerably.
656 log_begin_msg "Creating debconf-communicate fifo mechanism"
657 mkfifo /tmp/debconf-in.fifo
658 mkfifo /tmp/debconf-out.fifo
659
660 chroot /root debconf-communicate -fnoninteractive casper > /tmp/debconf-out.fifo < /tmp/debconf-in.fifo &
661
662 # Save the PID so it can be killed later.
663 DEBCONF_COMMUNICATE_PID="$!"
664
665 if [ ! -p /tmp/debconf-in.fifo ] || [ ! -p /tmp/debconf-out.fifo ]; then
666 log_warning_msg "failed to setup debconf-communicate channel"
667 fi
668 log_end_msg
669
670 # Order matters!
671 # These file descriptors must stay open until we're finished with
672 # debconf-communicate.
673 exec 4</tmp/debconf-out.fifo 3>/tmp/debconf-in.fifo
674
654 maybe_break casper-bottom675 maybe_break casper-bottom
655 [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/casper-bottom"676 [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/casper-bottom"
656677
@@ -661,6 +682,13 @@
661 umount "${rootmnt}/dev"682 umount "${rootmnt}/dev"
662 fi683 fi
663684
685 # Kill the debconf-communicate instance and close fd's associated with
686 # debconf-communicate.
687 kill $DEBCONF_COMMUNICATE_PID
688 exec 3>&- 4>&-
689 rm -f /tmp/debconf-in.fifo
690 rm -f /tmp/debconf-out.fifo
691
664 exec 1>&6 6>&-692 exec 1>&6 6>&-
665 exec 2>&7 7>&-693 exec 2>&7 7>&-
666 kill "$tailpid"694 kill "$tailpid"
667695
=== modified file 'scripts/casper-bottom/10adduser'
--- scripts/casper-bottom/10adduser 2010-01-05 16:54:40 +0000
+++ scripts/casper-bottom/10adduser 2010-02-03 20:58:09 +0000
@@ -17,28 +17,25 @@
17esac17esac
1818
19. /scripts/casper-functions19. /scripts/casper-functions
20load_confmodule
2021
21log_begin_msg "$DESCRIPTION"22log_begin_msg "$DESCRIPTION"
2223
23# U6aMy0wojraho is just a blank password24# U6aMy0wojraho is just a blank password
24chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF25db_set passwd/root-password-crypted '*'
25set passwd/root-password-crypted *26db_set passwd/user-password-crypted U6aMy0wojraho
26set passwd/user-password-crypted U6aMy0wojraho27db_set passwd/user-fullname "$USERFULLNAME"
27set passwd/user-fullname $USERFULLNAME 28db_set passwd/username "$USERNAME"
28set passwd/username $USERNAME29db_set passwd/user-uid 999
29set passwd/user-uid 999
30EOF
3130
32chroot /root /usr/lib/user-setup/user-setup-apply > /dev/null31chroot /root /usr/lib/user-setup/user-setup-apply > /dev/null
3332
34# Clear out debconf database again to avoid confusing ubiquity later.33# Clear out debconf database again to avoid confusing ubiquity later.
35chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF34db_set passwd/root-password-crypted
36set passwd/root-password-crypted35db_set passwd/user-password-crypted
37set passwd/user-password-crypted36db_set passwd/user-fullname
38set passwd/user-fullname37db_set passwd/username
39set passwd/username38db_set passwd/user-uid
40set passwd/user-uid
41EOF
4239
43if [ -f /root/etc/sudoers ]; then40if [ -f /root/etc/sudoers ]; then
44 if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then41 if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then
4542
=== modified file 'scripts/casper-bottom/22sslcert'
--- scripts/casper-bottom/22sslcert 2010-01-05 16:54:40 +0000
+++ scripts/casper-bottom/22sslcert 2010-02-03 20:58:09 +0000
@@ -17,6 +17,7 @@
17esac17esac
1818
19. /scripts/casper-functions19. /scripts/casper-functions
20load_confmodule
2021
21log_begin_msg "$DESCRIPTION"22log_begin_msg "$DESCRIPTION"
2223
2324
=== modified file 'scripts/casper-bottom/24preseed'
--- scripts/casper-bottom/24preseed 2010-01-20 23:33:29 +0000
+++ scripts/casper-bottom/24preseed 2010-02-03 20:58:09 +0000
@@ -17,11 +17,12 @@
17esac17esac
1818
19. /scripts/casper-functions19. /scripts/casper-functions
20load_confmodule
2021
21log_begin_msg "$DESCRIPTION"22log_begin_msg "$DESCRIPTION"
2223
23if [ -e /preseed.cfg ]; then24if [ -e /preseed.cfg ]; then
24 chroot /root debconf-set-selections < /preseed.cfg25 casper-set-selections /preseed.cfg
25fi26fi
2627
27locations=28locations=
@@ -64,16 +65,19 @@
64 esac65 esac
65done66done
6667
68<<<<<<< TREE
67if [ "$locations" ]; then69if [ "$locations" ]; then
68 for item in $locations; do70 for item in $locations; do
69 chroot /root debconf-set-selections < "/root$item"71 chroot /root debconf-set-selections < "/root$item"
70 done72 done
73=======
74if [ "$location" ]; then
75 casper-set-selections "/root$location"
76>>>>>>> MERGE-SOURCE
71fi77fi
7278
73reply="$(echo "GET preseed/early_command" | chroot /root debconf-communicate -fnoninteractive casper)"79if db_get preseed/early_command && [ "$RET" ]; then
74if [ "${reply#0 }" != "$reply" ]; then80 sh -c "$RET"
75 reply="${reply#0 }"
76 sh -c "$reply"
77fi81fi
7882
79# Clear out debconf database backup files to save memory.83# Clear out debconf database backup files to save memory.
8084
=== modified file 'scripts/casper-bottom/45disable_guest_account'
--- scripts/casper-bottom/45disable_guest_account 2010-01-05 16:54:40 +0000
+++ scripts/casper-bottom/45disable_guest_account 2010-02-03 20:58:09 +0000
@@ -20,6 +20,6 @@
2020
21log_begin_msg "$DESCRIPTION"21log_begin_msg "$DESCRIPTION"
2222
23chroot /root dpkg -P gdm-guest-session || true23chroot /root rm -r /usr/share/gdm/guest-session
2424
25log_end_msg25log_end_msg
2626
=== modified file 'scripts/casper-functions'
--- scripts/casper-functions 2008-09-18 23:39:20 +0000
+++ scripts/casper-functions 2010-02-03 20:58:09 +0000
@@ -39,3 +39,14 @@
39 echo "C"39 echo "C"
40 fi40 fi
41}41}
42
43load_confmodule() {
44 # Only do this once.
45 if [ -z "$DEBCONF_REDIR" ]; then
46 exec <&4
47 export DEBIAN_HAS_FRONTEND=1
48 export DEBCONF_REDIR=1
49 fi
50
51 . /root/usr/share/debconf/confmodule
52}

Subscribers

People subscribed via source and target branches