X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=cbec764a9ceeb73f0e6875f5efd54e4ed4bf5cc6;hb=refs%2Ftags%2Fupstream%2F1.236.2;hp=6f4f5c196802e3031338f12423fba9368b6fa6f2;hpb=0e30bd5d6366275cd0465e45b2ac270a81a90157;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index 6f4f5c1..cbec764 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}" ;; @@ -667,7 +685,7 @@ is_nice_device () { sysfs_path="${1#/sys}" - if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-|platform-orion-ehci|platform-mmc|platform-mxsdhci|)" + if /lib/udev/path_id "${sysfs_path}" | egrep -q "ID_PATH=(usb|pci-|platform-orion-ehci|platform-mmc|platform-mxsdhci|)" then return 0 elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$' @@ -705,7 +723,7 @@ copy_live_to () if [ "${copytodev}" = "ram" ] then # copying to ram: - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\/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 @@ -1008,7 +1030,7 @@ do_snap_copy () todev=$(awk -v pat="$(base_path ${todir})" '$2 == pat { print $1 }' /proc/mounts) freespace=$(df -k | awk '/'${todev}'/{print $4}') else - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\"/root$DEBCONF_TMPDIR/debconf.conf" + + # Save the PID so it can be killed later. + 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 + 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 +1948,20 @@ mountroot () umount "${rootmnt}/dev" fi + # Close the fd's associated with debconf-communicate + exec 3>&- 4<&- + 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}