Removing ubuntu support.
[live-boot-grml.git] / scripts / live
index b1157c5..b4254e1 100755 (executable)
@@ -18,12 +18,11 @@ home_snapshot_label="home-sn"
 USERNAME="user"
 USERFULLNAME="Live user"
 HOSTNAME="host"
-BUILD_SYSTEM="Custom"
 
 mkdir -p "${mountpoint}"
 
 [ -f /etc/live.conf ] && . /etc/live.conf
-export USERNAME USERFULLNAME HOSTNAME BUILD_SYSTEM
+export USERNAME USERFULLNAME HOSTNAME
 
 . /scripts/live-helpers
 
@@ -79,6 +78,11 @@ Arguments ()
                                export USERFULLNAME LIVECONF
                                ;;
 
+                       ignore_uuid)
+                               IGNORE_UUID="Yes"
+                               export IGNORE_UUID
+                               ;;
+
                        ip=*)
                                STATICIP="${ARGUMENT#ip=}"
 
@@ -434,6 +438,31 @@ is_live_path ()
        return 1
 }
 
+matches_uuid ()
+{
+       if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
+       then
+               return 0
+       fi
+
+       path="${1}"
+       uuid="$(cat /conf/uuid.conf)"
+
+       for try_uuid_file in "${mountpoint}/.disk/casper-uuid"*
+       do
+               [ -e "${try_uuid_file}" ] || continue
+
+               try_uuid="$(cat "${try_uuid_file}")"
+
+               if [ "${uuid}" = "${try_uuid}" ]
+               then
+                       return 0
+               fi
+       done
+
+       return 1
+}
+
 get_backing_device ()
 {
        case "${1}" in
@@ -588,7 +617,7 @@ do_netmount ()
 {
        rc=1
 
-       modprobe "${MP_QUIET}" af_packet # For DHCP
+       modprobe -q af_packet # For DHCP
 
        udevtrigger
        udevsettle
@@ -658,7 +687,7 @@ do_nfsmount ()
 {
        rc=1
 
-       modprobe "${MP_QUIET}" nfs
+       modprobe -q nfs
 
        if [ -z "${NFSOPTS}" ]
        then
@@ -691,7 +720,7 @@ do_cifsmount ()
                fi
 
                [ "${quiet}" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
-               modprobe "${MP_QUIET}" cifs
+               modprobe -q cifs
 
                if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
                then
@@ -831,7 +860,7 @@ setup_unionfs ()
        image_directory="${1}"
        rootmnt="${2}"
 
-       modprobe "${MP_QUIET}" -b ${UNIONTYPE}
+       modprobe -q -b ${UNIONTYPE}
 
        # run-init can't deal with images in a subdir, but we're going to
        # move all of these away before it runs anyway.  No, we're not,
@@ -983,6 +1012,7 @@ check_dev ()
 {
        sysdev="${1}"
        devname="${2}"
+       skip_uuid_check="${3}"
 
        if [ -z "${devname}" ]
        then
@@ -1001,7 +1031,8 @@ check_dev ()
        then
                mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
 
-               if is_live_path ${mountpoint}
+               if is_live_path ${mountpoint} && \
+                       ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
                then
                        echo ${mountpoint}
                        return 0
@@ -1025,7 +1056,7 @@ find_livefs ()
        # first look at the one specified in the command line
        if [ ! -z "${LIVE_MEDIA}" ]
        then
-               if check_dev "null" "${LIVE_MEDIA}"
+               if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
                then
                        return 0
                fi