Remove sourcing /scripts/functions in components
[live-boot-grml.git] / components / 9990-main.sh
index e67176e..b585704 100755 (executable)
@@ -16,8 +16,6 @@ Live ()
        tail -f boot.log >&7 &
        tailpid="${!}"
 
-       . /live.vars
-
        LIVE_BOOT_CMDLINE="${LIVE_BOOT_CMDLINE:-$(cat /proc/cmdline)}"
        Cmdline_old
 
@@ -60,6 +58,7 @@ Live ()
                                then
                                        # We found a memdisk, set up phram
                                        modprobe phram phram=memdisk,${MEMDISK}
+                                       modprobe phram phram=memdisk,${MEMDISK}
 
                                        # Load mtdblock, the memdisk will be /dev/mtdblock0
                                        modprobe mtdblock
@@ -112,10 +111,10 @@ Live ()
        then
                losetup -d /dev/loop0
 
-               if is_mountpoint /live/fromiso
+               if is_mountpoint /run/live/fromiso
                then
-                       umount /live/fromiso
-                       rmdir --ignore-fail-on-non-empty /live/fromiso \
+                       umount /run/live/fromiso
+                       rmdir --ignore-fail-on-non-empty /run/live/fromiso \
                                >/dev/null 2>&1 || true
                fi
        fi
@@ -129,20 +128,6 @@ Live ()
                mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
        fi
 
-       # At this point /root should contain the final root filesystem.
-       # Move all mountpoints below /live into /root/lib/live/mount.
-       # This has to be done after mounting the root filesystem to /
-       # otherwise these mount points won't be accessible from the running system.
-       for _MOUNT in $(cat /proc/mounts | cut -f 2 -d " " | grep -e "^/live/")
-       do
-               local newmount
-               newmount="${rootmnt}/lib/live/mount/${_MOUNT#/live/}"
-               mkdir -p "${newmount}"
-               mount -o move "${_MOUNT}" "${newmount}" > /dev/null 2>&1 || \
-               mount -o bind "${_MOUNT}" "${newmount}" > /dev/null || \
-               log_warning_msg "W: failed to move or bindmount ${_MOUNT} to ${newmount}"
-       done
-
        if [ -n "${ROOT_PID}" ]
        then
                echo "${ROOT_PID}" > "${rootmnt}"/lib/live/root.pid
@@ -150,15 +135,6 @@ Live ()
 
        log_end_msg
 
-       # unionfs-fuse needs /dev to be bind-mounted for the duration of
-       # live-bottom; udev's init script will take care of things after that
-       case "${UNIONTYPE}" in
-               unionfs-fuse)
-                       mount -n -o bind /dev "${rootmnt}/dev"
-                       ;;
-       esac
-
-
        # aufs2 in kernel versions around 2.6.33 has a regression:
        # directories can't be accessed when read for the first the time,
        # causing a failure for example when accessing /var/lib/fai
@@ -172,18 +148,24 @@ Live ()
        then
                losetup -d /dev/loop0
 
-               if is_mountpoint /root/lib/live/mount/findiso
+               if is_mountpoint /run/live/findiso
                then
-                       umount /root/lib/live/mount/findiso
-                       rmdir --ignore-fail-on-non-empty /root/lib/live/mount/findiso \
+                       umount /run/live/findiso
+                       rmdir --ignore-fail-on-non-empty /run/live/findiso \
                                >/dev/null 2>&1 || true
                fi
        fi
 
-       if [ -f /etc/resolv.conf ] && [ ! -s ${rootmnt}/etc/resolv.conf ]
+       if [ -L /root/etc/resolv.conf ] ; then
+               # assume we have resolvconf
+               DNSFILE="${rootmnt}/etc/resolvconf/resolv.conf.d/base"
+       else
+               DNSFILE="${rootmnt}/etc/resolv.conf"
+       fi
+       if [ -f /etc/resolv.conf ] && ! grep -E -q -v '^[[:space:]]*#|^[[:space:]]*$' ${DNSFILE}
        then
-               log_begin_msg "Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf"
-               cp -v /etc/resolv.conf ${rootmnt}/etc/resolv.conf
+               log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
+               cp -v /etc/resolv.conf ${DNSFILE}
                log_end_msg
        fi
 
@@ -197,14 +179,10 @@ Live ()
 
        Swap
 
-       case "${UNIONFS}" in
-               unionfs-fuse)
-                       umount "${rootmnt}/dev"
-                       ;;
-       esac
-
        exec 1>&6 6>&-
        exec 2>&7 7>&-
        kill ${tailpid}
-       [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && cp boot.log "${rootmnt}/var/log/live" 2>/dev/null
+       [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && ( \
+                               cp boot.log "${rootmnt}/var/log/live" 2>/dev/null; \
+                               cp fsck.log "${rootmnt}/var/log/live" 2>/dev/null )
 }