Adding live-initramfs 1.91.6-1.
[live-boot-grml.git] / scripts / live
index 5397837..d52ae7c 100755 (executable)
@@ -7,7 +7,8 @@ export PATH=/root/usr/bin:/root/usr/sbin:/root/bin:/root/sbin:/usr/bin:/usr/sbin
 echo "/root/lib" >> /etc/ld.so.conf
 echo "/root/usr/lib" >> /etc/ld.so.conf
 
-mountpoint=/live_media
+mountpoint=/live/image
+LIVE_MEDIA_PATH="/live"
 
 root_persistence="live-rw"
 home_persistence="home-rw"
@@ -49,6 +50,13 @@ parse_cmdline ()
                                export DEFCONFSOLE
                                ;;
 
+                       debug)
+                               DEBUG="Yes"
+                               export DEBUG
+
+                               set -x
+                               ;;
+
                        hostname=*)
                                HOSTNAME=${x#hostname=}
                                LIVECONF="changed"
@@ -67,7 +75,7 @@ parse_cmdline ()
                                export USERFULLNAME LIVECONF
                                ;;
 
-                       ip*)
+                       ip=*)
                                STATICIP=${x#ip=}
 
                                if [ -z "${STATICIP}" ]
@@ -123,6 +131,11 @@ parse_cmdline ()
                                export LIVE_MEDIA_OFFSET
                                ;;
 
+                       live-media-path=*)
+                               LIVE_MEDIA_PATH="${x#live-media-path=}"
+                               export LIVE_MEDIA_PATH
+                               ;;
+
                        live-media-timeout=*)
                                LIVE_MEDIA_TIMEOUT=${x#live-media-timeout=}
                                export LIVE_MEDIA_TIMEOUT
@@ -138,12 +151,12 @@ parse_cmdline ()
                                export MODULE
                                ;;
 
-                       netboot*)
+                       netboot=*)
                                NETBOOT=${x#netboot=}
                                export NETBOOT
                                ;;
 
-                       nfsopts=)
+                       nfsopts=*)
                                NFSOPTS=${x#nfsopts=}
                                export NFSOPTS
                                ;;
@@ -201,7 +214,7 @@ parse_cmdline ()
                                export SHOWMOUNTS
                                ;;
 
-                      timezone=*)
+                       timezone=*)
                                TIMEZONE="${x#timezone=}"
                                export TIMEZONE
                                ;;
@@ -221,6 +234,11 @@ parse_cmdline ()
                                export UNIONTYPE
                                ;;
 
+                       utc=*)
+                               UTC="${x#utc=}"
+                               export UTC
+                               ;;
+
                        xdebconf)
                                XDEBCONF="Yes"
                                export XDEBCONF
@@ -264,11 +282,11 @@ is_live_path()
 {
        DIRECTORY="${1}"
 
-       if [ -d "${DIRECTORY}"/live ]
+       if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
        then
                for FILESYSTEM in squashfs ext2 ext3 xfs dir
                do
-                       if [ "`echo ${DIRECTORY}/live/*.${FILESYSTEM}`" != "${DIRECTORY}/live/*.${FILESYSTEM}" ]
+                       if [ "`echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}`" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
                        then
                                return 0
                        fi
@@ -305,11 +323,11 @@ match_files_in_dir() {
 mount_images_in_directory() {
     directory="$1"
     rootmnt="$2"
-    if match_files_in_dir "$directory/live/*.squashfs" ||
-        match_files_in_dir "$directory/live/*.ext2" ||
-        match_files_in_dir "$directory/live/*.ext3" ||
-        match_files_in_dir "$directory/live/*.dir"; then
-        setup_unionfs "$directory/live" "$rootmnt"
+    if match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.squashfs" ||
+        match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.ext2" ||
+        match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.ext3" ||
+        match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.dir"; then
+        setup_unionfs "$directory/${LIVE_MEDIA_PATH}" "$rootmnt"
     else
         :
     fi
@@ -390,6 +408,14 @@ do_netmount() {
         NFSROOT=${ROOTSERVER}:${ROOTPATH}
     fi
 
+    # source relevant ipconfig output
+    . /tmp/net-${DEVICE}.conf
+    export HOSTNAME
+
+    if [ "${NFSROOT#*:}" = "$NFSROOT" ] && [ "$NETBOOT" != "cifs" ]; then
+       NFSROOT=${ROOTSERVER}:${NFSROOT}
+    fi
+
     [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
 
     if [ "${NETBOOT}" != "nfs" ] && do_cifsmount ; then
@@ -659,8 +685,8 @@ setup_unionfs() {
     fi
 
     # shows cow fs on /cow for use by live-snapshot
-    mkdir -p "${rootmnt}/cow"
-    mount -o bind /cow "${rootmnt}/cow"
+    mkdir -p "${rootmnt}/live/cow"
+    mount -o bind /cow "${rootmnt}/live/cow"
 }
 
 check_dev ()
@@ -793,7 +819,7 @@ mountroot() {
         live_dest="${TODISK}"
     fi
     if [ "${live_dest}" ]; then
-        log_begin_msg "Copying live_media to ${live_dest}"
+        log_begin_msg "Copying live media to ${live_dest}"
         copy_live_to "${livefs_root}" "${live_dest}"
         log_end_msg
     fi