SVN: geninitrd/trunk: ChangeLog functions geninitrd
glen
glen at pld-linux.org
Thu Feb 8 19:38:12 CET 2007
Author: glen
Date: Thu Feb 8 19:38:12 2007
New Revision: 8243
Modified:
geninitrd/trunk/ChangeLog
geninitrd/trunk/functions
geninitrd/trunk/geninitrd
Log:
- find_root() will return lvm2 nodes in form /dev/VG/LV
Modified: geninitrd/trunk/ChangeLog
==============================================================================
--- geninitrd/trunk/ChangeLog (original)
+++ geninitrd/trunk/ChangeLog Thu Feb 8 19:38:12 2007
@@ -1,3 +1,15 @@
+2007-02-08 18:26 +0000 [r8241-8242] Elan Ruusamäe <glen/at/pld-linux.org>
+
+ * Makefile: - include functions in tarball
+
+ * geninitrd, functions: - allow setting prefix for function
+ messages via $PROGRAM global
+
+2007-02-08 18:21 +0000 [r8240] Elan Ruusamäe <glen/at/pld-linux.org>
+
+ * Makefile, geninitrd, functions (added): - export functions so
+ other programs could reuse code - find_root() for now
+
2007-02-07 10:58 +0000 [r8236-8237] Elan Ruusamäe <glen/at/pld-linux.org>
* geninitrd: - drop $orig_rootdev, as $rootdev is the same variable
Modified: geninitrd/trunk/functions
==============================================================================
--- geninitrd/trunk/functions (original)
+++ geninitrd/trunk/functions Thu Feb 8 19:38:12 2007
@@ -51,6 +51,14 @@
;;
esac
+ if [[ "$rootdev" = /dev/dm-* ]]; then
+ local node
+ node=$(dm_lvm2_name "$rootdev") || exit
+ if [ "$node" ]; then
+ rootdev="$node"
+ fi
+ fi
+
if [ ! -r "$rootdev" ]; then
echo >&2 "$function: can't find real device for $rootdev"
return 1
@@ -58,3 +66,28 @@
return 0
}
+
+# resolve /dev/dm-0 to lvm2 node
+# which they got from /proc/partitions when rootfs is UUID=
+dm_lvm2_name() {
+ local node="$1"
+
+ # redirect output to tmpfile so we won't get subshell
+ local tmp ret
+ tmp=$(mktemp) || exit
+
+ /sbin/lvdisplay -c 2>/dev/null | awk -F: '{print $1}' > $tmp
+ while read dev; do
+ count=$(ls -Ll $dev $node | awk '{print $5, $6}' | sort -u | wc -l)
+ if [ "$count" = 1 ]; then
+ ret="$dev"
+ break
+ fi
+ done < $tmp
+ rm -f $tmp
+
+ if [ -z "$ret" ]; then
+ ret=$node
+ fi
+ echo "$ret"
+}
Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd (original)
+++ geninitrd/trunk/geninitrd Thu Feb 8 19:38:12 2007
@@ -409,31 +409,6 @@
fi
}
-# resolve /dev/dm-0 to lvm2 node
-# which they got from /proc/partitions when rootfs is UUID=
-_lvm2_node_resolve() {
- local node="$1"
-
- # redirect output to tmpfile so we won't get subshell
- local tmp ret
- tmp=$(mktemp) || exit 1
-
- lvdisplay -c 2>/dev/null|awk -F: '{print $1}' > $tmp
- while read dev; do
- count=$(ls -Ll $dev $node | awk '{print $5, $6}' | sort -u | wc -l)
- if [ "$count" = 1 ]; then
- ret="$dev"
- break
- fi
- done < $tmp
- rm -f $tmp
-
- if [ -z "$ret" ]; then
- ret=$node
- fi
- echo "$ret"
-}
-
# return true if node is lvm node
_check_lvm() {
local node="$1"
@@ -452,7 +427,6 @@
return 0
fi
- node=$(_lvm2_node_resolve $node)
/sbin/lvm lvdisplay "$node" > /dev/null 2>&1
rc=$?
if [ $rc -gt 127 ]; then
@@ -540,7 +514,7 @@
findmodule "-$loopFs"
BASICMODULES="$BASICMODULES -${loopFs}"
elif _check_lvm "$1"; then
- node=$(_lvm2_node_resolve "$1")
+ node="$1"
if [ ! -f /sbin/initrd-lvm -o ! -x /sbin/lvdisplay -o ! -x /sbin/pvdisplay ] ; then
echo "ERROR: root on LVM but /sbin/initrd-lvm, /sbin/lvdisplay and /sbin/pvdisplay not found." >&2
@@ -1281,7 +1255,6 @@
echo "umount /dev" >> "$s"
echo "umount /proc" >> "$s"
else
- rootdev=$(_lvm2_node_resolve "$rootdev")
echo "cat /etc/lvm.conf > /tmp/lvm.conf" >> "$s"
echo "global {" > "$MNTIMAGE/etc/lvm.conf"
echo " locking_type = 0" >> "$MNTIMAGE/etc/lvm.conf"
More information about the pld-cvs-commit
mailing list