Merging casper 1.216.
[live-boot-grml.git] / scripts / live
index 23ba434..26a6a46 100755 (executable)
@@ -46,6 +46,7 @@ fi
 Arguments ()
 {
        PRESEEDS=""
+       LOCATIONS=""
 
        for ARGUMENT in $(cat /proc/cmdline)
        do
@@ -418,8 +419,8 @@ Arguments ()
                                ;;
 
                        preseed/file=*|file=*)
-                               LOCATION="${ARGUMENT#*=}"
-                               export LOCATION
+                               LOCATIONS="${ARGUMENT#*=} ${LOCATIONS}"
+                               export LOCATIONS
                                ;;
 
                        nopreseed)
@@ -428,7 +429,7 @@ Arguments ()
                                ;;
 
                        url=*)
-                               location="${ARGUMENT#url=}"
+                               URL_LOCATION="${ARGUMENT#url=}"
 
                                mount -o bind /sys /root/sys
                                mount -o bind /proc /root/proc
@@ -436,14 +437,14 @@ Arguments ()
 
                                mkdir -p /root/var/run/network
                                [ "${NETBOOT}" ] || chroot /root dhclient eth0
-                               chroot /root wget -P /tmp "${location}"
+                               chroot /root wget -P /tmp "${URL_LOCATION}"
                                [ "${NETBOOT}" ] || chroot /root ifconfig eth0 down
 
                                umount /root/sys
                                umount /root/proc
                                umount /root/dev
 
-                               LOCATION="/tmp/$(basename "${location}")"
+                               LOCATIONS="/tmp/$(basename ${URL_LOCATION}) ${LOCATIONS}"
                                ;;
 
                        */*=*)
@@ -672,6 +673,9 @@ is_nice_device ()
        elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
        then
                return 0
+       elif echo ${sysfs_path} | grep -q "^/block/dm-"
+       then
+               return 0
        fi
 
        return 1
@@ -776,6 +780,10 @@ do_netmount ()
        udevadm trigger
        udevadm settle
 
+       if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \
+          [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ]
+       then
+
        # if ethdevice was not specified on the kernel command line
        # make sure we try to get a working network configuration
        # for *every* present network device (except for loopback of course)
@@ -819,6 +827,10 @@ do_netmount ()
                fi
        done
 
+       else
+       ipconfig ${DEVICE} | tee /netboot.config
+       fi
+
        # source relevant ipconfig output
        OLDHOSTNAME=${HOSTNAME}
        . /tmp/net-${DEVICE}.conf
@@ -1873,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-out.fifo 3>/tmp/debconf-in.fifo
+
        maybe_break live-bottom
        log_begin_msg "Running /scripts/live-bottom\n"
 
@@ -1884,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}