mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [PATCH 00/13] Changes 2009-06-19
@ 2009-06-19 11:05 Harald Hoyer
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

Harald Hoyer (13):
  moved test-init to TEST-10-RAID
  uncomment hard-off for TEST-30-ISCSI
  do not poweroff in TEST-30-ISCSI, if rdinitdebug is set
  do not poweroff in TEST-10-RAID if rdinitdebug is set
  prepare udev rules for udev >= 143
  install rules to ignore some devices
  make iSCSI boot with root=dhcp and mount partitions labeled with
    "ROOT" or "/"
  manpage iSCSI update
  add rdblacklist command line parameter
  updated switch_root.c
  dracut.spec without switch_root
  renamed dracut-lib to dracut-lib.sh
  removed shebang from .sh and changed mode to 0644

 Makefile                                   |    2 +-
 dracut.8                                   |   10 +-
 dracut.spec                                |   10 ++
 modules.d/40network/dhclient-script        |    2 +-
 modules.d/40network/ifup                   |    2 +-
 modules.d/40network/netroot                |    2 +-
 modules.d/50plymouth/plymouth-emergency.sh |    1 -
 modules.d/90crypt/63-luks.rules            |   12 --
 modules.d/90crypt/70-luks.rules            |   12 ++
 modules.d/90crypt/install                  |    2 +-
 modules.d/90dmraid/dmraid.sh               |    1 -
 modules.d/90lvm/64-lvm-vol_id.rules        |   20 +++
 modules.d/90lvm/64-lvm.rules               |    9 +-
 modules.d/90lvm/install                    |    6 +-
 modules.d/90mdraid/65-md-incremental.rules |    8 +
 modules.d/90mdraid/install                 |    9 +-
 modules.d/95iscsi/iscsiroot                |   10 +-
 modules.d/95nbd/61-nbd-vol_id.rules        |    7 +
 modules.d/95nbd/61-nbd.rules               |    4 +-
 modules.d/95nbd/install                    |    8 +-
 modules.d/95nbd/nbdroot                    |    2 +-
 modules.d/95nfs/nfsroot                    |    2 +-
 modules.d/95udev-rules/01-ignore.rules     |    1 +
 modules.d/95udev-rules/install             |   10 +-
 modules.d/99base/dracut-lib                |   62 --------
 modules.d/99base/dracut-lib.sh             |   55 +++++++
 modules.d/99base/init                      |    2 +-
 modules.d/99base/install                   |    8 +-
 modules.d/99base/parse-blacklist.sh        |   10 ++
 switch_root.c                              |  232 ++++++++++++++--------------
 test/TEST-10-RAID/hard-off.sh              |    2 +-
 test/TEST-10-RAID/test-init                |   10 ++
 test/TEST-10-RAID/test.sh                  |    2 +-
 test/TEST-30-ISCSI/dhcpd.conf              |    2 +-
 test/TEST-30-ISCSI/hard-off.sh             |    2 +-
 test/TEST-30-ISCSI/test.sh                 |    6 +-
 test/test-init                             |   10 --
 37 files changed, 323 insertions(+), 232 deletions(-)
 delete mode 100644 modules.d/90crypt/63-luks.rules
 create mode 100644 modules.d/90crypt/70-luks.rules
 create mode 100644 modules.d/90lvm/64-lvm-vol_id.rules
 create mode 100644 modules.d/90mdraid/65-md-incremental.rules
 create mode 100644 modules.d/95nbd/61-nbd-vol_id.rules
 mode change 100755 => 100644 modules.d/95resume/resume-genrules.sh
 mode change 100755 => 100644 modules.d/95rootfs-block/block-genrules.sh
 mode change 100755 => 100644 modules.d/95rootfs-block/parse-block.sh
 create mode 100644 modules.d/95udev-rules/01-ignore.rules
 delete mode 100644 modules.d/99base/dracut-lib
 create mode 100644 modules.d/99base/dracut-lib.sh
 create mode 100755 modules.d/99base/parse-blacklist.sh
 mode change 100755 => 100644 modules.d/99base/parse-root-opts.sh
 create mode 100755 test/TEST-10-RAID/test-init
 delete mode 100755 test/test-init

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 01/13] moved test-init to TEST-10-RAID
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 02/13] uncomment hard-off for TEST-30-ISCSI Harald Hoyer
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 test/TEST-10-RAID/test-init |   10 ++++++++++
 test/TEST-10-RAID/test.sh   |    2 +-
 test/test-init              |   10 ----------
 3 files changed, 11 insertions(+), 11 deletions(-)
 create mode 100755 test/TEST-10-RAID/test-init
 delete mode 100755 test/test-init

diff --git a/test/TEST-10-RAID/test-init b/test/TEST-10-RAID/test-init
new file mode 100755
index 0000000..ccdc9a4
--- /dev/null
+++ b/test/TEST-10-RAID/test-init
@@ -0,0 +1,10 @@
+#!/bin/sh
+exec >/dev/console 2>&1
+echo "dracut-root-block-success" >/dev/sda1
+export TERM=linux
+export PS1='initramfs-test:\w\$ '
+[ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
+stty sane
+echo "made it to the rootfs! Powering down."
+mount -n -o remount,ro /
+poweroff -f
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index 59ae01e..501b03e 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -28,7 +28,7 @@ test_setup() {
 	inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
 	inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
 	dracut_install grep
-	inst $testdir/test-init /sbin/init
+	inst ./test-init /sbin/init
 	find_binary plymouth >/dev/null && dracut_install plymouth
 	(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
     )
diff --git a/test/test-init b/test/test-init
deleted file mode 100755
index ccdc9a4..0000000
--- a/test/test-init
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-exec >/dev/console 2>&1
-echo "dracut-root-block-success" >/dev/sda1
-export TERM=linux
-export PS1='initramfs-test:\w\$ '
-[ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
-stty sane
-echo "made it to the rootfs! Powering down."
-mount -n -o remount,ro /
-poweroff -f
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 02/13] uncomment hard-off for TEST-30-ISCSI
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-06-19 11:05   ` [PATCH 01/13] moved test-init to TEST-10-RAID Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 03/13] do not poweroff in TEST-30-ISCSI, if rdinitdebug is set Harald Hoyer
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 test/TEST-30-ISCSI/test.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 3fd6bd3..134ee73 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -3,7 +3,7 @@ TEST_DESCRIPTION="root filesystem over iSCSI"
 
 KVERSION=${KVERSION-$(uname -r)}
 
-#DEBUGFAIL="rdinitdebug rdnetdebug udevinfo"
+#DEBUGFAIL="rdinitdebug rdnetdebug rdudevinfo"
 
 run_server() {
     # Start server first
@@ -110,7 +110,7 @@ test_setup() {
 	initdir=overlay
 	. $basedir/dracut-functions
 	dracut_install poweroff shutdown
-#	inst_simple ./hard-off.sh /emergency/01hard-off.sh
+	inst_simple ./hard-off.sh /emergency/01hard-off.sh
 #	inst ./cryptroot-ask /sbin/cryptroot-ask
     )
 #	-m "debug dash crypt lvm mdraid udev-rules base rootfs-block iscsi" \
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 03/13] do not poweroff in TEST-30-ISCSI, if rdinitdebug is set
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-06-19 11:05   ` [PATCH 01/13] moved test-init to TEST-10-RAID Harald Hoyer
  2009-06-19 11:05   ` [PATCH 02/13] uncomment hard-off for TEST-30-ISCSI Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 04/13] do not poweroff in TEST-10-RAID " Harald Hoyer
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 test/TEST-30-ISCSI/hard-off.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/TEST-30-ISCSI/hard-off.sh b/test/TEST-30-ISCSI/hard-off.sh
index 92dd304..85fd849 100755
--- a/test/TEST-30-ISCSI/hard-off.sh
+++ b/test/TEST-30-ISCSI/hard-off.sh
@@ -1,2 +1,2 @@
 #!/bin/sh
-poweroff -f
\ No newline at end of file
+getarg rdinitdebug || poweroff -f
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 04/13] do not poweroff in TEST-10-RAID if rdinitdebug is set
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 03/13] do not poweroff in TEST-30-ISCSI, if rdinitdebug is set Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 05/13] prepare udev rules for udev >= 143 Harald Hoyer
                     ` (8 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 test/TEST-10-RAID/hard-off.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/TEST-10-RAID/hard-off.sh b/test/TEST-10-RAID/hard-off.sh
index 92dd304..85fd849 100755
--- a/test/TEST-10-RAID/hard-off.sh
+++ b/test/TEST-10-RAID/hard-off.sh
@@ -1,2 +1,2 @@
 #!/bin/sh
-poweroff -f
\ No newline at end of file
+getarg rdinitdebug || poweroff -f
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 05/13] prepare udev rules for udev >= 143
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (3 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 04/13] do not poweroff in TEST-10-RAID " Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
       [not found]     ` <1245409551-30493-6-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-06-19 11:05   ` [PATCH 06/13] install rules to ignore some devices Harald Hoyer
                     ` (7 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 modules.d/90crypt/63-luks.rules            |   12 ------------
 modules.d/90crypt/70-luks.rules            |   12 ++++++++++++
 modules.d/90crypt/install                  |    2 +-
 modules.d/90lvm/64-lvm-vol_id.rules        |   20 ++++++++++++++++++++
 modules.d/90lvm/64-lvm.rules               |    9 ++++++++-
 modules.d/90lvm/install                    |    6 +++++-
 modules.d/90mdraid/65-md-incremental.rules |    8 ++++++++
 modules.d/90mdraid/install                 |    9 ++++++++-
 modules.d/95nbd/61-nbd-vol_id.rules        |    7 +++++++
 modules.d/95nbd/61-nbd.rules               |    4 ++--
 modules.d/95nbd/install                    |    8 +++++++-
 modules.d/95udev-rules/install             |    6 +++++-
 12 files changed, 83 insertions(+), 20 deletions(-)
 delete mode 100644 modules.d/90crypt/63-luks.rules
 create mode 100644 modules.d/90crypt/70-luks.rules
 create mode 100644 modules.d/90lvm/64-lvm-vol_id.rules
 create mode 100644 modules.d/90mdraid/65-md-incremental.rules
 create mode 100644 modules.d/95nbd/61-nbd-vol_id.rules

diff --git a/modules.d/90crypt/63-luks.rules b/modules.d/90crypt/63-luks.rules
deleted file mode 100644
index cfa619b..0000000
--- a/modules.d/90crypt/63-luks.rules
+++ /dev/null
@@ -1,12 +0,0 @@
-# hacky rules to try to try unlocking dm-crypt devs
-#
-# Copyright 2008, Red Hat, Inc.
-# Jeremy Katz <katzj-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
-
-
-SUBSYSTEM!="block", GOTO="luks_end"
-ACTION!="add|change", GOTO="luks_end"
-
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
-
-LABEL="luks_end"
diff --git a/modules.d/90crypt/70-luks.rules b/modules.d/90crypt/70-luks.rules
new file mode 100644
index 0000000..cfa619b
--- /dev/null
+++ b/modules.d/90crypt/70-luks.rules
@@ -0,0 +1,12 @@
+# hacky rules to try to try unlocking dm-crypt devs
+#
+# Copyright 2008, Red Hat, Inc.
+# Jeremy Katz <katzj-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
+
+
+SUBSYSTEM!="block", GOTO="luks_end"
+ACTION!="add|change", GOTO="luks_end"
+
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
+
+LABEL="luks_end"
diff --git a/modules.d/90crypt/install b/modules.d/90crypt/install
index fcaaa60..a3a856d 100755
--- a/modules.d/90crypt/install
+++ b/modules.d/90crypt/install
@@ -1,5 +1,5 @@
 #!/bin/bash
 inst cryptsetup
 instmods dm_crypt cbc aes sha256 xts
-inst_rules "$moddir/63-luks.rules"
+inst_rules "$moddir/70-luks.rules"
 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
diff --git a/modules.d/90lvm/64-lvm-vol_id.rules b/modules.d/90lvm/64-lvm-vol_id.rules
new file mode 100644
index 0000000..d4b5269
--- /dev/null
+++ b/modules.d/90lvm/64-lvm-vol_id.rules
@@ -0,0 +1,20 @@
+# hacky rules to try to activate lvm when we get new block devs...
+#
+# Copyright 2008, Red Hat, Inc.
+# Jeremy Katz <katzj-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
+
+
+SUBSYSTEM!="block", GOTO="lvm_end"
+ACTION!="add|change", GOTO="lvm_end"
+KERNEL!="dm-*", GOTO="lvm_end"
+
+IMPORT{program}="vol_id --export $tempnode"
+
+ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
+
+OPTIONS="link_priority=-100"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+
+LABEL="lvm_end"
diff --git a/modules.d/90lvm/64-lvm.rules b/modules.d/90lvm/64-lvm.rules
index 8a2fcc4..3eddd07 100644
--- a/modules.d/90lvm/64-lvm.rules
+++ b/modules.d/90lvm/64-lvm.rules
@@ -6,8 +6,15 @@
 
 SUBSYSTEM!="block", GOTO="lvm_end"
 ACTION!="add|change", GOTO="lvm_end"
+KERNEL!="dm-*", GOTO="lvm_end"
+
+IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
 
-KERNEL=="dm-[0-9]*", IMPORT{program}="vol_id --export $tempnode"
 ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
 
+OPTIONS="link_priority=-100"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+
 LABEL="lvm_end"
diff --git a/modules.d/90lvm/install b/modules.d/90lvm/install
index d32748b..48f6ec7 100755
--- a/modules.d/90lvm/install
+++ b/modules.d/90lvm/install
@@ -1,3 +1,7 @@
 #!/bin/bash
 inst lvm
-inst_rules "$moddir/64-lvm.rules" 64-device-mapper.rules
\ No newline at end of file
+if [ -x /lib/udev/vol_id ]; then
+    inst_rules "$moddir/64-lvm-vol_id.rules" 64-device-mapper.rules
+else
+    inst_rules "$moddir/64-lvm.rules" 64-device-mapper.rules
+fi
diff --git a/modules.d/90mdraid/65-md-incremental.rules b/modules.d/90mdraid/65-md-incremental.rules
new file mode 100644
index 0000000..3dec8df
--- /dev/null
+++ b/modules.d/90mdraid/65-md-incremental.rules
@@ -0,0 +1,8 @@
+# This file causes block devices with Linux RAID (mdadm) signatures to
+# automatically cause mdadm to be run.
+# See udev(8) for syntax
+
+SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
+	IMPORT{program}="/sbin/mdadm --examine --export $tempnode", \
+	RUN+="/bin/bash -c '[ ! -f /dev/.in_sysinit ] && /sbin/mdadm -I $env{DEVNAME}'"
+
diff --git a/modules.d/90mdraid/install b/modules.d/90mdraid/install
index a6fad0d..9b69941 100755
--- a/modules.d/90mdraid/install
+++ b/modules.d/90mdraid/install
@@ -3,7 +3,14 @@ dracut_install mdadm
 inst /etc/passwd
 inst /etc/group
 instmods =drivers/md
-inst_rules "$moddir/61-mdadm.rules"
+
+if [ -x /lib/udev/vol_id ]; then
+    inst_rules "$moddir/61-mdadm.rules"
+else
+    inst_rules "$moddir/65-md-incremental.rules"
+    inst_rules 64-md-raid.rules
+fi
+
 [ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
 [ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf
 if [ -x  /sbin/mdmon ] ; then
diff --git a/modules.d/95nbd/61-nbd-vol_id.rules b/modules.d/95nbd/61-nbd-vol_id.rules
new file mode 100644
index 0000000..67c2fb2
--- /dev/null
+++ b/modules.d/95nbd/61-nbd-vol_id.rules
@@ -0,0 +1,7 @@
+SUBSYSTEM!="block", GOTO="nbd_end"
+ACTION!="change", GOTO="nbd_end"
+
+KERNEL=="nbd[0-9]*", IMPORT{program}="vol_id --export $tempnode"
+KERNEL=="nbd[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
+
+LABEL="nbd_end"
diff --git a/modules.d/95nbd/61-nbd.rules b/modules.d/95nbd/61-nbd.rules
index 5892cf3..f8c9509 100644
--- a/modules.d/95nbd/61-nbd.rules
+++ b/modules.d/95nbd/61-nbd.rules
@@ -1,6 +1,6 @@
 SUBSYSTEM!="block", GOTO="nbd_end"
-ACTION!="add|change", GOTO="nbd_end"
+ACTION!="change", GOTO="nbd_end"
 
-KERNEL=="nbd*", IMPORT{program}="vol_id --export $tempnode"
+KERNEL=="nbd[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
 
 LABEL="nbd_end"
diff --git a/modules.d/95nbd/install b/modules.d/95nbd/install
index dace08f..76091a1 100755
--- a/modules.d/95nbd/install
+++ b/modules.d/95nbd/install
@@ -2,6 +2,12 @@
 
 inst nbd-client
 inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
-inst_rules "$moddir/61-nbd.rules"
+
+if [ -x /lib/udev/vol_id ]; then
+    inst_rules "$moddir/61-nbd-vol_id.rules"
+else
+    inst_rules "$moddir/61-nbd.rules"
+fi
+
 inst "$moddir/nbdroot" "/sbin/nbdroot"
 instmods nbd
diff --git a/modules.d/95udev-rules/install b/modules.d/95udev-rules/install
index c5d73a6..d55c61a 100755
--- a/modules.d/95udev-rules/install
+++ b/modules.d/95udev-rules/install
@@ -8,7 +8,11 @@ inst_rules 50-udev-default.rules 60-persistent-storage.rules \
     61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules 
 #Some debian udev rules are named differently
 inst_rules 50-udev.rules 95-late.rules
- 
+
+if [ ! -x /lib/udev/vol_id ]; then
+    dracut_install blkid
+fi
+
 if ldd $(find_binary udevd) |grep -q /lib64/libc; then
     dracut_install /lib64/libnss_files*
 else
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 06/13] install rules to ignore some devices
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (4 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 05/13] prepare udev rules for udev >= 143 Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 07/13] make iSCSI boot with root=dhcp and mount partitions labeled with "ROOT" or "/" Harald Hoyer
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 modules.d/95udev-rules/01-ignore.rules |    1 +
 modules.d/95udev-rules/install         |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)
 create mode 100644 modules.d/95udev-rules/01-ignore.rules

diff --git a/modules.d/95udev-rules/01-ignore.rules b/modules.d/95udev-rules/01-ignore.rules
new file mode 100644
index 0000000..b32f22e
--- /dev/null
+++ b/modules.d/95udev-rules/01-ignore.rules
@@ -0,0 +1 @@
+KERNEL=="ram[0-9]*", OPTIONS+="ignore_device", OPTIONS+="last_rule"
diff --git a/modules.d/95udev-rules/install b/modules.d/95udev-rules/install
index d55c61a..8a3d8e9 100755
--- a/modules.d/95udev-rules/install
+++ b/modules.d/95udev-rules/install
@@ -9,10 +9,14 @@ inst_rules 50-udev-default.rules 60-persistent-storage.rules \
 #Some debian udev rules are named differently
 inst_rules 50-udev.rules 95-late.rules
 
+# ignore some devices in the initrd
+inst_rules "$moddir/01-ignore.rules"
+
 if [ ! -x /lib/udev/vol_id ]; then
     dracut_install blkid
 fi
 
+
 if ldd $(find_binary udevd) |grep -q /lib64/libc; then
     dracut_install /lib64/libnss_files*
 else
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 07/13] make iSCSI boot with root=dhcp and mount partitions labeled with "ROOT" or "/"
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (5 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 06/13] install rules to ignore some devices Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
       [not found]     ` <1245409551-30493-8-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-06-19 11:05   ` [PATCH 08/13] manpage iSCSI update Harald Hoyer
                     ` (5 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 modules.d/95iscsi/iscsiroot   |    8 ++++++++
 modules.d/99base/install      |    5 ++---
 test/TEST-30-ISCSI/dhcpd.conf |    2 +-
 test/TEST-30-ISCSI/test.sh    |    2 +-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot
index e273fc5..783306b 100755
--- a/modules.d/95iscsi/iscsiroot
+++ b/modules.d/95iscsi/iscsiroot
@@ -118,6 +118,14 @@ echo "InitiatorName='$iscsi_initiator'" > /dev/.initiatorname.iscsi
 
 # FIXME $iscsi_lun?? $iscsi_protocol??
 
+# if root does not specify a block device
+# we set a fallback to recognize any filesystems labeled 
+# LABEL=/ or LABEL=ROOT
+if [ "${root#block:*}" = "$root" ]; then
+    ( root="block:/dev/disk/by-label/\x2f" . /pre-udev/30-block-genrules.sh )
+    ( root="block:/dev/disk/by-label/ROOT" . /pre-udev/30-block-genrules.sh )
+fi
+
 iscsistart -i $iscsi_initiator -t $iscsi_target_name	\
     -g $iscsi_target_group -a $iscsi_target_ip	\
     -p $iscsi_target_port \
diff --git a/modules.d/99base/install b/modules.d/99base/install
index 68d40fb..06cf6db 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -7,9 +7,8 @@ fi
 # install our scripts and hooks
 inst "$moddir/init" "/init"
 # Bail out if switch_root does not exist
-if [ ! -x "$moddir/switch_root" ]; then
-    # assume it is installed in the standard path
-    dracut_install switch_root
+if which switch_root >/dev/null 2>&1; then
+    dracut_install switch_root 
 else
     inst "$moddir/switch_root" "/sbin/switch_root"
 fi
diff --git a/test/TEST-30-ISCSI/dhcpd.conf b/test/TEST-30-ISCSI/dhcpd.conf
index 515922a..6eb035b 100644
--- a/test/TEST-30-ISCSI/dhcpd.conf
+++ b/test/TEST-30-ISCSI/dhcpd.conf
@@ -15,7 +15,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
 	# NFSv3: last octect starts at 0x00 and works up
 
 	group {
-		option root-path "iscsiroot=192.168.50.1::::test";
+		option root-path "iscsi:192.168.50.1::::iqn.2009-06.dracut:target0";
 
 		host iscsi-1 {
 			hardware ethernet 52:54:00:12:34:00;
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 134ee73..a6833bf 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -37,7 +37,7 @@ run_client() {
   	-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
   	-net socket,mcast=230.0.0.1:1234 \
   	-kernel /boot/vmlinuz-$KVERSION \
-	-append "root=LABEL=ROOT netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
+	-append "root=dhcp rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
   	-initrd initramfs.testing
     grep -m 1 -q iscsi-OK client.img || return 1
 }
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 08/13] manpage iSCSI update
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (6 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 07/13] make iSCSI boot with root=dhcp and mount partitions labeled with "ROOT" or "/" Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 09/13] add rdblacklist command line parameter Harald Hoyer
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 dracut.8 |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dracut.8 b/dracut.8
index 5258925..0ceccff 100644
--- a/dracut.8
+++ b/dracut.8
@@ -110,12 +110,20 @@ associated fields.
 
 http://tools.ietf.org/html/rfc4173
 
+If the root partition is not specified using \fBroot=\fR, one of the partitions found 
+with label \fBROOT\fR or \fB/\fR will be used to boot from.
+
 .TP
-.B root=??? iscsiroot=...
+.B root=??? netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
+e.g. root=LABEL=ROOT netroot=root=LABEL=ROOT netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
+
 .TP
 .B root=??? iscsi_initiator= iscsi_target_name= iscsi_target_ip= iscsi_target_port= iscsi_target_group= iscsi_username=  iscsi_password= iscsi_in_username= iscsi_in_password=
+these variables can also be put in a file in /conf/conf.d/, which will be sourced
+
 .TP
 .B root=??? iscsi_firmware
+will read the iscsi parameter from the BIOS firmware
 
 .SH NBD
 .TP
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 09/13] add rdblacklist command line parameter
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (7 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 08/13] manpage iSCSI update Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 10/13] updated switch_root.c Harald Hoyer
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 modules.d/99base/install            |    1 +
 modules.d/99base/parse-blacklist.sh |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
 create mode 100755 modules.d/99base/parse-blacklist.sh

diff --git a/modules.d/99base/install b/modules.d/99base/install
index 06cf6db..4bf5301 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -14,4 +14,5 @@ else
 fi
 inst "$moddir/dracut-lib" "/lib/dracut-lib"
 inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
+inst_hook cmdline 20 "$moddir/parse-blacklist.sh"
 inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
diff --git a/modules.d/99base/parse-blacklist.sh b/modules.d/99base/parse-blacklist.sh
new file mode 100755
index 0000000..9c0a9e0
--- /dev/null
+++ b/modules.d/99base/parse-blacklist.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if getarg rdblacklist= >/dev/null ; then
+    [ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
+    for p in $CMDLINE; do
+        [ -n "${p%rdblacklist=*}" ] && continue
+
+        echo "blacklist ${p#rdblacklist=}" >> /etc/modprobe.d/initramfsblacklist.conf
+    done
+fi
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 10/13] updated switch_root.c
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (8 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 09/13] add rdblacklist command line parameter Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 11/13] dracut.spec without switch_root Harald Hoyer
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

matches the version, which will go to util-linux-ng
---
 Makefile      |    2 +-
 switch_root.c |  232 ++++++++++++++++++++++++++++-----------------------------
 2 files changed, 115 insertions(+), 119 deletions(-)

diff --git a/Makefile b/Makefile
index 3ec288a..f693ace 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ sbindir = ${prefix}/sbin
 mandir = ${prefix}/share/man
 
 modules.d/99base/switch_root: switch_root.c
-	gcc -o modules.d/99base/switch_root switch_root.c	
+	gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c	
 
 all: modules.d/99base/switch_root
 
diff --git a/switch_root.c b/switch_root.c
index ef7a0fb..8daacb1 100644
--- a/switch_root.c
+++ b/switch_root.c
@@ -1,7 +1,7 @@
 /*
  * switchroot.c - switch to new root directory and start init.
  *
- * Copyright 2002-2008 Red Hat, Inc.  All rights reserved.
+ * Copyright 2002-2009 Red Hat, Inc.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,12 +17,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * Authors:
- * 	Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
+ *	Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  *	Jeremy Katz <katzj-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  */
-
-#define _GNU_SOURCE 1
-
 #include <sys/mount.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -35,164 +32,163 @@
 #include <errno.h>
 #include <ctype.h>
 #include <dirent.h>
+#include <err.h>
 
 #ifndef MS_MOVE
 #define MS_MOVE 8192
 #endif
 
-#ifndef MNT_DETACH
-#define MNT_DETACH 0x2
-#endif
+/* remove all files/directories below dirName -- don't cross mountpoints */
+static int recursiveRemove(char *dirName)
+{
+	struct stat rb;
+	DIR *dir;
+	int rc = -1;
+	int dfd;
+
+	if (!(dir = opendir(dirName))) {
+		warn("failed to open %s", dirName);
+		goto done;
+	}
 
-enum {
-	ok,
-	err_no_directory,
-	err_usage,
-};
+	dfd = dirfd(dir);
 
-/* remove all files/directories below dirName -- don't cross mountpoints */
-static int
-recursiveRemove(char * dirName)
- {
-    struct stat sb,rb;
-    DIR * dir;
-    struct dirent * d;
-    char * strBuf = alloca(strlen(dirName) + 1024);
-
-    if (!(dir = opendir(dirName))) {
-        printf("error opening %s: %m\n", dirName);
-        return 0;
-    }
-
-    if (fstat(dirfd(dir),&rb)) {
-        printf("unable to stat %s: %m\n", dirName);
-        closedir(dir);
-        return 0;
-    }
-
-    errno = 0;
-    while ((d = readdir(dir))) {
-        errno = 0;
-
-        if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) {
-            errno = 0;
-            continue;
-        }
-
-        strcpy(strBuf, dirName);
-        strcat(strBuf, "/");
-        strcat(strBuf, d->d_name);
-
-        if (lstat(strBuf, &sb)) {
-            printf("failed to stat %s: %m\n", strBuf);
-            errno = 0;
-            continue;
-        }
-
-        /* only descend into subdirectories if device is same as dir */
-        if (S_ISDIR(sb.st_mode)) {
-            if (sb.st_dev == rb.st_dev) {
-	        recursiveRemove(strBuf);
-                if (rmdir(strBuf))
-                    printf("failed to rmdir %s: %m\n", strBuf);
-            }
-            errno = 0;
-            continue;
-        }
-        if (unlink(strBuf)) {
-            printf("failed to remove %s: %m\n", strBuf);
-            errno = 0;
-            continue;
-        }
-    }
-
-    if (errno) {
-        closedir(dir);
-        printf("error reading from %s: %m\n", dirName);
-        return 1;
-    }
-
-    closedir(dir);
-
-    return 0;
- }
+	if (fstat(dfd, &rb)) {
+		warn("failed to stat %s", dirName);
+		goto done;
+	}
+
+	while(1) {
+		struct dirent *d;
+
+		errno = 0;
+		if (!(d = readdir(dir))) {
+			if (errno) {
+				warn("failed to read %s", dirName);
+				goto done;
+			}
+			break;	/* end of directory */
+		}
+
+		if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+			continue;
+
+		if (d->d_type == DT_DIR) {
+			struct stat sb;
+
+			if (fstatat(dfd, d->d_name, &sb, AT_SYMLINK_NOFOLLOW)) {
+				warn("failed to stat %s/%s", dirName, d->d_name);
+				continue;
+			}
+
+			/* remove subdirectories if device is same as dir */
+			if (sb.st_dev == rb.st_dev) {
+				char subdir[ strlen(dirName) +
+					     strlen(d->d_name) + 2 ];
+
+				sprintf(subdir, "%s/%s", dirName, d->d_name);
+				recursiveRemove(subdir);
+			} else
+				continue;
+		}
+
+		if (unlinkat(dfd, d->d_name,
+			     d->d_type == DT_DIR ? AT_REMOVEDIR : 0))
+			warn("failed to unlink %s/%s", dirName, d->d_name);
+	}
+
+	rc = 0;	/* success */
+
+done:
+	if (dir)
+		closedir(dir);
+	return rc;
+}
 
 static int switchroot(const char *newroot)
 {
 	/*  Don't try to unmount the old "/", there's no way to do it. */
 	const char *umounts[] = { "/dev", "/proc", "/sys", NULL };
-	int errnum;
 	int i;
 
 	for (i = 0; umounts[i] != NULL; i++) {
 		char newmount[PATH_MAX];
-		strcpy(newmount, newroot);
-		strcat(newmount, umounts[i]);
+
+		snprintf(newmount, sizeof(newmount), "%s%s", newroot, umounts[i]);
+
 		if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) {
-			fprintf(stderr, "Error mount moving old %s %s %m\n",
+			warn("failed to mount moving %s to %s",
 				umounts[i], newmount);
-			fprintf(stderr, "Forcing unmount of %s\n", umounts[i]);
+			warnx("forcing unmount of %s", umounts[i]);
 			umount2(umounts[i], MNT_FORCE);
 		}
 	}
 
-	if (chdir(newroot) < 0) {
-	  errnum=errno;
-	  fprintf(stderr, "switchroot: chdir failed: %m\n");
-	  errno=errnum;
-	  return -1;
+	if (chdir(newroot)) {
+		warn("failed to change directory to %s", newroot);
+		return -1;
 	}
+
 	recursiveRemove("/");
+
 	if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) {
-		errnum = errno;
-		fprintf(stderr, "switchroot: mount failed: %m\n");
-		errno = errnum;
+		warn("failed to mount moving %s to /", newroot);
 		return -1;
 	}
 
 	if (chroot(".")) {
-		errnum = errno;
-		fprintf(stderr, "switchroot: chroot failed: %m\n");
-		errno = errnum;
-		return -2;
+		warn("failed to change root");
+		return -1;
 	}
-	return 1;
+	return 0;
 }
 
 static void usage(FILE *output)
 {
-	fprintf(output, "usage: switchroot <newrootdir> <init> <args to init>\n");
-	if (output == stderr)
-		exit(err_usage);
-	exit(ok);
+	fprintf(output, "usage: %s <newrootdir> <init> <args to init>\n",
+			program_invocation_short_name);
+	exit(output == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
+static void version(void)
+{
+	fprintf(stdout,  "%s from %s\n", program_invocation_short_name,
+			PACKAGE_STRING);
+	exit(EXIT_SUCCESS);
 }
 
 int main(int argc, char *argv[])
 {
-	char *newroot = argv[1];
-	char *init = argv[2];
-	char **initargs = &argv[2];
+	char *newroot, *init, **initargs;
 
-	if (newroot == NULL || newroot[0] == '\0' ||
-	    init == NULL || init[0] == '\0' ) {
+	if (argv[1] && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))
+		usage(stdout);
+	if (argv[1] && (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-V")))
+		version();
+	if (argc < 3)
 		usage(stderr);
-	}
 
-	if (switchroot(newroot) < 0) {
-	  fprintf(stderr, "switchroot has failed.  Sorry.\n");
-	  return 1;
-	}
-	if (access(initargs[0], X_OK))
-	  fprintf(stderr, "WARNING: can't access %s\n", initargs[0]);
+	newroot = argv[1];
+	init = argv[2];
+	initargs = &argv[2];
+
+	if (!*newroot || !*init)
+		usage(stderr);
+
+	if (switchroot(newroot))
+		errx(EXIT_FAILURE, "failed. Sorry.");
+
+	if (access(init, X_OK))
+		warn("cannot access %s", init);
 
 	/* get session leader */
 	setsid();
+
 	/* set controlling terminal */
-	ioctl (0, TIOCSCTTY, 1);
+	if (ioctl (0, TIOCSCTTY, 1))
+		warn("failed to TIOCSCTTY");
 
-	execv(initargs[0], initargs);
+	execv(init, initargs);
+	err(EXIT_FAILURE, "failed to execute %s", init);
 }
 
-/*
- * vim:noet:ts=8:sw=8:sts=8
- */
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 11/13] dracut.spec without switch_root
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (9 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 10/13] updated switch_root.c Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 12/13] renamed dracut-lib to dracut-lib.sh Harald Hoyer
  2009-06-19 11:05   ` [PATCH 13/13] removed shebang from .sh and changed mode to 0644 Harald Hoyer
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 dracut.spec |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dracut.spec b/dracut.spec
index fe3e2a4..83a2f54 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -1,5 +1,6 @@
 # define gittag 2c02c831
 %define replace_mkinitrd 0
+%define with_switch_root 0
 Name: dracut
 Version: 0.1
 %if %{defined gittag}
@@ -30,6 +31,9 @@ Requires: bash
 Obsoletes: mkinitrd < 7.0
 Provides: mkinitrd = 7.0
 %endif
+%if ! 0%{?with_switch_root}
+BuildArch: noarch
+%endif
 
 %description
 dracut is a new, event-driven initramfs infrastructure based around udev.
@@ -50,6 +54,10 @@ ln -s dracut $RPM_BUILD_ROOT/sbin/mkinitrd
 ln -s dracut/dracut-functions $RPM_BUILD_ROOT/usr/libexec/initrd-functions
 %endif
 
+%if ! 0%{?with_switch_root}
+rm -f $RPM_BUILD_ROOT/sbin/switch_root
+%endif
+
 #mkdir -p $RPM_BUILD_ROOT/sbin
 #mv $RPM_BUILD_ROOT/%{_prefix}/lib/dracut/modules.d/99base/switch_root $RPM_BUILD_ROOT/sbin
 
@@ -60,7 +68,9 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %doc README HACKING TODO COPYING
 /sbin/dracut
+%if 0%{?with_switch_root}
 /sbin/switch_root
+%endif
 %if 0%{?replace_mkinitrd}
 /sbin/mkinitrd
 /usr/libexec/initrd-functions
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 12/13] renamed dracut-lib to dracut-lib.sh
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (10 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 11/13] dracut.spec without switch_root Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  2009-06-19 11:05   ` [PATCH 13/13] removed shebang from .sh and changed mode to 0644 Harald Hoyer
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 modules.d/40network/dhclient-script |    2 +-
 modules.d/40network/ifup            |    2 +-
 modules.d/40network/netroot         |    2 +-
 modules.d/95iscsi/iscsiroot         |    2 +-
 modules.d/95nbd/nbdroot             |    2 +-
 modules.d/95nfs/nfsroot             |    2 +-
 modules.d/99base/dracut-lib         |   62 -----------------------------------
 modules.d/99base/dracut-lib.sh      |   55 +++++++++++++++++++++++++++++++
 modules.d/99base/init               |    2 +-
 modules.d/99base/install            |    2 +-
 10 files changed, 63 insertions(+), 70 deletions(-)
 delete mode 100644 modules.d/99base/dracut-lib
 create mode 100644 modules.d/99base/dracut-lib.sh

diff --git a/modules.d/40network/dhclient-script b/modules.d/40network/dhclient-script
index f662828..5b36a40 100755
--- a/modules.d/40network/dhclient-script
+++ b/modules.d/40network/dhclient-script
@@ -35,7 +35,7 @@ setup_interface() {
 
 PATH=$PATH:/sbin:/usr/sbin
 
-. /lib/dracut-lib
+. /lib/dracut-lib.sh
 
 if getarg rdnetdebug ; then
     exec >/tmp/dhclient.$interface.$$.out
diff --git a/modules.d/40network/ifup b/modules.d/40network/ifup
index 332fc21..89017bb 100755
--- a/modules.d/40network/ifup
+++ b/modules.d/40network/ifup
@@ -46,7 +46,7 @@ do_static() {
 
 PATH=$PATH:/sbin:/usr/sbin
 
-. /lib/dracut-lib
+. /lib/dracut-lib.sh
 
 if getarg rdnetdebug ; then
     exec >/tmp/ifup.$1.$$.out
diff --git a/modules.d/40network/netroot b/modules.d/40network/netroot
index 099c9a9..f719d93 100755
--- a/modules.d/40network/netroot
+++ b/modules.d/40network/netroot
@@ -2,7 +2,7 @@
 
 PATH=$PATH:/sbin:/usr/sbin
 
-. /lib/dracut-lib
+. /lib/dracut-lib.sh
 
 if getarg rdnetdebug ; then
     exec >/tmp/netroot.$1.$$.out
diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot
index 783306b..c66f9d2 100755
--- a/modules.d/95iscsi/iscsiroot
+++ b/modules.d/95iscsi/iscsiroot
@@ -6,7 +6,7 @@
 # iscsistart needs this.
 #
 
-. /lib/dracut-lib
+. /lib/dracut-lib.sh
 
 PATH=$PATH:/sbin:/usr/sbin
 
diff --git a/modules.d/95nbd/nbdroot b/modules.d/95nbd/nbdroot
index 71f6af9..90f6ef8 100755
--- a/modules.d/95nbd/nbdroot
+++ b/modules.d/95nbd/nbdroot
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. /lib/dracut-lib
+. /lib/dracut-lib.sh
 
 PATH=$PATH:/sbin:/usr/sbin
 
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
index 46c2b42..6012598 100755
--- a/modules.d/95nfs/nfsroot
+++ b/modules.d/95nfs/nfsroot
@@ -38,7 +38,7 @@ root_to_var() {
     fi
 }
 
-. /lib/dracut-lib
+. /lib/dracut-lib.sh
 
 PATH=$PATH:/sbin:/usr/sbin
 
diff --git a/modules.d/99base/dracut-lib b/modules.d/99base/dracut-lib
deleted file mode 100644
index 00c21bd..0000000
--- a/modules.d/99base/dracut-lib
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-#
-# Licensed under the GPLv2
-#
-# Copyright 2008, Red Hat, Inc.
-# Jeremy Katz <katzj-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
-
-getarg() {
-    local o line
-    [ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
-    for o in $CMDLINE; do
-	[ "$o" = "$1" ] && return 0
-	[ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
-    done
-    return 1
-}
-
-source_all() {
-    local f
-    [ "$1" ] && [  -d "/$1" ] || return
-    for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
-}
-
-die() {
-    printf "<1>FATAL: $1\n" > /dev/kmsg
-    printf "<1>Refusing to continue\n" > /dev/kmsg
-    exit 1
-}
-
-warn() {
-    printf "<1>Warning: $1\n" > /dev/kmsg
-}
-
-check_occurances() {
-    # Count the number of times the character $ch occurs in $str
-    # Return 0 if the count matches the expected number, 1 otherwise
-    local str="$1"
-    local ch="$2"
-    local expected="$3"
-    local count=0
-
-    while [ "${str#*$ch}" != "${str}" ]; do
-	str="${str#*$ch}"
-	count=$(( $count + 1 ))
-    done
-
-    [ $count -eq $expected ]
-}
-
-incol2() {
-    local dummy check;
-    local file="$1";
-    local str="$2";
-
-    [ -z "$file" ] && return;
-    [ -z "$str"  ] && return;
-
-    while read dummy check restofline; do
-	[ "$check" = "$str" ] && return 0
-    done < $file
-    return 1
-}
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
new file mode 100644
index 0000000..96ecbb0
--- /dev/null
+++ b/modules.d/99base/dracut-lib.sh
@@ -0,0 +1,55 @@
+getarg() {
+    local o line
+    [ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
+    for o in $CMDLINE; do
+	[ "$o" = "$1" ] && return 0
+	[ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
+    done
+    return 1
+}
+
+source_all() {
+    local f
+    [ "$1" ] && [  -d "/$1" ] || return
+    for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
+}
+
+die() {
+    printf "<1>FATAL: $1\n" > /dev/kmsg
+    printf "<1>Refusing to continue\n" > /dev/kmsg
+    exit 1
+}
+
+warn() {
+    printf "<1>Warning: $1\n" > /dev/kmsg
+}
+
+check_occurances() {
+    # Count the number of times the character $ch occurs in $str
+    # Return 0 if the count matches the expected number, 1 otherwise
+    local str="$1"
+    local ch="$2"
+    local expected="$3"
+    local count=0
+
+    while [ "${str#*$ch}" != "${str}" ]; do
+	str="${str#*$ch}"
+	count=$(( $count + 1 ))
+    done
+
+    [ $count -eq $expected ]
+}
+
+incol2() {
+    local dummy check;
+    local file="$1";
+    local str="$2";
+
+    [ -z "$file" ] && return;
+    [ -z "$str"  ] && return;
+
+    while read dummy check restofline; do
+	[ "$check" = "$str" ] && return 0
+    done < $file
+    return 1
+}
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 5ce28a0..113b130 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -20,7 +20,7 @@ NEWROOT="/sysroot"
 
 trap "emergency_shell" 0
 
-. /lib/dracut-lib
+. /lib/dracut-lib.sh
 
 mknod /dev/null c 1 3
 
diff --git a/modules.d/99base/install b/modules.d/99base/install
index 4bf5301..01ad771 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -12,7 +12,7 @@ if which switch_root >/dev/null 2>&1; then
 else
     inst "$moddir/switch_root" "/sbin/switch_root"
 fi
-inst "$moddir/dracut-lib" "/lib/dracut-lib"
+inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
 inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
 inst_hook cmdline 20 "$moddir/parse-blacklist.sh"
 inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 13/13] removed shebang from .sh and changed mode to 0644
       [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (11 preceding siblings ...)
  2009-06-19 11:05   ` [PATCH 12/13] renamed dracut-lib to dracut-lib.sh Harald Hoyer
@ 2009-06-19 11:05   ` Harald Hoyer
  12 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer

---
 modules.d/50plymouth/plymouth-emergency.sh |    1 -
 modules.d/90dmraid/dmraid.sh               |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)
 mode change 100755 => 100644 modules.d/95resume/resume-genrules.sh
 mode change 100755 => 100644 modules.d/95rootfs-block/block-genrules.sh
 mode change 100755 => 100644 modules.d/95rootfs-block/parse-block.sh
 mode change 100755 => 100644 modules.d/99base/parse-root-opts.sh

diff --git a/modules.d/50plymouth/plymouth-emergency.sh b/modules.d/50plymouth/plymouth-emergency.sh
index e8b642d..3119330 100644
--- a/modules.d/50plymouth/plymouth-emergency.sh
+++ b/modules.d/50plymouth/plymouth-emergency.sh
@@ -1,2 +1 @@
-#!/sbin/sh
 [ -x /bin/plymouth ] && /bin/plymouth --hide-splash
diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh
index 17a92fb..c64d686 100644
--- a/modules.d/90dmraid/dmraid.sh
+++ b/modules.d/90dmraid/dmraid.sh
@@ -1,4 +1,3 @@
-#!/bin/sh
 dmraid -ay
 udevadm settle --timeout=30 >/dev/null 2>&1 
 
diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh
old mode 100755
new mode 100644
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
old mode 100755
new mode 100644
diff --git a/modules.d/95rootfs-block/parse-block.sh b/modules.d/95rootfs-block/parse-block.sh
old mode 100755
new mode 100644
diff --git a/modules.d/99base/parse-root-opts.sh b/modules.d/99base/parse-root-opts.sh
old mode 100755
new mode 100644
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 07/13] make iSCSI boot with root=dhcp and mount partitions labeled with "ROOT" or "/"
       [not found]     ` <1245409551-30493-8-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-06-19 11:09       ` Harald Hoyer
  0 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 11:09 UTC (permalink / raw)
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 06/19/2009 01:05 PM, Harald Hoyer wrote:
> diff --git a/modules.d/99base/install b/modules.d/99base/install
> index 68d40fb..06cf6db 100755
> --- a/modules.d/99base/install
> +++ b/modules.d/99base/install
> @@ -7,9 +7,8 @@ fi
>   # install our scripts and hooks
>   inst "$moddir/init" "/init"
>   # Bail out if switch_root does not exist
> -if [ ! -x "$moddir/switch_root" ]; then
> -    # assume it is installed in the standard path
> -    dracut_install switch_root
> +if which switch_root>/dev/null 2>&1; then
> +    dracut_install switch_root
>   else
>       inst "$moddir/switch_root" "/sbin/switch_root"
>   fi

Hmpf.. that should have been a seperate patch
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 05/13] prepare udev rules for udev >= 143
       [not found]     ` <1245409551-30493-6-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-06-19 15:51       ` Jeremy Katz
       [not found]         ` <20090619155149.GA89011-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Jeremy Katz @ 2009-06-19 15:51 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

Note that this isn't "prepare" as much as "require udev >= 143 and
util-linux-ng >= 2.15".  Which means only working with the devel trees of
every distro afaict.

Jeremy
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 05/13] prepare udev rules for udev >= 143
       [not found]         ` <20090619155149.GA89011-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-06-19 16:09           ` Harald Hoyer
  0 siblings, 0 replies; 17+ messages in thread
From: Harald Hoyer @ 2009-06-19 16:09 UTC (permalink / raw)
  To: Jeremy Katz
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >> "initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"

On 06/19/2009 05:51 PM, Jeremy Katz wrote:
> Note that this isn't "prepare" as much as "require udev>= 143 and
> util-linux-ng>= 2.15".  Which means only working with the devel trees of
> every distro afaict.
>
> Jeremy

not true... it will work with old versions as well, because it will install the 
old rules for that.
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-06-19 16:09 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19 11:05 [PATCH 00/13] Changes 2009-06-19 Harald Hoyer
     [not found] ` <1245409551-30493-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-19 11:05   ` [PATCH 01/13] moved test-init to TEST-10-RAID Harald Hoyer
2009-06-19 11:05   ` [PATCH 02/13] uncomment hard-off for TEST-30-ISCSI Harald Hoyer
2009-06-19 11:05   ` [PATCH 03/13] do not poweroff in TEST-30-ISCSI, if rdinitdebug is set Harald Hoyer
2009-06-19 11:05   ` [PATCH 04/13] do not poweroff in TEST-10-RAID " Harald Hoyer
2009-06-19 11:05   ` [PATCH 05/13] prepare udev rules for udev >= 143 Harald Hoyer
     [not found]     ` <1245409551-30493-6-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-19 15:51       ` Jeremy Katz
     [not found]         ` <20090619155149.GA89011-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-19 16:09           ` Harald Hoyer
2009-06-19 11:05   ` [PATCH 06/13] install rules to ignore some devices Harald Hoyer
2009-06-19 11:05   ` [PATCH 07/13] make iSCSI boot with root=dhcp and mount partitions labeled with "ROOT" or "/" Harald Hoyer
     [not found]     ` <1245409551-30493-8-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-19 11:09       ` Harald Hoyer
2009-06-19 11:05   ` [PATCH 08/13] manpage iSCSI update Harald Hoyer
2009-06-19 11:05   ` [PATCH 09/13] add rdblacklist command line parameter Harald Hoyer
2009-06-19 11:05   ` [PATCH 10/13] updated switch_root.c Harald Hoyer
2009-06-19 11:05   ` [PATCH 11/13] dracut.spec without switch_root Harald Hoyer
2009-06-19 11:05   ` [PATCH 12/13] renamed dracut-lib to dracut-lib.sh Harald Hoyer
2009-06-19 11:05   ` [PATCH 13/13] removed shebang from .sh and changed mode to 0644 Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox