Mailinglist Archive: opensuse-commit (1081 mails)

< Previous Next >
commit mkinitrd
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Thu, 24 May 2007 12:21:50 +0200
  • Message-id: <20070524102150.C20E5678171@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package mkinitrd
checked in at Thu May 24 12:21:50 CEST 2007.

--------
--- mkinitrd/mkinitrd.changes   2007-05-22 18:58:37.000000000 +0200
+++ /mounts/work_src_done/STABLE/mkinitrd/mkinitrd.changes      2007-05-24 10:14:38.000000000 +0200
@@ -1,0 +2,7 @@
+Thu May 24 10:13:40 CEST 2007 - agraf@xxxxxxx
+
+- Resolve persistent device names for non-root-devices
+- Split resume into userspace and kernel resume
+- Proper error handling if anything goes wrong
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ mkinitrd.spec ++++++
--- /var/tmp/diff_new_pack.B13273/_old  2007-05-24 12:21:24.000000000 +0200
+++ /var/tmp/diff_new_pack.B13273/_new  2007-05-24 12:21:24.000000000 +0200
@@ -18,7 +18,7 @@
 Requires:       coreutils modutils util-linux grep gzip sed gawk cpio udev pciutils sysvinit file
 Autoreqprov:    on
 Version:        2.0
-Release:        8
+Release:        9
 Summary:        Creates an Initial RAM Disk Image for Preloading Modules
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        mkinitrd.tgz
@@ -92,6 +92,10 @@
 %doc %{_mandir}/man8/mkinitrd.8.gz
 
 %changelog
+* Thu May 24 2007 - agraf@xxxxxxx
+- Resolve persistent device names for non-root-devices
+- Split resume into userspace and kernel resume
+- Proper error handling if anything goes wrong
 * Tue May 22 2007 - agraf@xxxxxxx
 - Fixed sysconfig/kernel support again
 - Made mkinitrd abort more often if anything goes wrong

++++++ mkinitrd.tgz ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/boot/01-start.sh new/mkinitrd-2.0/lib/mkinitrd/boot/01-start.sh
--- old/mkinitrd-2.0/lib/mkinitrd/boot/01-start.sh      2007-05-22 18:51:26.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/boot/01-start.sh      2007-05-23 14:51:13.000000000 +0200
@@ -1,6 +1,6 @@
 #!/bin/bash
 #%programs: bash umount test mount mknod mkdir ln /sbin/blogd date sleep echo cat /bin/sed /sbin/insmod /sbin/modprobe expr kill /sbin/killall5 /sbin/halt /sbin/reboot /sbin/showconsole cp /sbin/pidof mv chmod rm true /bin/grep ls /lib/mkinitrd/bin/*
-#%modules: $INITRD_MODULES
+#%modules: $RESOLVED_INITRD_MODULES
 #%dontshow
 #
 ##### Initrd initialization
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/boot/07-xen.sh new/mkinitrd-2.0/lib/mkinitrd/boot/07-xen.sh
--- old/mkinitrd-2.0/lib/mkinitrd/boot/07-xen.sh        2007-05-02 16:10:04.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/boot/07-xen.sh        1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-#!/bin/bash
-#%requires: network
-#%if: "$is_xen"
-#%modules: $DOMU_INITRD_MODULES
-#
-##### xen initialization
-##
-## This script loads specific xen modules in case we are in a xen virtual machine
-##
-## Command line parameters
-## -----------------------
-##
-## 
-
-caps="$(</proc/xen/capabilities)"
-if [ "$caps" = "${caps%control_d*}" ]; then
-    dont_load_modules
-fi
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.sh new/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.sh
--- old/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.sh     2007-05-02 16:11:56.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.sh     1970-01-01 01:00:00.000000000 +0100
@@ -1,33 +0,0 @@
-#!/bin/bash
-#%requires: kdump
-#%programs: /sbin/resume
-#%if: -z "$is_kdump" -a -z "$kdump_kernel" -a -x /sbin/resume
-#
-##### software suspend resume
-##
-## If software suspending has suspended the computer before
-## this script tries to resume it to the state
-## it was before.
-##
-## Command line parameters
-## -----------------------
-##
-## resume              the device to resume from
-## 
-
-[ "$(set -u; $noresume && echo 1)" = "1" ] && resume_mode=off
-
-# Verify manual resume mode
-if [ "$resume_mode" != "off" -a -n "$resumedev" ]; then
-    if [ -x /sbin/resume -o -w /sys/power/resume ]; then
-       echo "Trying manual resume from $resumedev"
-       resume_mode=1
-    else
-       resumedev=
-    fi
-fi
-
-# Wait for udev to settle
-/sbin/udevsettle --timeout=$udev_timeout
-# Check for a resume device
-udev_discover_resume
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.userspace.sh new/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.userspace.sh
--- old/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.userspace.sh   1970-01-01 01:00:00.000000000 +0100
+++ new/mkinitrd-2.0/lib/mkinitrd/boot/18-resume.userspace.sh   2007-05-23 15:23:40.000000000 +0200
@@ -0,0 +1,52 @@
+#!/bin/bash
+#%if: -z "$is_kdump" -a -z "$kdump_kernel" -a '(' -x /usr/sbin/resume -o -x /sbin/resume ')'
+#%programs: /sbin/resume
+#
+##### software suspend resume
+##
+## If software suspending has suspended the computer before
+## this script tries to resume it to the state
+## it was before.
+## This is the implementation using a userspace program.
+##
+## Command line parameters
+## -----------------------
+##
+## resume              the device to resume from
+## 
+
+[ "$(set -u; $noresume && echo 1)" = "1" ] && resume_mode=off
+
+# Verify manual resume mode
+if [ "$resume_mode" != "off" -a -n "$resumedev" ]; then
+    if [ -x /sbin/resume -o -w /sys/power/resume ]; then
+       echo "Trying manual resume from $resumedev"
+       resume_mode=1
+    else
+       resumedev=
+    fi
+fi
+
+discover_user_resume() {
+    local resume devn major minor
+    if [ ! -f /sys/power/resume ] ; then
+       return
+    fi
+    if [ ! -e "$resumedev" ] ; then
+       echo "resume device $resumedev not found (ignoring)"
+       return
+    fi
+    # Waits for the resume device to appear
+    if [ "$resume_mode" != "off" ]; then
+       if [ -x /sbin/resume ]; then
+           echo "Invoking userspace resume from $resumedev"
+           /sbin/resume $resumedev
+       fi
+    fi
+}
+
+# Wait for udev to settle
+/sbin/udevsettle --timeout=$udev_timeout
+# Check for a resume device
+discover_user_resume
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/boot/19-mount.sh new/mkinitrd-2.0/lib/mkinitrd/boot/19-mount.sh
--- old/mkinitrd-2.0/lib/mkinitrd/boot/19-mount.sh      2007-05-21 13:16:12.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/boot/19-mount.sh      1970-01-01 01:00:00.000000000 +0100
@@ -1,85 +0,0 @@
-#!/bin/bash
-#%requires: resume
-#%programs: /sbin/fsck $rootfsck
-#%modules: $rootfstype 
-#%if: ! "$root_already_mounted"
-#%dontshow
-#
-##### mounting of the root device
-##
-## When all the device drivers and other systems have been successfully
-## activated and in case the root filesystem has not been mounted yet,
-## this will do it and fsck it if neccessary.
-##
-## Command line parameters
-## -----------------------
-##
-## rw          mount the root device read/write
-## ro          mount the root device read-only
-## 
-
-[ "$( ( set -u; echo $rw >/dev/null; echo 1 ) 2>/dev/null )" = "1" ] && read_write=1
-[ "$( ( set -u; echo $ro >/dev/null; echo 1 ) 2>/dev/null )" = "1" ] && read_write=
-
-# And now for the real thing
-if ! udev_discover_root ; then
-    echo "not found -- exiting to /bin/sh"
-    cd /
-    PATH=$PATH PS1='$ ' /bin/sh -i
-fi
-
-if [ -z "$rootfstype" ]; then
-    rootfstype=$(/lib/udev/vol_id -t $rootdev)
-    [ $? -ne 0 ] && rootfstype=
-    [ -n "$rootfstype" ] && [ "$rootfstype" = "unknown" ] && $rootfstype=
-fi
-
-# check filesystem if possible
-if [ -z "$rootfstype" ]; then
-    echo "invalid root filesystem -- exiting to /bin/sh"
-    cd /
-    PATH=$PATH PS1='$ ' /bin/sh -i
-elif [ -x "$rootfsck" ]; then
-    # fsck is unhappy without it
-    echo "$rootdev / $rootfstype defaults 1 1" > /etc/fstab
-    # Display progress bar if possible 
-    fsckopts="-V -a"
-    [ "`/sbin/showconsole`" = "/dev/tty1" ] && fsckopts="$fsckopts -C"
-    # Check external journal for reiserfs
-    [ "$rootfstype" = "reiserfs" -a -n "$journaldev" ] && fsckopts="-j $journaldev $fsckopts"
-    fsck -t $rootfstype $fsckopts $rootdev
-    # Return the fsck status
-    ROOTFS_FSCK=$?
-    export ROOTFS_FSCK
-    ROOTFS_FSTYPE=$rootfstype
-    export ROOTFS_FSTYPE
-    if [ $ROOTFS_FSCK -gt 1 -a $ROOTFS_FSCK -lt 4 ]; then
-        # reboot needed
-        echo "fsck succeeded, but reboot is required."
-        echo "Rebooting system."
-        /bin/reboot -d -f
-    elif [ $ROOTFS_FSCK -gt 3 ] ; then
-        echo "fsck failed. Mounting root device read-only."
-        read_write=
-    else
-        if [ "$read_only" ]; then
-            echo "fsck succeeded. Mounting root device read-only."
-            read_write=
-        else
-            echo "fsck succeeded. Mounting root device read-write."
-            read_write=1
-        fi
-    fi
-fi
-
-opt="-o ro"
-[ -n "$read_write" ] && opt="-o rw"
-
-# mount the actual root device on /root
-echo "Mounting root $rootdev"
-# check external journal
-[ "$rootfstype" = "xfs" -a -n "$journaldev" ] && opt="${opt},logdev=$journaldev"
-[ "$rootfstype" = "reiserfs" -a -n "$journaldev" ] && opt="${opt},jdev=$journaldev"
-[ -n "$rootflags" ] && opt="${opt},$rootflags"
-[ -n "$rootfstype" ] && opt="${opt} -t $rootfstype"
-mount $opt $rootdev /root || die 1
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/boot/19-resume.kernel.sh new/mkinitrd-2.0/lib/mkinitrd/boot/19-resume.kernel.sh
--- old/mkinitrd-2.0/lib/mkinitrd/boot/19-resume.kernel.sh      1970-01-01 01:00:00.000000000 +0100
+++ new/mkinitrd-2.0/lib/mkinitrd/boot/19-resume.kernel.sh      2007-05-23 15:25:18.000000000 +0200
@@ -0,0 +1,56 @@
+#!/bin/bash
+#%if: -z "$is_kdump" -a -z "$kdump_kernel"
+#
+##### software suspend resume
+##
+## If software suspending has suspended the computer before
+## this script tries to resume it to the state
+## it was before.
+## This implements the pure kernel level resume
+##
+## Command line parameters
+## -----------------------
+##
+## resume              the device to resume from
+## 
+
+[ "$(set -u; $noresume && echo 1)" = "1" ] && resume_mode=off
+
+# Verify manual resume mode
+if [ "$resume_mode" != "off" -a -n "$resumedev" ]; then
+    if [ -x /sbin/resume -o -w /sys/power/resume ]; then
+       echo "Trying manual resume from $resumedev"
+       resume_mode=1
+    else
+       resumedev=
+    fi
+fi
+
+discover_kernel_resume() {
+    local resume devn major minor
+    if [ ! -f /sys/power/resume ] ; then
+       return
+    fi
+    if [ -z "$resumedev" ] ; then
+       return
+    fi
+    # Waits for the resume device to appear
+    if [ "$resume_mode" != "off" ]; then
+       if [ -e $resumedev ] ; then
+           # Try major:minor number of the device node
+           devn=$(devnumber $resumedev)
+           major=$(devmajor $devn)
+           minor=$(devminor $devn)
+       fi
+       if [ -n "$major" -a -n "$minor" ]; then
+           echo "Invoking in-kernel resume from $resumedev"
+           echo "$major:$minor" > /sys/power/resume
+       else
+           echo "resume device $resumedev not found (ignoring)"
+       fi
+    fi
+}
+# Wait for udev to settle
+/sbin/udevsettle --timeout=$udev_timeout
+# Check for a resume device
+discover_kernel_resume
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/boot/20-mount.sh new/mkinitrd-2.0/lib/mkinitrd/boot/20-mount.sh
--- old/mkinitrd-2.0/lib/mkinitrd/boot/20-mount.sh      1970-01-01 01:00:00.000000000 +0100
+++ new/mkinitrd-2.0/lib/mkinitrd/boot/20-mount.sh      2007-05-21 13:16:12.000000000 +0200
@@ -0,0 +1,85 @@
+#!/bin/bash
+#%requires: resume
+#%programs: /sbin/fsck $rootfsck
+#%modules: $rootfstype 
+#%if: ! "$root_already_mounted"
+#%dontshow
+#
+##### mounting of the root device
+##
+## When all the device drivers and other systems have been successfully
+## activated and in case the root filesystem has not been mounted yet,
+## this will do it and fsck it if neccessary.
+##
+## Command line parameters
+## -----------------------
+##
+## rw          mount the root device read/write
+## ro          mount the root device read-only
+## 
+
+[ "$( ( set -u; echo $rw >/dev/null; echo 1 ) 2>/dev/null )" = "1" ] && read_write=1
+[ "$( ( set -u; echo $ro >/dev/null; echo 1 ) 2>/dev/null )" = "1" ] && read_write=
+
+# And now for the real thing
+if ! udev_discover_root ; then
+    echo "not found -- exiting to /bin/sh"
+    cd /
+    PATH=$PATH PS1='$ ' /bin/sh -i
+fi
+
+if [ -z "$rootfstype" ]; then
+    rootfstype=$(/lib/udev/vol_id -t $rootdev)
+    [ $? -ne 0 ] && rootfstype=
+    [ -n "$rootfstype" ] && [ "$rootfstype" = "unknown" ] && $rootfstype=
+fi
+
+# check filesystem if possible
+if [ -z "$rootfstype" ]; then
+    echo "invalid root filesystem -- exiting to /bin/sh"
+    cd /
+    PATH=$PATH PS1='$ ' /bin/sh -i
+elif [ -x "$rootfsck" ]; then
+    # fsck is unhappy without it
+    echo "$rootdev / $rootfstype defaults 1 1" > /etc/fstab
+    # Display progress bar if possible 
+    fsckopts="-V -a"
+    [ "`/sbin/showconsole`" = "/dev/tty1" ] && fsckopts="$fsckopts -C"
+    # Check external journal for reiserfs
+    [ "$rootfstype" = "reiserfs" -a -n "$journaldev" ] && fsckopts="-j $journaldev $fsckopts"
+    fsck -t $rootfstype $fsckopts $rootdev
+    # Return the fsck status
+    ROOTFS_FSCK=$?
+    export ROOTFS_FSCK
+    ROOTFS_FSTYPE=$rootfstype
+    export ROOTFS_FSTYPE
+    if [ $ROOTFS_FSCK -gt 1 -a $ROOTFS_FSCK -lt 4 ]; then
+        # reboot needed
+        echo "fsck succeeded, but reboot is required."
+        echo "Rebooting system."
+        /bin/reboot -d -f
+    elif [ $ROOTFS_FSCK -gt 3 ] ; then
+        echo "fsck failed. Mounting root device read-only."
+        read_write=
+    else
+        if [ "$read_only" ]; then
+            echo "fsck succeeded. Mounting root device read-only."
+            read_write=
+        else
+            echo "fsck succeeded. Mounting root device read-write."
+            read_write=1
+        fi
+    fi
+fi
+
+opt="-o ro"
+[ -n "$read_write" ] && opt="-o rw"
+
+# mount the actual root device on /root
+echo "Mounting root $rootdev"
+# check external journal
+[ "$rootfstype" = "xfs" -a -n "$journaldev" ] && opt="${opt},logdev=$journaldev"
+[ "$rootfstype" = "reiserfs" -a -n "$journaldev" ] && opt="${opt},jdev=$journaldev"
+[ -n "$rootflags" ] && opt="${opt},$rootflags"
+[ -n "$rootfstype" ] && opt="${opt} -t $rootfstype"
+mount $opt $rootdev /root || die 1
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/01-start.sh new/mkinitrd-2.0/lib/mkinitrd/setup/01-start.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/01-start.sh     2007-05-22 18:51:18.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/01-start.sh     2007-05-23 14:51:26.000000000 +0200
@@ -2,6 +2,20 @@
 
 shebang=/bin/bash
 
+is_xen_kernel() {
+    local kversion=$1
+    local cfg
+
+    for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
+    do
+       test -r $cfg || continue
+       grep -q "^CONFIG_XEN=y\$" $cfg
+       return
+    done
+    test $kversion != "${kversion%-xen*}"
+    return 
+}
+
 save_var arg
 save_var blogd_pid
 save_var build_day
@@ -101,6 +115,9 @@
 root="$rootdev"
 save_var root
 
-INITRD_MODULES="$modules"
-save_var INITRD_MODULES
-save_var domu_modules
+if is_xen_kernel $kernel_version; then
+    RESOLVED_INITRD_MODULES="$domu_modules"
+else
+    RESOLVED_INITRD_MODULES="$modules"
+fi
+save_var RESOLVED_INITRD_MODULES
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/05-kdump.sh new/mkinitrd-2.0/lib/mkinitrd/setup/05-kdump.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/05-kdump.sh     2007-05-04 12:45:41.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/05-kdump.sh     2007-05-23 14:30:47.000000000 +0200
@@ -5,7 +5,6 @@
     if [ -f /etc/sysconfig/kdump ] ; then
        . /etc/sysconfig/kdump
        dumpdev=$KDUMP_DUMPDEV
-       echo -e "Dump device:\t$dumpdev"
     fi
     is_kdump=1
 fi
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/06-xen.sh new/mkinitrd-2.0/lib/mkinitrd/setup/06-xen.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/06-xen.sh       2007-05-04 12:45:47.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/06-xen.sh       1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-is_xen_kernel() {
-    local kversion=$1
-    local cfg
-
-    for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
-    do
-       test -r $cfg || continue
-       grep -q "^CONFIG_XEN=y\$" $cfg
-       return
-    done
-    test $kversion != "${kversion%-xen*}"
-    return 
-}
-
-is_xen_kernel $kernel_version && is_xen=1
-save_var is_xen
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/070-storage.sh new/mkinitrd-2.0/lib/mkinitrd/setup/070-storage.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/070-storage.sh  2007-05-21 12:55:04.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/070-storage.sh  2007-05-24 10:12:01.000000000 +0200
@@ -99,6 +99,7 @@
                        echo $bd
                fi
        done
+       return 0
 }
 
 # this receives information about the current blockdev so each storage layer has access to it for its current blockdev
@@ -114,6 +115,9 @@
                fi
                blockminor="$(devminor $blockdevn)"
                blockdriver="$(block_driver $blockmajor)"
+               if [ ! "$blockdriver" ]; then
+                       error 1 "Fatal storage error. Device $curblockdev does not have a driver."
+               fi
                
                # temporary hack to have devicemapper activated whenever a dm device was found
                if [ "$blockdriver" = device-mapper ]; then
@@ -135,6 +139,48 @@
        fi
 }
 
+# usage: resolve_device <device label> <device node>
+resolve_device() {
+    local type="$1"
+    local x="$2"
+    local realrootdev="$2"
+
+    [ "$2" ] || exit 1
+
+    case "$rootdev" in
+      LABEL=*|UUID=*)
+       # get real root via fsck hack
+       realrootdev=$(fsck -N "$rootdev" \
+                     | sed -ne '2s/.* \/dev/\/dev/p' \
+                     | sed -e 's/  *//g')
+       if [ -z "$realrootdev" ] ; then
+           echo "Could not expand $rootdev to real device" >&2
+           exit 1
+       fi
+       realrootdev=$(/usr/bin/readlink -m $realrootdev)
+       ;;
+      /dev/disk/*)
+       realrootdev=$(/usr/bin/readlink -m $rootdev)
+       ;;
+      *:*)
+        if [ "$type" = "Root" ]; then
+           rootfstype=nfs
+           x="nfs-root"
+       fi
+       ;;
+    esac
+
+    [ "$2" != "$realrootdev" ] && x="$x ($realrootdev)"
+
+    echo -en "$type device:\t$x" >&2
+    if [ "$type" = "Root" ]; then
+       echo " (mounted on ${root_dir:-/} as $rootfstype)" >&2
+    else
+       echo >&2
+    fi
+    echo $realrootdev
+}
+
 #######################################################################################
 
 if [ -z "$rootdev" ] ; then
@@ -147,7 +193,7 @@
       rootfsopts="$fstab_options"
       break
     fi
-  done < <(sed -e '/^[         ]*#/d' < $root_dir/etc/fstab)
+  done < <(sed -e '/^[ \t]*#/d' < $root_dir/etc/fstab)
 else
   # get type from /etc/fstab or /proc/mounts (actually not needed)
   x1=$(cat $root_dir/etc/fstab /proc/mounts 2>/dev/null \
@@ -155,26 +201,6 @@
   rootfstype=$(echo $x1 | cut -f 3 -d " ")
 fi
 
-realrootdev="$rootdev"
-case "$rootdev" in
-    LABEL=*|UUID=*)
-       # get real root via fsck hack
-       realrootdev=$(fsck -N "$rootdev" \
-                     | sed -ne '2s/.* \/dev/\/dev/p' \
-                     | sed -e 's/  *//g')
-       if [ -z "$realrootdev" ] ; then
-           error 1 "Could not expand $rootdev to real device"
-       fi
-       realrootdev=$(/usr/bin/readlink -m $realrootdev)
-       ;;
-    /dev/disk/*)
-       realrootdev=$(/usr/bin/readlink -m $rootdev)
-       ;;
-    *:*)
-       rootfstype=nfs
-       ;;
-esac
-
 # check for journal device
 if [ "$rootfsopts" -a -z "$journaldev" ] ; then
     jdev=${rootfsopts#*,jdev=}
@@ -187,12 +213,6 @@
     fi
 fi
 
-# TODO: split up
-x="$rootdev"
-[ "$rootfstype" = "nfs" ] && x="nfs-root"
-[ "$iscsi_root" ] && x="$(cat /sys/class/iscsi_session/$iscsi_root/targetname)"
-[ "$rootdev" != "$realrootdev" ] && x="$x ($realrootdev)"
-
 # WARNING: dirty hack to get the resume device of the current system
 for o in $(cat /proc/cmdline); do
     case "$o" in
@@ -202,14 +222,35 @@
     esac
 done
 
+# check for nfs root and set the rootfstype accordingly
+case "$rootdev" in
+      /dev/*)
+        if [ ! -e "$rootdev" ]; then
+           error 1 "Root device not found"
+       fi
+       ;;
+      *:*)
+       rootfstype=nfs
+       ;;
+esac
+
+if [ -z "$rootfstype" ]; then
+    rootfstype=$(/lib/udev/vol_id -t $rootdev)
+    [ $? -ne 0 ] && rootfstype=
+    [ "$rootfstype" = "unknown" ] && $rootfstype=
+fi
+
+if [ ! "$rootfstype" ]; then
+    error 1 "Could not find the filesystem type for root device $rootdev"
+fi
 
-echo -e "Root device:\t$x (mounted on ${root_dir:-/} as $rootfstype)"
-[ "$resumedev" ] && echo -e "Resume device:\t$resumedev"
-[ "$journaldev" ] && echo -e "Journal device:\t$journaldev"
+if ! modprobe -q $rootfstype; then
+    error 1 "Could not find the filesystem module for root device $rootdev ($rootfstype)"
+fi
 
 # blockdev is the current block device depending on the layered storage script we are in
 # It will get replaced through its way of abstraction, starting at the information mount tell us
 # and ending at the block device
 
-blockdev="$realrootdev $resumedev $journaldev $dumpdev"
+blockdev="$(resolve_device Root $rootdev) $(resolve_device Resume $resumedev) $(resolve_device Journal $journaldev) $(resolve_device Dump $dumpdev)"
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/071-luks.sh new/mkinitrd-2.0/lib/mkinitrd/setup/071-luks.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/071-luks.sh     2007-05-04 12:45:53.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/071-luks.sh     2007-05-24 09:45:01.000000000 +0200
@@ -10,6 +10,7 @@
        luks_blockminor=$blockminor
        # luksbd holds the device, LUKS is running on
        for luksbd in $(dm_resolvedeps $bd); do # should only be one for luks
+               [ $? -eq 0 ] || return 1
                update_blockdev $luksbd
                if /sbin/cryptsetup isLuks $luksbd 2>/dev/null; then
                        root_luks=1
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/072-evms.sh new/mkinitrd-2.0/lib/mkinitrd/setup/072-evms.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/072-evms.sh     2007-05-07 10:59:19.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/072-evms.sh     2007-05-24 09:45:22.000000000 +0200
@@ -149,6 +149,7 @@
                    realrootdev=$volume
                    # blockdev="$(get_evms_devices $blockdev)"
                    evms_blockdev="$evms_blockdev $(dm_resolvedeps $blockdev)"
+                   [ $? -eq 0 ] || return 1
                fi
            fi
        fi
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/072-lvm2.sh new/mkinitrd-2.0/lib/mkinitrd/setup/072-lvm2.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/072-lvm2.sh     2007-05-04 12:46:01.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/072-lvm2.sh     2007-05-24 09:45:07.000000000 +0200
@@ -19,6 +19,7 @@
        realrootdev=${vg_dev##  }
 #      blockdev=$(vgs --noheadings --options devices $vg_root 2> /dev/null | sed -n "s@ *\(/dev/.*\)([0-9]*) *@\1@p" | sort | uniq)
        lvm_blockdev="$lvm_blockdev $(dm_resolvedeps $blockdev)"
+       [ $? -eq 0 ] || return 1
        vg_roots="$vg_roots $vg_root"
     else
        lvm_blockdev="$lvm_blockdev $bd"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/079-block.sh new/mkinitrd-2.0/lib/mkinitrd/setup/079-block.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/079-block.sh    2007-05-21 13:20:20.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/079-block.sh    2007-05-24 09:45:12.000000000 +0200
@@ -72,6 +72,7 @@
              /dev*) 
                update_blockdev $bd
                curmodule="$(get_devmodule ${bd##*/})"
+               [ $? -eq 0 ] || return 1
                for curmodule_i in $curmodule; do
                    verbose "[BLOCK] $bd -> $curmodule_i"
                done
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/07b-nfs.sh new/mkinitrd-2.0/lib/mkinitrd/setup/07b-nfs.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/07b-nfs.sh      2007-05-07 11:41:55.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/07b-nfs.sh      2007-05-24 10:03:33.000000000 +0200
@@ -14,7 +14,7 @@
     fi
 fi
 
-if [ $rootfstype = "nfs" ]; then
+if [ "$rootfstype" = "nfs" ]; then
        interface=default
        save_var rootfstype
 fi
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/50-modules.sh new/mkinitrd-2.0/lib/mkinitrd/setup/50-modules.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/50-modules.sh   2007-05-11 14:01:16.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/50-modules.sh   2007-05-23 14:58:56.000000000 +0200
@@ -71,9 +71,12 @@
 }
 
 # gather all the modules we are supposed to copy
+modules=
 for script in $INITRD_PATH/boot/*; do
     if use_script "$script"; then # only include the modules if the script gets used
+       verbose -n ""
        for module in $(cat $script | egrep '%udevmodules: |%modules: ' | sed 's/^.*s: \(.*\)$/\1/'); do
+           [ "$module" ] && verbose "[MODULES]\t$(basename $script): $(eval echo $module)"
            modules="$modules $(eval echo $module)"
        done
     fi
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/lib/mkinitrd/setup/51-progs.sh new/mkinitrd-2.0/lib/mkinitrd/setup/51-progs.sh
--- old/mkinitrd-2.0/lib/mkinitrd/setup/51-progs.sh     2007-05-11 14:01:16.000000000 +0200
+++ new/mkinitrd-2.0/lib/mkinitrd/setup/51-progs.sh     2007-05-24 09:45:17.000000000 +0200
@@ -106,6 +106,7 @@
     # Copy all required shared libraries and the symlinks that
     # refer to them.
     lib_files=$(shared_object_files "${initrd_bins[@]}")
+    [ $? -eq 0 ] || return 1
     if [ -n "$lib_files" ]; then
        for lib in $lib_files; do
 #          [ -L $root_dir/$lib ] || echo -n "$lib "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mkinitrd-2.0/mkinitrd new/mkinitrd-2.0/mkinitrd
--- old/mkinitrd-2.0/mkinitrd   2007-05-22 18:50:45.000000000 +0200
+++ new/mkinitrd-2.0/mkinitrd   2007-05-24 09:59:53.000000000 +0200
@@ -338,6 +338,7 @@
 
 cleanup() {
     rm -f $tmp_initrd $tmp_initrd.gz
+    [ -d "$tmp_mnt" ] && rm -rf "$tmp_mnt"
     initrd_bins=()
 }
 
@@ -358,14 +359,14 @@
 trap handle_terminate 1 2 3 15
 
 error() {
-    echo "$2" >&2
-    cleanup
-    cleanup_finish
-    exit $1
+    touch "$work_dir/error"
+    oops "$@"
 }
 
 oops() {
-    error "$@"
+    echo "$2" >&2
+    cleanup
+    exit $1
 }
 
 ##################################################
@@ -428,6 +429,8 @@
 #boot_modules="$modules"
 #echo -e "User-defined Module list:\t$boot_modules ($domu_modules)"
 for ((i=0 ; $i<${#kernel_images[@]} ; i++)); do
+    ( # start in a subshell so the different mkinitrd build processes
+      # don't interfere
     echo
 #    modules="$boot_modules"
     kernel_image=${kernel_images[$i]}
@@ -438,10 +441,8 @@
     [ ${initrd_image:0:1} != '/' ] \
        && initrd_image=$boot_dir/$initrd_image
 
-    ( # start in a subshell so the different mkinitrd build processes
-      # don't interfere
     mkinitrd_kernel $kernel_image $initrd_image
-    )
+    [ $? -eq 0 ] || exit 1
 
     # If the current $kernel_image has a symlink without "-<version>" (e.g.
     # "vmlinuz") pointing to it, create an "initrd" symlink for the
@@ -452,6 +453,8 @@
        ln -s "${initrd_image#$boot_dir/}" $root_dir/$boot_dir/initrd
     fi
     cleanup
+    )
+    [ -e "$work_dir/error" ] && break
 done
 
 cleanup_finish


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >