From 79293ff0fab3d467e1bc838293428e63331d8f58 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 24 Feb 2012 15:44:51 +0100 Subject: [PATCH] version 017 --- .gitignore | 1 + ...nk-dracut-shutdown.service-to-shutdo.patch | 24 -- 0002-add-function-wait_for_route_ok.patch | 40 --- ...-spurious-error-message-wait_for_dev.patch | 27 -- 0004-ssh-client-module-install-fix.patch | 33 -- 0005-95iscsi-fix-root-iscsi-.-case.patch | 40 --- ...d-test-case-for-root-iscsi-.-and-unt.patch | 333 ------------------ ...-factor-out-all-get_maj_min-variants.patch | 56 --- ...ions-documentation-and-restructuring.patch | 314 ----------------- dracut.spec | 50 +-- sources | 2 +- 11 files changed, 28 insertions(+), 892 deletions(-) delete mode 100644 0001-Makefile-also-link-dracut-shutdown.service-to-shutdo.patch delete mode 100644 0002-add-function-wait_for_route_ok.patch delete mode 100644 0003-livenet-avoid-spurious-error-message-wait_for_dev.patch delete mode 100644 0004-ssh-client-module-install-fix.patch delete mode 100644 0005-95iscsi-fix-root-iscsi-.-case.patch delete mode 100644 0006-TEST-30-ISCSI-add-test-case-for-root-iscsi-.-and-unt.patch delete mode 100644 0007-dracut-functions-factor-out-all-get_maj_min-variants.patch delete mode 100644 0008-dracut-functions-documentation-and-restructuring.patch diff --git a/.gitignore b/.gitignore index 57e6c7c..818ad34 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /dracut-014.tar.bz2 /dracut-015.tar.bz2 /dracut-016.tar.bz2 +/dracut-017.tar.bz2 diff --git a/0001-Makefile-also-link-dracut-shutdown.service-to-shutdo.patch b/0001-Makefile-also-link-dracut-shutdown.service-to-shutdo.patch deleted file mode 100644 index 12334ff..0000000 --- a/0001-Makefile-also-link-dracut-shutdown.service-to-shutdo.patch +++ /dev/null @@ -1,24 +0,0 @@ -From a2c631c0a3d3208069ebccefc39f591e0595a545 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Thu, 16 Feb 2012 09:36:13 +0100 -Subject: [PATCH] Makefile: also link dracut-shutdown.service to shutdown - target - ---- - Makefile | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - -diff --git a/Makefile b/Makefile -index 321e923..6556c01 100644 ---- a/Makefile -+++ b/Makefile -@@ -52,7 +52,9 @@ install: doc - mkdir -p $(DESTDIR)$(systemdsystemunitdir); \ - install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \ - mkdir -p $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants; \ -+ mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \ - ln -s ../dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-shutdown.service; \ -+ ln -s ../dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \ - fi - - clean: diff --git a/0002-add-function-wait_for_route_ok.patch b/0002-add-function-wait_for_route_ok.patch deleted file mode 100644 index 71c3100..0000000 --- a/0002-add-function-wait_for_route_ok.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 75cade1216b62957efad7e97c77e4e8b0414a515 Mon Sep 17 00:00:00 2001 -From: Dave Young -Date: Thu, 16 Feb 2012 09:36:29 +0800 -Subject: [PATCH] add function wait_for_route_ok - -Manually setuping nic through udev is not always done when -we want network access. Here add a function wait_for_route_ok to -wait and make sure the network is accesible - -[v1 -> v2]: -Harald: don't use bash syntax -Add check for [ -n "$li" ] because `ip route show` will show nothing probably - -Signed-off-by: Dave Young ---- - modules.d/99base/dracut-lib.sh | 11 +++++++++++ - 1 files changed, 11 insertions(+), 0 deletions(-) - -diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh -index 6b70adf..afd366e 100755 ---- a/modules.d/99base/dracut-lib.sh -+++ b/modules.d/99base/dracut-lib.sh -@@ -392,6 +392,17 @@ wait_for_if_up() { - return 1 - } - -+wait_for_route_ok() { -+ local cnt=0 -+ while [ $cnt -lt 200 ]; do -+ li=$(ip route show) -+ [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0 -+ sleep 0.1 -+ cnt=$(($cnt+1)) -+ done -+ return 1 -+} -+ - # root=nfs:[:][:] - # root=nfs4:[:][:] - nfsroot_to_var() { diff --git a/0003-livenet-avoid-spurious-error-message-wait_for_dev.patch b/0003-livenet-avoid-spurious-error-message-wait_for_dev.patch deleted file mode 100644 index 3f2ef84..0000000 --- a/0003-livenet-avoid-spurious-error-message-wait_for_dev.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c1df00d2c62f9cd79957d62dda025964108f12de Mon Sep 17 00:00:00 2001 -From: Will Woods -Date: Wed, 15 Feb 2012 13:36:09 -0500 -Subject: [PATCH] livenet: avoid spurious error message / wait_for_dev - -If the user didn't request a livenet boot, don't print an error -and don't do wait_for_dev. - -Signed-off-by: Will Woods ---- - modules.d/90livenet/parse-livenet.sh | 3 +-- - 1 files changed, 1 insertions(+), 2 deletions(-) - -diff --git a/modules.d/90livenet/parse-livenet.sh b/modules.d/90livenet/parse-livenet.sh -index 042cc51..926dba2 100755 ---- a/modules.d/90livenet/parse-livenet.sh -+++ b/modules.d/90livenet/parse-livenet.sh -@@ -15,8 +15,7 @@ if get_url_handler "$liveurl" >/dev/null; then - netroot="livenet:$liveurl" - root="livenet" # quiet complaints from init - rootok=1 -+ wait_for_dev /dev/root - else - info "livenet: no url handler for $liveurl" - fi -- --wait_for_dev /dev/root diff --git a/0004-ssh-client-module-install-fix.patch b/0004-ssh-client-module-install-fix.patch deleted file mode 100644 index 48a2b37..0000000 --- a/0004-ssh-client-module-install-fix.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 86de902e35a7c57ecc008ba725b7842e36bf7393 Mon Sep 17 00:00:00 2001 -From: Dave Young -Date: Wed, 15 Feb 2012 14:40:24 +0800 -Subject: [PATCH] ssh-client module install fix - -commit 38164332e198f7cc8f339b42d555796918de04b3 try to -disallow ssh-client install for without proper options. -But ssh-client will fail installation with --sshkey for -publickey mode - -Fix it by refusing to install only when both --ctty and --sshkey -are not added in options. - -Signed-off-by: Dave Young ---- - modules.d/95ssh-client/module-setup.sh | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/modules.d/95ssh-client/module-setup.sh b/modules.d/95ssh-client/module-setup.sh -index 4410e4e..8d62b2d 100755 ---- a/modules.d/95ssh-client/module-setup.sh -+++ b/modules.d/95ssh-client/module-setup.sh -@@ -50,8 +50,8 @@ inst_sshenv() - } - - install() { -- [[ ! $cttyhack = yes ]] && { -- derror "ssh interactive mode needs option --ctty!" -+ [[ ! $cttyhack = yes && ! $sshkey ]] && { -+ derror "ssh-client needs option --ctty or --sshkey!" - return 1 - } - diff --git a/0005-95iscsi-fix-root-iscsi-.-case.patch b/0005-95iscsi-fix-root-iscsi-.-case.patch deleted file mode 100644 index 220ad99..0000000 --- a/0005-95iscsi-fix-root-iscsi-.-case.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 2a3faa2df9ba46ff7759c2201e8ec7056e84d6de Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Thu, 16 Feb 2012 11:34:37 +0100 -Subject: [PATCH] 95iscsi: fix "root=iscsi:...." case - -install udev rules and wait for /dev/root ---- - modules.d/95iscsi/iscsiroot | 1 + - modules.d/95iscsi/parse-iscsiroot.sh | 4 +++- - 2 files changed, 4 insertions(+), 1 deletions(-) - -diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot -index d8f7c8f..7b8f63e 100755 ---- a/modules.d/95iscsi/iscsiroot -+++ b/modules.d/95iscsi/iscsiroot -@@ -46,6 +46,7 @@ if getargbool 0 rd.iscsi.firmware -y iscsi_firmware ; then - if [ -n "${root%%block:*}" ]; then - # if root is not specified try to mount the whole iSCSI LUN - printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules -+ udevadm control --reload - fi - iscsistart -b - exit 0 -diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh -index 40720e8..64aae84 100755 ---- a/modules.d/95iscsi/parse-iscsiroot.sh -+++ b/modules.d/95iscsi/parse-iscsiroot.sh -@@ -28,9 +28,11 @@ - if [ "${root%%:*}" = "iscsi" ] ; then - if [ -n "$netroot" ] ; then - echo "Warning: root takes precedence over netroot. Ignoring netroot" -- - fi - netroot=$root -+ # if root is not specified try to mount the whole iSCSI LUN -+ printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules -+ root=/dev/root - fi - - # If it's not empty or iscsi we don't continue diff --git a/0006-TEST-30-ISCSI-add-test-case-for-root-iscsi-.-and-unt.patch b/0006-TEST-30-ISCSI-add-test-case-for-root-iscsi-.-and-unt.patch deleted file mode 100644 index 8dbddba..0000000 --- a/0006-TEST-30-ISCSI-add-test-case-for-root-iscsi-.-and-unt.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 3905f6695ebbc8666c37d585bb5e7093d43ab8ac Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Thu, 16 Feb 2012 11:37:21 +0100 -Subject: [PATCH] TEST-30-ISCSI: add test case for "root=iscsi:...." and - untabify - ---- - test/TEST-30-ISCSI/test.sh | 227 +++++++++++++++++++++++-------------------- - 1 files changed, 121 insertions(+), 106 deletions(-) - -diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh -index 667c6a9..7899f76 100755 ---- a/test/TEST-30-ISCSI/test.sh -+++ b/test/TEST-30-ISCSI/test.sh -@@ -12,18 +12,18 @@ run_server() { - echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server" - - $testdir/run-qemu \ -- -hda $TESTDIR/server.ext2 \ -- -hdb $TESTDIR/root.ext2 \ -- -hdc $TESTDIR/iscsidisk2.img \ -- -hdd $TESTDIR/iscsidisk3.img \ -- -m 256M -nographic \ -- -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -- -net socket,listen=127.0.0.1:12330 \ -- -serial $SERIAL \ -- -kernel /boot/vmlinuz-$KVERSION \ -- -append "root=/dev/sda rw quiet console=ttyS0,115200n81 selinux=0" \ -- -initrd $TESTDIR/initramfs.server \ -- -pidfile $TESTDIR/server.pid -daemonize || return 1 -+ -hda $TESTDIR/server.ext2 \ -+ -hdb $TESTDIR/root.ext2 \ -+ -hdc $TESTDIR/iscsidisk2.img \ -+ -hdd $TESTDIR/iscsidisk3.img \ -+ -m 256M -nographic \ -+ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ -+ -net socket,listen=127.0.0.1:12330 \ -+ -serial $SERIAL \ -+ -kernel /boot/vmlinuz-$KVERSION \ -+ -append "root=/dev/sda rw quiet console=ttyS0,115200n81 selinux=0" \ -+ -initrd $TESTDIR/initramfs.server \ -+ -pidfile $TESTDIR/server.pid -daemonize || return 1 - sudo chmod 644 $TESTDIR/server.pid || return 1 - - # Cleanup the terminal if we have one -@@ -37,55 +37,70 @@ run_client() { - - # Need this so kvm-qemu will boot (needs non-/dev/zero local disk) - if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1; then -- echo "Unable to make client sda image" 1>&2 -- return 1 -+ echo "Unable to make client sda image" 1>&2 -+ return 1 - fi - - $testdir/run-qemu \ -- -hda $TESTDIR/client.img \ -- -m 256M -nographic \ -- -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ -- -net socket,connect=127.0.0.1:12330 \ -- -kernel /boot/vmlinuz-$KVERSION \ -- -append "root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2 rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \ -- -initrd $TESTDIR/initramfs.testing -+ -hda $TESTDIR/client.img \ -+ -m 256M -nographic \ -+ -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ -+ -net socket,connect=127.0.0.1:12330 \ -+ -kernel /boot/vmlinuz-$KVERSION \ -+ -append "root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \ -+ -initrd $TESTDIR/initramfs.testing - grep -m 1 -q iscsi-OK $TESTDIR/client.img || return 1 - - if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1; then -- echo "Unable to make client sda image" 1>&2 -- return 1 -+ echo "Unable to make client sda image" 1>&2 -+ return 1 - fi - - $testdir/run-qemu \ -- -hda $TESTDIR/client.img \ -- -m 256M -nographic \ -- -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ -- -net socket,connect=127.0.0.1:12330 \ -- -kernel /boot/vmlinuz-$KVERSION \ -- -append "root=dhcp rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \ -- -initrd $TESTDIR/initramfs.testing -+ -hda $TESTDIR/client.img \ -+ -m 256M -nographic \ -+ -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ -+ -net socket,connect=127.0.0.1:12330 \ -+ -kernel /boot/vmlinuz-$KVERSION \ -+ -append "root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2 rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \ -+ -initrd $TESTDIR/initramfs.testing -+ grep -m 1 -q iscsi-OK $TESTDIR/client.img || return 1 -+ -+ if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1; then -+ echo "Unable to make client sda image" 1>&2 -+ return 1 -+ fi -+ -+ $testdir/run-qemu \ -+ -hda $TESTDIR/client.img \ -+ -m 256M -nographic \ -+ -net nic,macaddr=52:54:00:12:34:00,model=e1000 \ -+ -net socket,connect=127.0.0.1:12330 \ -+ -kernel /boot/vmlinuz-$KVERSION \ -+ -append "root=dhcp rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \ -+ -initrd $TESTDIR/initramfs.testing - grep -m 1 -q iscsi-OK $TESTDIR/client.img || return 1 - - } - - test_run() { - if ! run_server; then -- echo "Failed to start server" 1>&2 -- return 1 -+ echo "Failed to start server" 1>&2 -+ return 1 - fi - run_client - ret=$? - if [[ -s $TESTDIR/server.pid ]]; then -- sudo kill -TERM $(cat $TESTDIR/server.pid) -- rm -f $TESTDIR/server.pid -+ sudo kill -TERM $(cat $TESTDIR/server.pid) -+ rm -f $TESTDIR/server.pid - fi - return $ret - } - - test_setup() { - if [ ! -x /usr/sbin/iscsi-target ]; then -- echo "Need iscsi-target from netbsd-iscsi" -- return 1 -+ echo "Need iscsi-target from netbsd-iscsi" -+ return 1 - fi - - # Create the blank file to use as a root filesystem -@@ -96,68 +111,68 @@ test_setup() { - kernel=$KVERSION - # Create what will eventually be our root filesystem onto an overlay - ( -- initdir=$TESTDIR/overlay/source -- . $basedir/dracut-functions -- dracut_install sh shutdown poweroff stty cat ps ln ip \ -+ initdir=$TESTDIR/overlay/source -+ . $basedir/dracut-functions -+ dracut_install sh shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping grep - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do -- [ -f ${_terminfodir}/l/linux ] && break -- done -- dracut_install -o ${_terminfodir}/l/linux -- inst ./client-init /sbin/init -- (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) -- cp -a /etc/ld.so.conf* $initdir/etc -- sudo ldconfig -r "$initdir" -+ [ -f ${_terminfodir}/l/linux ] && break -+ done -+ dracut_install -o ${_terminfodir}/l/linux -+ inst ./client-init /sbin/init -+ (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) -+ cp -a /etc/ld.so.conf* $initdir/etc -+ sudo ldconfig -r "$initdir" - ) - - # second, install the files needed to make the root filesystem - ( -- initdir=$TESTDIR/overlay -- . $basedir/dracut-functions -- dracut_install sfdisk mke2fs poweroff cp umount -- inst_hook initqueue 01 ./create-root.sh -- inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules -+ initdir=$TESTDIR/overlay -+ . $basedir/dracut-functions -+ dracut_install sfdisk mke2fs poweroff cp umount -+ inst_hook initqueue 01 ./create-root.sh -+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules - ) - - # create an initramfs that will create the target root filesystem. - # We do it this way so that we do not risk trashing the host mdraid - # devices, volume groups, encrypted partitions, etc. - $basedir/dracut -l -i $TESTDIR/overlay / \ -- -m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \ -- -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ -- -f $TESTDIR/initramfs.makeroot $KVERSION || return 1 -+ -m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \ -+ -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ -+ -f $TESTDIR/initramfs.makeroot $KVERSION || return 1 - rm -rf $TESTDIR/overlay - - - # Need this so kvm-qemu will boot (needs non-/dev/zero local disk) - if ! dd if=/dev/null of=$TESTDIR/client.img bs=1M seek=1; then -- echo "Unable to make client sdb image" 1>&2 -- return 1 -+ echo "Unable to make client sdb image" 1>&2 -+ return 1 - fi - # Invoke KVM and/or QEMU to actually create the target filesystem. - $testdir/run-qemu \ -- -hda $TESTDIR/root.ext2 \ -- -hdb $TESTDIR/client.img \ -- -hdc $TESTDIR/iscsidisk2.img \ -- -hdd $TESTDIR/iscsidisk3.img \ -- -m 256M -nographic -net none \ -- -kernel "/boot/vmlinuz-$kernel" \ -- -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \ -- -initrd $TESTDIR/initramfs.makeroot || return 1 -+ -hda $TESTDIR/root.ext2 \ -+ -hdb $TESTDIR/client.img \ -+ -hdc $TESTDIR/iscsidisk2.img \ -+ -hdd $TESTDIR/iscsidisk3.img \ -+ -m 256M -nographic -net none \ -+ -kernel "/boot/vmlinuz-$kernel" \ -+ -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \ -+ -initrd $TESTDIR/initramfs.makeroot || return 1 - grep -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1 - rm $TESTDIR/client.img - ( -- initdir=$TESTDIR/overlay -- . $basedir/dracut-functions -- dracut_install poweroff shutdown -- inst_hook emergency 000 ./hard-off.sh -- inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules -+ initdir=$TESTDIR/overlay -+ . $basedir/dracut-functions -+ dracut_install poweroff shutdown -+ inst_hook emergency 000 ./hard-off.sh -+ inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules - ) - sudo $basedir/dracut -l -i $TESTDIR/overlay / \ -- -o "plymouth dmraid" \ -- -a "debug" \ -- -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ -- -f $TESTDIR/initramfs.testing $KVERSION || return 1 -+ -o "plymouth dmraid" \ -+ -a "debug" \ -+ -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ -+ -f $TESTDIR/initramfs.testing $KVERSION || return 1 - - # Make server root - dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=60 -@@ -167,36 +182,36 @@ test_setup() { - - kernel=$KVERSION - ( -- initdir=$TESTDIR/mnt -- . $basedir/dracut-functions -- ( -- cd "$initdir"; -- mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi -- ) -- inst /etc/passwd /etc/passwd -- dracut_install sh ls shutdown poweroff stty cat ps ln ip \ -- dmesg mkdir cp ping \ -- modprobe tcpdump \ -- /etc/services sleep mount chmod -- dracut_install /usr/sbin/iscsi-target -+ initdir=$TESTDIR/mnt -+ . $basedir/dracut-functions -+ ( -+ cd "$initdir"; -+ mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi -+ ) -+ inst /etc/passwd /etc/passwd -+ dracut_install sh ls shutdown poweroff stty cat ps ln ip \ -+ dmesg mkdir cp ping \ -+ modprobe tcpdump \ -+ /etc/services sleep mount chmod -+ dracut_install /usr/sbin/iscsi-target - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do -- [ -f ${_terminfodir}/l/linux ] && break -- done -- dracut_install -o ${_terminfodir}/l/linux -- instmods iscsi_tcp crc32c ipv6 -+ [ -f ${_terminfodir}/l/linux ] && break -+ done -+ dracut_install -o ${_terminfodir}/l/linux -+ instmods iscsi_tcp crc32c ipv6 - inst ./targets /etc/iscsi/targets -- [ -f /etc/netconfig ] && dracut_install /etc/netconfig -- type -P dhcpd >/dev/null && dracut_install dhcpd -- [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd -- inst ./server-init /sbin/init -- inst ./hosts /etc/hosts -- inst ./dhcpd.conf /etc/dhcpd.conf -- dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols -- inst /etc/group /etc/group -- -- /sbin/depmod -a -b "$initdir" $kernel -- cp -a /etc/ld.so.conf* $initdir/etc -- sudo ldconfig -r "$initdir" -+ [ -f /etc/netconfig ] && dracut_install /etc/netconfig -+ type -P dhcpd >/dev/null && dracut_install dhcpd -+ [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd -+ inst ./server-init /sbin/init -+ inst ./hosts /etc/hosts -+ inst ./dhcpd.conf /etc/dhcpd.conf -+ dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols -+ inst /etc/group /etc/group -+ -+ /sbin/depmod -a -b "$initdir" $kernel -+ cp -a /etc/ld.so.conf* $initdir/etc -+ sudo ldconfig -r "$initdir" - ) - - sudo umount $TESTDIR/mnt -@@ -204,16 +219,16 @@ test_setup() { - - # Make server's dracut image - $basedir/dracut -l -i $TESTDIR/overlay / \ -- -m "dash udev-rules base rootfs-block debug kernel-modules" \ -- -d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \ -- -f $TESTDIR/initramfs.server $KVERSION || return 1 -+ -m "dash udev-rules base rootfs-block debug kernel-modules" \ -+ -d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \ -+ -f $TESTDIR/initramfs.server $KVERSION || return 1 - - } - - test_cleanup() { - if [[ -s $TESTDIR/server.pid ]]; then -- sudo kill -TERM $(cat $TESTDIR/server.pid) -- rm -f $TESTDIR/server.pid -+ sudo kill -TERM $(cat $TESTDIR/server.pid) -+ rm -f $TESTDIR/server.pid - fi - } - diff --git a/0007-dracut-functions-factor-out-all-get_maj_min-variants.patch b/0007-dracut-functions-factor-out-all-get_maj_min-variants.patch deleted file mode 100644 index 05d5705..0000000 --- a/0007-dracut-functions-factor-out-all-get_maj_min-variants.patch +++ /dev/null @@ -1,56 +0,0 @@ -From c4e48eaea1b31a8c70af43a400eda7948cfecc94 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Thu, 16 Feb 2012 11:48:17 +0100 -Subject: [PATCH] dracut-functions: factor out all get_maj_min() variants - ---- - dracut-functions | 15 +++------------ - 1 files changed, 3 insertions(+), 12 deletions(-) - -diff --git a/dracut-functions b/dracut-functions -index 41d752e..0b24889 100755 ---- a/dracut-functions -+++ b/dracut-functions -@@ -212,11 +212,7 @@ find_block_device() { - [[ $_dev != ${_dev#UUID=} ]] && _dev=/dev/disk/by-uuid/${_dev#UUID=} - [[ $_dev != ${_dev#LABEL=} ]] && _dev=/dev/disk/by-label/${_dev#LABEL=} - [[ -b $_dev ]] || return 1 # oops, not a block device. -- ls -nLl "$_dev" | { -- read _x _x _x _x _maj _min _x -- _maj=${_maj//,/} -- echo $_maj:$_min -- } && return 0 -+ get_maj_min "$_dev" && return 0 - fi - done < /etc/fstab - -@@ -281,11 +277,6 @@ check_block_and_slaves() { - return 1 - } - --get_numeric_dev() { -- local _x _maj _min -- ls -lH "$1" | { read _x _x _x _x _maj _min _x; printf "%d:%d" ${_maj%%,} $_min; } --} -- - # ugly workaround for the lvm design - # There is no volume group device, - # so, there are no slave devices for volume groups. -@@ -295,7 +286,7 @@ get_numeric_dev() { - check_vol_slaves() { - local _lv _vg _pv - for i in /dev/mapper/*; do -- _lv=$(get_numeric_dev $i) -+ _lv=$(get_maj_min $i) - if [[ $_lv = $2 ]]; then - _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null) - # strip space -@@ -303,7 +294,7 @@ check_vol_slaves() { - if [[ $_vg ]]; then - for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null) - do -- check_block_and_slaves $1 $(get_numeric_dev $_pv) && return 0 -+ check_block_and_slaves $1 $(get_maj_min $_pv) && return 0 - done - fi - fi diff --git a/0008-dracut-functions-documentation-and-restructuring.patch b/0008-dracut-functions-documentation-and-restructuring.patch deleted file mode 100644 index 56c72b2..0000000 --- a/0008-dracut-functions-documentation-and-restructuring.patch +++ /dev/null @@ -1,314 +0,0 @@ -From 7e2bca48208413b940ebdf875c718a0d08e490ac Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Thu, 16 Feb 2012 11:49:19 +0100 -Subject: [PATCH] dracut-functions: documentation and restructuring - ---- - dracut-functions | 157 ++++++++++++++++++++++++++++++++++++++++++------------ - 1 files changed, 122 insertions(+), 35 deletions(-) - -diff --git a/dracut-functions b/dracut-functions -index 0b24889..e0a08ab 100755 ---- a/dracut-functions -+++ b/dracut-functions -@@ -32,6 +32,13 @@ if ! type dinfo >/dev/null 2>&1; then - dlog_init - fi - -+# export standard hookdirs -+[[ $hookdirs ]] || { -+ hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount" -+ hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown cleanup" -+ export hookdirs -+} -+ - # Generic substring function. If $2 is in $1, return 0. - strstr() { [[ $1 =~ $2 ]]; } - -@@ -66,6 +73,8 @@ vercmp() { - esac - } - -+# is_func -+# Check whether $1 is a function. - is_func() { - [[ $(type -t $1) = "function" ]] - } -@@ -82,6 +91,12 @@ print_vars() { - done - } - -+# normalize_path -+# Prints the normalized path, where it removes any duplicated -+# and trailing slashes. -+# Example: -+# $ normalize_path ///test/test// -+# /test/test - normalize_path() { - shopt -q -s extglob - set -- "${1//+(\/)//}" -@@ -89,10 +104,15 @@ normalize_path() { - echo "${1%/}" - } - -+# convert_abs_rel -+# Prints the relative path, when creating a symlink to from . -+# Example: -+# $ convert_abs_rel /usr/bin/test /bin/test-2 -+# ../../bin/test-2 -+# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test - convert_abs_rel() { - local __current __absolute __abssize __cursize __newpath __oldifs - local -i __i __level --# PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '; - - set -- "$(normalize_path "$1")" "$(normalize_path "$2")" - -@@ -141,6 +161,12 @@ convert_abs_rel() { - echo "$__newpath" - } - -+# get_fs_env -+# Get and set the ID_FS_TYPE and ID_FS_UUID variable from udev for a device. -+# Example: -+# $ get_fs_env /dev/sda2; echo $ID_FS_TYPE; echo $ID_FS_UUID -+# ext4 -+# 551a39aa-4ae9-4e70-a262-ef665cadb574 - get_fs_env() { - [[ $1 ]] || return - unset ID_FS_TYPE -@@ -157,6 +183,21 @@ get_fs_env() { - fi - } - -+# get_fs_uuid -+# Prints the filesystem UUID for a device. -+# Example: -+# $ get_fs_uuid /dev/sda2 -+# 551a39aa-4ae9-4e70-a262-ef665cadb574 -+get_fs_uuid() ( -+ get_fs_env $1 || return -+ echo $ID_FS_UUID -+) -+ -+# get_fs_type -+# Prints the filesystem type for a device. -+# Example: -+# $ get_fs_type /dev/sda1 -+# ext4 - get_fs_type() ( - [[ $1 ]] || return - if [[ $1 != ${1#/dev/block/nfs:} ]] \ -@@ -172,12 +213,11 @@ get_fs_type() ( - find_dev_fstype $1 - ) - --get_fs_uuid() ( -- get_fs_env $1 || return -- echo $ID_FS_UUID --) -- -- -+# get_maj_min -+# Prints the major and minor of a device node. -+# Example: -+# $ get_maj_min /dev/sda2 -+# 8:2 - get_maj_min() { - local _dev - _dev=$(stat -L -c '$((0x%t)):$((0x%T))' "$1" 2>/dev/null) -@@ -185,6 +225,16 @@ get_maj_min() { - echo $_dev - } - -+# find_block_device -+# Prints the major and minor number of the block device -+# for a given mountpoint. -+# Unless $use_fstab is set to "yes" the functions -+# uses /proc/self/mountinfo as the primary source of the -+# information and only falls back to /etc/fstab, if the mountpoint -+# is not found there. -+# Example: -+# $ find_block_device /usr -+# 8:4 - find_block_device() { - local _x _mpt _majmin _dev _fs _maj _min - if [[ $use_fstab != yes ]]; then -@@ -219,6 +269,14 @@ find_block_device() { - return 1 - } - -+# find_dev_fstype -+# Echo the filesystem type for a given device. -+# /proc/self/mountinfo is taken as the primary source of information -+# and /etc/fstab is used as a fallback. -+# No newline is appended! -+# Example: -+# $ find_dev_fstype /dev/sda2;echo -+# ext4 - find_dev_fstype() { - local _x _mpt _majmin _dev _fs _maj _min - while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do -@@ -240,6 +298,9 @@ find_dev_fstype() { - # finds the major:minor of the block device backing the root filesystem. - find_root_block_device() { find_block_device /; } - -+# for_each_host_dev_fs -+# Execute " " for every "|" pair found -+# in ${host_fs_types[@]} - for_each_host_dev_fs() - { - local _func="$1" -@@ -581,12 +642,6 @@ inst() { - return 1 - } - --[[ $hookdirs ]] || { -- hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount" -- hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown cleanup" -- export hookdirs --} -- - # install function specialized for hooks - # $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook - # All hooks should be POSIX/SuS compliant, they will be sourced by init. -@@ -630,6 +685,9 @@ inst_any() { - return 1 - } - -+# dracut_install [-o ] [ ... ] -+# Install to the initramfs image -+# -o optionally install the and don't fail, if it is not there - dracut_install() { - local _optional=no - if [[ $1 = '-o' ]]; then -@@ -697,6 +755,10 @@ inst_opt_decompress() { - done - } - -+# module_check -+# execute the check() function of module-setup.sh of -+# or the "check" script, if module-setup.sh is not found -+# "check $hostonly" is called - module_check() { - local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) - local _ret -@@ -723,6 +785,35 @@ module_check() { - return $_ret - } - -+# module_check_mount -+# execute the check() function of module-setup.sh of -+# or the "check" script, if module-setup.sh is not found -+# "mount_needs=1 check 0" is called -+module_check_mount() { -+ local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) -+ local _ret -+ mount_needs=1 -+ [[ -d $_moddir ]] || return 1 -+ if [[ ! -f $_moddir/module-setup.sh ]]; then -+ # if we do not have a check script, we are unconditionally included -+ [[ -x $_moddir/check ]] || return 0 -+ mount_needs=1 $_moddir/check 0 -+ _ret=$? -+ else -+ unset check depends install installkernel -+ . $_moddir/module-setup.sh -+ is_func check || return 1 -+ check 0 -+ _ret=$? -+ unset check depends install installkernel -+ fi -+ unset mount_needs -+ return $_ret -+} -+ -+# module_depends -+# execute the depends() function of module-setup.sh of -+# or the "depends" script, if module-setup.sh is not found - module_depends() { - local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) - local _ret -@@ -743,6 +834,9 @@ module_depends() { - fi - } - -+# module_install -+# execute the install() function of module-setup.sh of -+# or the "install" script, if module-setup.sh is not found - module_install() { - local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) - local _ret -@@ -761,6 +855,9 @@ module_install() { - fi - } - -+# module_installkernel -+# execute the installkernel() function of module-setup.sh of -+# or the "installkernel" script, if module-setup.sh is not found - module_installkernel() { - local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) - local _ret -@@ -779,28 +876,9 @@ module_installkernel() { - fi - } - --module_check_mount() { -- local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) -- local _ret -- mount_needs=1 -- [[ -d $_moddir ]] || return 1 -- if [[ ! -f $_moddir/module-setup.sh ]]; then -- # if we do not have a check script, we are unconditionally included -- [[ -x $_moddir/check ]] || return 0 -- mount_needs=1 $_moddir/check 0 -- _ret=$? -- else -- unset check depends install installkernel -- . $_moddir/module-setup.sh -- is_func check || return 1 -- check 0 -- _ret=$? -- unset check depends install installkernel -- fi -- unset mount_needs -- return $_ret --} -- -+# check_mount -+# check_mount checks, if a dracut module is needed for the given -+# device and filesystem types in "${host_fs_types[@]}" - check_mount() { - local _mod=$1 - local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) -@@ -840,6 +918,10 @@ check_mount() { - return 0 - } - -+# check_module [] -+# check if a dracut module is to be used in the initramfs process -+# if is set, then the process also keeps track -+# that the modules were checked for the dependency tracking process - check_module() { - local _mod=$1 - local _moddir=$(echo ${dracutbasedir}/modules.d/??${1}) -@@ -891,6 +973,8 @@ check_module() { - return 0 - } - -+# for_each_module_dir -+# execute " 1" - for_each_module_dir() { - local _modcheck - local _mod -@@ -1028,7 +1112,10 @@ find_kernel_modules () { - find_kernel_modules_by_path drivers - } - -+# instmods [ ... ] -+# instmods - # install kernel modules along with all their dependencies. -+# can be e.g. "=block" or "=drivers/usb/storage" - instmods() { - [[ $no_kernel = yes ]] && return - # called [sub]functions inherit _fderr diff --git a/dracut.spec b/dracut.spec index 2a11d9d..6ec2b1a 100644 --- a/dracut.spec +++ b/dracut.spec @@ -9,11 +9,11 @@ %endif Name: dracut -Version: 016 -Release: 9.git20120217%{?dist} +Version: 017 +Release: 1%{?dist} Summary: Initramfs generator using udev -%if 0%{?fedora} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} Group: System Environment/Base %endif %if 0%{?suse_version} @@ -24,27 +24,19 @@ URL: https://dracut.wiki.kernel.org/ # Source can be generated by # http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2 -Patch1: 0001-Makefile-also-link-dracut-shutdown.service-to-shutdo.patch -Patch2: 0002-add-function-wait_for_route_ok.patch -Patch3: 0003-livenet-avoid-spurious-error-message-wait_for_dev.patch -Patch4: 0004-ssh-client-module-install-fix.patch -Patch5: 0005-95iscsi-fix-root-iscsi-.-case.patch -Patch6: 0006-TEST-30-ISCSI-add-test-case-for-root-iscsi-.-and-unt.patch -Patch7: 0007-dracut-functions-factor-out-all-get_maj_min-variants.patch -Patch8: 0008-dracut-functions-documentation-and-restructuring.patch BuildArch: noarch BuildRequires: dash bash git -%if 0%{?fedora} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %endif %if 0%{?suse_version} BuildRoot: %{_tmppath}/%{name}-%{version}-build %endif -%if 0%{?fedora} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} BuildRequires: docbook-style-xsl docbook-dtds libxslt %endif @@ -52,7 +44,7 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt BuildRequires: docbook-xsl-stylesheets libxslt %endif -%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 +%if 0%{?fedora} > 12 || 0%{?rhel} # no "provides", because dracut does not offer # all functionality of the obsoleted packages Obsoletes: mkinitrd <= 6.0.93 @@ -84,7 +76,11 @@ Requires: gzip Requires: module-init-tools >= 3.7-9 Requires: sed Requires: udev +%if 0%{?fedora} || 0%{?rhel} > 6 Requires: util-linux >= 2.20 +%else +Requires: util-linux-ng >= 2.17.2 +%endif %if 0%{?fedora} || 0%{?rhel} > 6 Conflicts: initscripts < 8.63-1 @@ -108,7 +104,7 @@ Provides: dracut-generic = %{version}-%{release} This package requires everything which is needed to build a generic all purpose initramfs with network support with dracut. -%if 0%{?fedora} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} >= 6 %package fips Summary: Dracut modules to build a dracut initramfs with an integrity check Requires: %{name} = %{version}-%{release} @@ -132,7 +128,7 @@ Requires: %{name}-fips = %{version}-%{release} %description fips-aesni This package requires everything which is needed to build an -all purpose initramfs with dracut, which does an integrity check +all purpose initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module. %package caps @@ -169,14 +165,16 @@ git am -p1 %{patches} make %install -%if 0%{?fedora} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} rm -rf $RPM_BUILD_ROOT %endif make install DESTDIR=$RPM_BUILD_ROOT \ libdir=%{_prefix}/lib \ bindir=%{_bindir} \ - sysconfdir=/etc mandir=%{_mandir} \ - systemdsystemunitdir=%{_unitdir} +%if %{defined _unitdir} + systemdsystemunitdir=%{_unitdir} \ +%endif + sysconfdir=/etc mandir=%{_mandir} echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/10rpmversion/dracut-version @@ -194,7 +192,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs -%if 0%{?fedora} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf %endif @@ -230,11 +228,12 @@ rm -rf $RPM_BUILD_ROOT %endif %dir %{dracutlibdir} %dir %{dracutlibdir}/modules.d +%{dracutlibdir}/dracut-functions.sh %{dracutlibdir}/dracut-functions -%{dracutlibdir}/dracut-logger +%{dracutlibdir}/dracut-logger.sh %{dracutlibdir}/dracut-initramfs-restore %config(noreplace) /etc/dracut.conf -%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} %config /etc/dracut.conf.d/01-dist.conf %endif %dir /etc/dracut.conf.d @@ -284,7 +283,7 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) /etc/logrotate.d/dracut_log %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log %dir %{_sharedstatedir}/initramfs -%if 0%{?fedora} > 16 || 0%{?rhel} > 6 +%if %{defined _unitdir} %{_unitdir}/*.service %{_unitdir}/*/*.service %endif @@ -301,7 +300,7 @@ rm -rf $RPM_BUILD_ROOT %{dracutlibdir}/modules.d/45ifcfg %{dracutlibdir}/modules.d/95znet -%if 0%{?fedora} || 0%{?rhel} > 6 +%if 0%{?fedora} || 0%{?rhel} %files fips %defattr(-,root,root,0755) %{dracutlibdir}/modules.d/01fips @@ -328,6 +327,9 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut/overlay %changelog +* Fri Feb 24 2012 Harald Hoyer 017-1 +- version 017 + * Fri Feb 17 2012 Harald Hoyer 016-9.git20120217 - update to latest git diff --git a/sources b/sources index 94df08e..3e4c0ec 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9d3acc7931a4e32f340b8b148f8624d6 dracut-016.tar.bz2 +bf8e4045d5cb9e5186ac267520d28465 dracut-017.tar.bz2