X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=ec3a6394aef565e6d85d839ba2cc7b3944bb2046;hb=b7d8cc3bdbfb83bf203baab832cde1f846c8ee9d;hp=cdcbc18ad85265fddcb7eeedd22d1fe4d86b9b24;hpb=72fbca18c2b60dc498d43363ffb5903ee59d7892;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index cdcbc18..ec3a639 100755 --- a/scripts/live +++ b/scripts/live @@ -43,6 +43,35 @@ then touch /live.vars fi +network_started= + +start_network () +{ + [ -z "$network_started" ] || return + [ -z "$NETBOOT" ] || return + + mount -n -o bind /sys /root/sys + mount -n -o bind /proc /root/proc + mount -n -o bind /dev /root/dev + mkdir -p /root/var/run/network + + # Close inherited fd's to prevent debconf-communicate from + # continuing to run post-live-initramfs. + chroot /root dhclient eth0 3>&- 4<&- + + network_started=1 +} + +stop_network () +{ + [ "$network_started" ] || return + + chroot /root ifconfig eth0 down + umount /root/sys + umount /root/proc + umount /root/dev +} + Arguments () { PRESEEDS="" @@ -431,19 +460,8 @@ Arguments () url=*) URL_LOCATION="${ARGUMENT#url=}" - mount -o bind /sys /root/sys - mount -o bind /proc /root/proc - mount -o bind /dev /root/dev - - mkdir -p /root/var/run/network - [ "${NETBOOT}" ] || chroot /root dhclient eth0 + start_network chroot /root wget -P /tmp "${URL_LOCATION}" - [ "${NETBOOT}" ] || chroot /root ifconfig eth0 down - - umount /root/sys - umount /root/proc - umount /root/dev - LOCATIONS="/tmp/$(basename ${URL_LOCATION}) ${LOCATIONS}" ;; @@ -759,7 +777,11 @@ copy_live_to () rsync -a --progress ${copyfrom}/* ${copyto} 1>/dev/console # "cp -a" from busybox also copies hidden files else mkdir -p ${copyto}/${LIVE_MEDIA_PATH} - cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH} # "cp -a" from busybox also copies hidden files + cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH} + if [ -e ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ] + then + cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ${copyto} + fi fi fi @@ -1891,10 +1913,18 @@ mountroot () 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 & + # Make the template database read-only, so that passthrough debconf + # instances can write to it directly; otherwise templates are only + # passed through when necessary. Use temporary config databases as + # well; we'll copy their contents back at the end. + DEBCONF_TMPDIR="$(chroot /root mktemp -dt debconf.XXXXXX)" + cp -a /root/var/cache/debconf/config.dat "/root$DEBCONF_TMPDIR/" + cp -a /root/var/cache/debconf/passwords.dat "/root$DEBCONF_TMPDIR/" + sed "s,^Filename: /var/cache/debconf/\(config\|passwords\).dat$,Filename: $DEBCONF_TMPDIR/\1.dat,; /^Name: templatedb/a\ ++Readonly: true" /root/etc/debconf.conf >"/root$DEBCONF_TMPDIR/debconf.conf" # Save the PID so it can be killed later. - DEBCONF_COMMUNICATE_PID="$!" + DEBCONF_SYSTEMRC="$DEBCONF_TMPDIR/debconf.conf" chroot /root debconf-communicate -fnoninteractive live-initramfs > /tmp/debconf-out.fifo < /tmp/debconf-in.fifo & if [ ! -p /tmp/debconf-in.fifo ] || [ ! -p /tmp/debconf-out.fifo ] then @@ -1923,6 +1953,15 @@ mountroot () rm -f /tmp/debconf-in.fifo rm -f /tmp/debconf-out.fifo + # Copy config database changes back to the master files. + chroot /root debconf-copydb tmpdb config \ + --config=Name:tmpdb --config=Driver:File \ + --config="Filename:$DEBCONF_TMPDIR/config.dat" + chroot /root debconf-copydb tmpdb passwords \ + --config=Name:tmpdb --config=Driver:File \ + --config="Filename:$DEBCONF_TMPDIR/passwords.dat" + rm -rf "$DEBCONF_TMPDIR" + exec 1>&6 6>&- exec 2>&7 7>&- kill ${tailpid}