From 6adbc8b2385f395f211937b707b0c0c321179e3f Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Dec 15 2011 14:46:20 +0000 Subject: update to latest git lots of patch changes --- diff --git a/.gitignore b/.gitignore index f0689d7..ae12248 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /dracut-011-9b30d47.tar.bz2 /dracut-011.tar.bz2 /dracut-013.tar.bz2 +/dracut-014.tar.bz2 diff --git a/0001-add-x-bit-to-.sh.patch b/0001-add-x-bit-to-.sh.patch deleted file mode 100644 index 95e656f..0000000 --- a/0001-add-x-bit-to-.sh.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4a049ce55681849e6338ee355ade3b7f92ca04d7 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Fri, 12 Aug 2011 16:29:28 +0200 -Subject: [PATCH] add x-bit to *.sh - ---- - 0 files changed, 0 insertions(+), 0 deletions(-) - mode change 100644 => 100755 modules.d/90crypt/crypt-lib.sh - mode change 100644 => 100755 modules.d/90crypt/parse-keydev.sh - mode change 100644 => 100755 modules.d/90dm/dm-shutdown.sh - mode change 100644 => 100755 modules.d/90mdraid/md-shutdown.sh - mode change 100644 => 100755 modules.d/91crypt-gpg/crypt-gpg-lib.sh - -diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/90crypt/parse-keydev.sh b/modules.d/90crypt/parse-keydev.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/90dm/dm-shutdown.sh b/modules.d/90dm/dm-shutdown.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh -old mode 100644 -new mode 100755 -diff --git a/modules.d/91crypt-gpg/crypt-gpg-lib.sh b/modules.d/91crypt-gpg/crypt-gpg-lib.sh -old mode 100644 -new mode 100755 diff --git a/0001-dracut-export-host_fs_types-host_devs.patch b/0001-dracut-export-host_fs_types-host_devs.patch new file mode 100644 index 0000000..1c31676 --- /dev/null +++ b/0001-dracut-export-host_fs_types-host_devs.patch @@ -0,0 +1,149 @@ +From 7ae5d9d11d1a0ccd31dced528e2792f1c1d5aeca Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 8 Dec 2011 10:25:58 +0100 +Subject: [PATCH] dracut: export host_fs_types host_devs + +Determine devices and filesystems to be included in the host-only +initramfs image. + +To get a minimal initramfs, which can mount + / + /etc + /usr + /usr/bin + /usr/sbin + /usr/lib + /usr/lib64 + /boot +we look in fstab for the corresponding devices and determine their and +their slaves' filesystem type and put all that in $host_fs_types +and $host_devs. +--- + dracut | 42 +++++++++++++++++++++++++++++++++++++++++- + dracut-functions | 30 ++++++++++++++++++++++++++---- + 2 files changed, 67 insertions(+), 5 deletions(-) + +diff --git a/dracut b/dracut +index 45ee759..3d08680 100755 +--- a/dracut ++++ b/dracut +@@ -507,12 +507,52 @@ trap 'exit 1;' SIGINT + # Need to be able to have non-root users read stuff (rpcbind etc) + chmod 755 "$initdir" + ++if [[ $hostonly ]]; then ++ ++ _get_fs_type() ( ++ [[ $1 ]] || return ++ if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then ++ echo -n "$ID_FS_TYPE " ++ return 1 ++ fi ++ if find_dev_fstype $1; then ++ echo -n " " ++ return 1 ++ fi ++ return 1 ++ ) ++ ++ push host_mp \ ++ "/" \ ++ "/etc" \ ++ "/usr" \ ++ "/usr/bin" \ ++ "/usr/sbin" \ ++ "/usr/lib" \ ++ "/usr/lib64" \ ++ "/boot" ++ ++ host_fs_types="" ++ for mp in "${host_mp[@]}"; do ++ mountpoint "$mp" >/dev/null 2>&1 || continue ++ push host_devs $(find_block_device "$mp") ++ done ++ for dev in "${host_devs[@]}"; do ++ unset fs_type ++ for fstype in $(_get_fs_type $dev) \ ++ $(check_block_and_slaves _get_fs_type $dev); do ++ strstr " $host_fs_types " "$fstype" || host_fs_types+="$fstype " ++ done ++ done ++fi ++echo "host_fs_types=$host_fs_types" ++ + export initdir dracutbasedir dracutmodules drivers \ + fw_dir drivers_dir debug no_kernel kernel_only \ + add_drivers mdadmconf lvmconf filesystems \ + use_fstab libdir usrlibdir fscks nofscks \ + stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \ +- debug ++ debug host_fs_types host_devs + + # Create some directory structure first + [[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}" +diff --git a/dracut-functions b/dracut-functions +index c54cd7c..258d376 100755 +--- a/dracut-functions ++++ b/dracut-functions +@@ -165,8 +165,11 @@ get_fs_type() ( + echo "nfs" + return + fi +- get_fs_env $1 || return +- echo $ID_FS_TYPE ++ if get_fs_env $1; then ++ echo $ID_FS_TYPE ++ return ++ fi ++ find_dev_fstype $1 + ) + + get_fs_uuid() ( +@@ -174,11 +177,11 @@ get_fs_uuid() ( + echo $ID_FS_UUID + ) + +-# finds the major:minor of the block device backing the root filesystem. + find_block_device() { + local _x _mpt _majmin _dev _fs _maj _min + if [[ $use_fstab != yes ]]; then + while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do ++ [[ $_mpt = $1 ]] || continue + [[ $_fs = nfs ]] && { echo $_dev; return 0;} + [[ $_fs = nfs3 ]] && { echo $_dev; return 0;} + [[ $_fs = nfs4 ]] && { echo $_dev; return 0;} +@@ -189,7 +192,7 @@ find_block_device() { + echo $_maj:$_min + } && return 0 + } +- if [[ $_mpt = $1 ]] && [[ ${_majmin#0:} = $_majmin ]]; then ++ if [[ ${_majmin#0:} = $_majmin ]]; then + echo $_majmin + return 0 # we have a winner! + fi +@@ -215,6 +218,25 @@ find_block_device() { + return 1 + } + ++find_dev_fstype() { ++ local _x _mpt _majmin _dev _fs _maj _min ++ while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do ++ [[ $_dev = $1 ]] || continue ++ echo -n $_fs; ++ return 0; ++ done < /proc/self/mountinfo ++ ++ # fall back to /etc/fstab ++ while read _dev _mpt _fs _x; do ++ [[ $_dev = $1 ]] || continue ++ echo -n $_fs; ++ return 0; ++ done < /etc/fstab ++ ++ return 1 ++} ++ ++# finds the major:minor of the block device backing the root filesystem. + find_root_block_device() { find_block_device /; } + + # Walk all the slave relationships for a given block device. diff --git a/0002-90dmsquash-live-dmsquash-live-root-include-fs_lib.sh.patch b/0002-90dmsquash-live-dmsquash-live-root-include-fs_lib.sh.patch deleted file mode 100644 index dc5edc0..0000000 --- a/0002-90dmsquash-live-dmsquash-live-root-include-fs_lib.sh.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 566dab2ac1323df9d21b4d682312f787b10a4bdc Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Wed, 17 Aug 2011 08:24:30 +0200 -Subject: [PATCH] 90dmsquash-live/dmsquash-live-root: include fs_lib.sh for - det_fs() - -https://bugzilla.redhat.com/show_bug.cgi?id=730579 ---- - modules.d/90dmsquash-live/dmsquash-live-root | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - -diff --git a/modules.d/90dmsquash-live/dmsquash-live-root b/modules.d/90dmsquash-live/dmsquash-live-root -index 265de19..90e633c 100755 ---- a/modules.d/90dmsquash-live/dmsquash-live-root -+++ b/modules.d/90dmsquash-live/dmsquash-live-root -@@ -3,6 +3,8 @@ - # ex: ts=8 sw=4 sts=4 et filetype=sh - - type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh -+type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh -+ - [ -f /tmp/root.info ] && . /tmp/root.info - - PATH=/usr/sbin:/usr/bin:/sbin:/bin diff --git a/0002-module-setup.sh-use-host_fs_types-host_devs.patch b/0002-module-setup.sh-use-host_fs_types-host_devs.patch new file mode 100644 index 0000000..e99d8b7 --- /dev/null +++ b/0002-module-setup.sh-use-host_fs_types-host_devs.patch @@ -0,0 +1,480 @@ +From 480d772f22a2f690928c59c7c0ebfa7dc00332ea Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 8 Dec 2011 10:43:29 +0100 +Subject: [PATCH] */module-setup.sh: use host_fs_types host_devs + +For the $hostonly case, use $host_fs_types and $host_devs to determine, +if a module has to be included in the initramfs. +--- + dracut | 16 +++++--- + dracut-functions | 31 +++++++++++++--- + modules.d/90btrfs/module-setup.sh | 16 ++++---- + modules.d/90crypt/module-setup.sh | 26 ++++++++----- + modules.d/90dmraid/module-setup.sh | 40 +++++++++++++++------ + modules.d/90kernel-modules/module-setup.sh | 6 +++- + modules.d/90lvm/module-setup.sh | 25 ++++++++----- + modules.d/90mdraid/module-setup.sh | 40 +++++++++++++++----- + modules.d/95fstab-sys/module-setup.sh | 2 +- + modules.d/95nfs/module-setup.sh | 14 +++++-- + modules.d/99base/module-setup.sh | 1 + + modules.d/99fs-lib/module-setup.sh | 55 ++++++++++++++-------------- + 12 files changed, 179 insertions(+), 93 deletions(-) + +diff --git a/dracut b/dracut +index 3d08680..46694f8 100755 +--- a/dracut ++++ b/dracut +@@ -508,15 +508,19 @@ trap 'exit 1;' SIGINT + chmod 755 "$initdir" + + if [[ $hostonly ]]; then ++ # in hostonly mode, determine all devices, which have to be accessed ++ # and examine them for filesystem types ++ ++ unset host_fs_types + + _get_fs_type() ( + [[ $1 ]] || return + if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then +- echo -n "$ID_FS_TYPE " ++ echo "$1|$ID_FS_TYPE" + return 1 + fi +- if find_dev_fstype $1; then +- echo -n " " ++ if fstype=$(find_dev_fstype $1); then ++ echo "$1|$fstype" + return 1 + fi + return 1 +@@ -532,7 +536,6 @@ if [[ $hostonly ]]; then + "/usr/lib64" \ + "/boot" + +- host_fs_types="" + for mp in "${host_mp[@]}"; do + mountpoint "$mp" >/dev/null 2>&1 || continue + push host_devs $(find_block_device "$mp") +@@ -541,11 +544,12 @@ if [[ $hostonly ]]; then + unset fs_type + for fstype in $(_get_fs_type $dev) \ + $(check_block_and_slaves _get_fs_type $dev); do +- strstr " $host_fs_types " "$fstype" || host_fs_types+="$fstype " ++ if ! strstr " ${host_fs_types[*]} " " $fstype ";then ++ push host_fs_types "$fstype" ++ fi + done + done + fi +-echo "host_fs_types=$host_fs_types" + + export initdir dracutbasedir dracutmodules drivers \ + fw_dir drivers_dir debug no_kernel kernel_only \ +diff --git a/dracut-functions b/dracut-functions +index 258d376..d95df14 100755 +--- a/dracut-functions ++++ b/dracut-functions +@@ -177,6 +177,14 @@ get_fs_uuid() ( + echo $ID_FS_UUID + ) + ++ ++get_maj_min() { ++ local _dev ++ _dev=$(stat -c '$((0x%T)):$((0x%t))' "$1" 2>/dev/null) ++ _dev=$(eval "echo $_dev") ++ echo $_dev ++} ++ + find_block_device() { + local _x _mpt _majmin _dev _fs _maj _min + if [[ $use_fstab != yes ]]; then +@@ -186,11 +194,8 @@ find_block_device() { + [[ $_fs = nfs3 ]] && { echo $_dev; return 0;} + [[ $_fs = nfs4 ]] && { echo $_dev; return 0;} + [[ $_fs = btrfs ]] && { +- ls -nLl "$_dev" | { +- read _x _x _x _x _maj _min _x +- _maj=${_maj//,/} +- echo $_maj:$_min +- } && return 0 ++ get_maj_min $_dev ++ return 0; + } + if [[ ${_majmin#0:} = $_majmin ]]; then + echo $_majmin +@@ -239,6 +244,22 @@ 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() ++{ ++ local _func="$1" ++ for f in ${host_fs_types[@]}; do ++ OLDIFS="$IFS" ++ IFS="|" ++ set -- $f ++ IFS="$OLDIFS" ++ dev=$1 ++ [[ -b /dev/block/$dev ]] && dev="/dev/block/$dev" ++ [[ -b $dev ]] || continue ++ fs="$2" ++ $_func $dev $fs ++ done ++} ++ + # Walk all the slave relationships for a given block device. + # Stop when our helper function returns success + # $1 = function to call on every found block device +diff --git a/modules.d/90btrfs/module-setup.sh b/modules.d/90btrfs/module-setup.sh +index 7b0b424..f89713f 100755 +--- a/modules.d/90btrfs/module-setup.sh ++++ b/modules.d/90btrfs/module-setup.sh +@@ -11,14 +11,14 @@ check() { + . $dracutfunctions + [[ $debug ]] && set -x + +- is_btrfs() { get_fs_type /dev/block/$1 | grep -q btrfs; } +- +- if [[ $hostonly ]]; then +- _rootdev=$(find_root_block_device) +- if [[ $_rootdev ]]; then +- is_btrfs "$_rootdev" || return 1 +- fi +- fi ++ [[ $hostonly ]] && { ++ local _found ++ for fs in $host_fs_types; do ++ [[ "$fs" = "|btrfs" ]] && _found="1" ++ done ++ [[ $_found ]] || return 1 ++ unset _found ++ } + + return 0 + } +diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh +index 2a8268f..42c6b48 100755 +--- a/modules.d/90crypt/module-setup.sh ++++ b/modules.d/90crypt/module-setup.sh +@@ -9,18 +9,24 @@ check() { + + . $dracutfunctions + +- is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; } ++ check_crypt() { ++ local dev=$1 fs=$2 ++ [[ $fs = "crypto_LUKS" ]] || continue ++ ID_FS_UUID=$(udevadm info --query=property --name=$dev \ ++ | while read line; do ++ [[ ${line#ID_FS_UUID} = $line ]] && continue ++ eval "$line" ++ echo $ID_FS_UUID ++ break ++ done) ++ [[ ${ID_FS_UUID} ]] || continue ++ echo " rd.luks.uuid=${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf" ++ } + + [[ $hostonly ]] && { +- _rootdev=$(find_root_block_device) +- if [[ $_rootdev ]]; then +- # root lives on a block device, so we can be more precise about +- # hostonly checking +- check_block_and_slaves is_crypt "$_rootdev" || return 1 +- else +- # root is not on a block device, use the shotgun approach +- blkid | grep -q crypto\?_LUKS || return 1 +- fi ++ [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d" ++ for_each_host_dev_fs check_crypt ++ [ -f "${initdir}/etc/cmdline.d/90crypt.conf" ] || return 1 + } + + return 0 +diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh +index 87a4d1e..9de6c63 100755 +--- a/modules.d/90dmraid/module-setup.sh ++++ b/modules.d/90dmraid/module-setup.sh +@@ -11,19 +11,37 @@ check() { + . $dracutfunctions + [[ $debug ]] && set -x + +- is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \ +- grep -q _raid_member; } ++ check_dmraid() { ++ local dev=$1 fs=$2 holder DEVPATH DM_NAME ++ [[ "$fs" = "linux_raid_member" ]] && continue ++ [[ "$fs" = "${fs%%_raid_member}" ]] && continue ++ ++ DEVPATH=$(udevadm info --query=property --name=$dev \ ++ | while read line; do ++ [[ ${line#DEVPATH} = $line ]] && continue ++ eval "$line" ++ echo $DEVPATH ++ break ++ done) ++ for holder in /sys/$DEVPATH/holders/*; do ++ [[ -e $holder ]] || continue ++ DM_NAME=$(udevadm info --query=property --path=$holder \ ++ | while read line; do ++ [[ ${line#DM_NAME} = $line ]] && continue ++ eval "$line" ++ echo $DM_NAME ++ break ++ done) ++ done ++ ++ [[ ${DM_NAME} ]] || continue ++ echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf" ++ } + + [[ $hostonly ]] && { +- _rootdev=$(find_root_block_device) +- if [[ $_rootdev ]]; then +- # root lives on a block device, so we can be more precise about +- # hostonly checking +- check_block_and_slaves is_dmraid "$_rootdev" || return 1 +- else +- # root is not on a block device, use the shotgun approach +- dmraid -r | grep -q ok || return 1 +- fi ++ [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d" ++ for_each_host_dev_fs check_dmraid ++ [ -f "${initdir}/etc/cmdline.d/90dmraid.conf" ] || return 1 + } + + return 0 +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index d7aadd8..8d2ab91 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -50,7 +50,11 @@ installkernel() { + rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2 + fi + else +- hostonly='' instmods $(get_fs_type "/dev/block/$(find_root_block_device)") ++ inst_fs() { ++ [[ $2 ]] || return 1 ++ hostonly='' instmods $2 ++ } ++ for_each_host_dev_fs inst_fs + fi + else + hostonly='' instmods $drivers +diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh +index 40dc350..87751cb 100755 +--- a/modules.d/90lvm/module-setup.sh ++++ b/modules.d/90lvm/module-setup.sh +@@ -10,18 +10,23 @@ check() { + . $dracutfunctions + [[ $debug ]] && set -x + +- is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; } ++ check_lvm() { ++ local dev=$1 ++ DM_LV_NAME=$(udevadm info --query=property --name=$dev \ ++ | while read line; do ++ [[ ${line#DM_LV_NAME} = $line ]] && continue ++ eval "$line" ++ echo $DM_LV_NAME ++ break ++ done) ++ [[ ${DM_LV_NAME} ]] || continue ++ echo " rd.lvm.lv=${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf" ++ } + + [[ $hostonly ]] && { +- _rootdev=$(find_root_block_device) +- if [[ $_rootdev ]]; then +- # root lives on a block device, so we can be more precise about +- # hostonly checking +- check_block_and_slaves is_lvm "$_rootdev" || return 1 +- else +- # root is not on a block device, use the shotgun approach +- blkid | grep -q LVM2_member || return 1 +- fi ++ [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d" ++ for_each_host_dev_fs check_lvm ++ [ -f "${initdir}/etc/cmdline.d/90lvm.conf" ] || return 1 + } + + return 0 +diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh +index 029d667..05e0127 100755 +--- a/modules.d/90mdraid/module-setup.sh ++++ b/modules.d/90mdraid/module-setup.sh +@@ -10,18 +10,38 @@ check() { + . $dracutfunctions + [[ $debug ]] && set -x + +- is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; } ++ check_mdraid() { ++ local dev=$1 fs=$2 holder DEVPATH MD_UUID ++ [[ "$fs" = "linux_raid_member" ]] && continue ++ [[ "$fs" = "${fs%%_raid_member}" ]] && continue ++ ++ DEVPATH=$(udevadm info --query=property --name=$dev \ ++ | while read line; do ++ [[ ${line#DEVPATH} = $line ]] && continue ++ eval "$line" ++ echo $DEVPATH ++ break ++ done) ++ ++ for holder in /sys/$DEVPATH/holders/*; do ++ [[ -e $holder ]] || continue ++ MD_UUID=$(udevadm info --query=property --path=$holder \ ++ | while read line; do ++ [[ ${line#MD_UUID} = $line ]] && continue ++ eval "$line" ++ echo $MD_UUID ++ break ++ done) ++ done ++ ++ [[ ${MD_UUID} ]] || continue ++ echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf" ++ } + + [[ $hostonly ]] && { +- _rootdev=$(find_root_block_device) +- if [[ $_rootdev ]]; then +- # root lives on a block device, so we can be more precise about +- # hostonly checking +- check_block_and_slaves is_mdraid "$_rootdev" || return 1 +- else +- # root is not on a block device, use the shotgun approach +- blkid | egrep -q '(linux|isw|ddf)_raid' || return 1 +- fi ++ [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d" ++ for_each_host_dev_fs check_mdraid ++ [[ -f "${initdir}/etc/cmdline.d/90mdraid.conf" ]] || return 1 + } + + return 0 +diff --git a/modules.d/95fstab-sys/module-setup.sh b/modules.d/95fstab-sys/module-setup.sh +index c22b047..ea9db83 100755 +--- a/modules.d/95fstab-sys/module-setup.sh ++++ b/modules.d/95fstab-sys/module-setup.sh +@@ -11,6 +11,6 @@ depends() { + } + + install() { +- dracut_install /etc/fstab.sys ++ inst /etc/fstab.sys /etc/fstab + inst_hook pre-pivot 00 "$moddir/mount-sys.sh" + } +diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh +index c5f97c9..bb3b793 100755 +--- a/modules.d/95nfs/module-setup.sh ++++ b/modules.d/95nfs/module-setup.sh +@@ -3,13 +3,19 @@ + # ex: ts=8 sw=4 sts=4 et filetype=sh + + check() { +- # If hostonly was requested, fail the check if we are not actually +- # booting from root. +- [ $hostonly ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && return 1 +- + # If our prerequisites are not met, fail anyways. + type -P rpcbind >/dev/null || type -P portmap >/dev/null || return 1 + type -P rpc.statd mount.nfs mount.nfs4 umount >/dev/null || return 1 ++ ++ [[ $hostonly ]] && { ++ for fs in ${host_fs_types[@]}; do ++ strstr "$fs" "|nfs" && return 0 ++ strstr "$fs" "|nfs3" && return 0 ++ strstr "$fs" "|nfs4" && return 0 ++ done ++ return 255 ++ } ++ + return 0 + } + +diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh +index f6dc920..5297a9d 100755 +--- a/modules.d/99base/module-setup.sh ++++ b/modules.d/99base/module-setup.sh +@@ -38,6 +38,7 @@ install() { + dracut_install switch_root || dfatal "Failed to install switch_root" + + inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh" ++ inst "$moddir/mount-hook.sh" "/usr/bin/mount-hook" + inst_hook cmdline 10 "$moddir/parse-root-opts.sh" + mkdir -p "${initdir}/var" + [ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp +diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh +index 04b63f1..9c900cc 100755 +--- a/modules.d/99fs-lib/module-setup.sh ++++ b/modules.d/99fs-lib/module-setup.sh +@@ -10,6 +10,32 @@ depends() { + return 0 + } + ++ ++echo_fs_helper() { ++ local dev=$1 fs=$2 ++ case "$fs" in ++ xfs) ++ echo -n " xfs_db xfs_repair xfs_check " ++ ;; ++ ext?) ++ echo -n " e2fsck " ++ ;; ++ jfs) ++ echo -n " jfs_fsck " ++ ;; ++ reiserfs) ++ echo -n " reiserfsck " ++ ;; ++ btrfs) ++ echo -n " btrfsck " ++ ;; ++ *) ++ [[ -x fsck.$fs ]] && echo -n " fsck.$fs " ++ ;; ++ esac ++} ++ ++ + install() { + local _helpers + +@@ -25,33 +51,8 @@ install() { + e2fsck jfs_fsck reiserfsck btrfsck + " + if [[ $hostonly ]]; then +- print_fs_type() { get_fs_type /dev/block/$1; } +- _rootdev=$(find_root_block_device) +- if [[ $_rootdev ]]; then +- _helpers="umount mount " +- for fs in $(check_block_and_slaves print_fs_type "$_rootdev"); do +- case "$fs" in +- xfs) +- _helpers+=" xfs_db xfs_repair xfs_check " +- ;; +- ext?) +- _helpers+=" e2fsck " +- ;; +- jfs) +- _helpers+=" jfs_fsck " +- ;; +- reiserfs) +- _helpers+=" reiserfsck " +- ;; +- btrfs) +- _helpers+=" btrfsck " +- ;; +- *) +- [[ -x fsck.$fs ]] && _helpers+= " fsck.$fs " +- ;; +- esac +- done +- fi ++ _helpers="umount mount " ++ _helpers+=$(for_each_host_dev_fs echo_fs_helper) + fi + else + _helpers="$fscks" diff --git a/0003-95iscsi-iscsiroot-unset-used-variables-before-starti.patch b/0003-95iscsi-iscsiroot-unset-used-variables-before-starti.patch new file mode 100644 index 0000000..7e110f2 --- /dev/null +++ b/0003-95iscsi-iscsiroot-unset-used-variables-before-starti.patch @@ -0,0 +1,29 @@ +From 43f218522128b7864346bb11f7aad234410db745 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 8 Dec 2011 15:04:04 +0100 +Subject: [PATCH] 95iscsi/iscsiroot: unset used variables before starting + +If iscsiroot is called multiple times, then some variables can hold the +values of a previous call, so unset all variables before using them. + +https://bugzilla.redhat.com/show_bug.cgi?id=752066 +--- + modules.d/95iscsi/iscsiroot | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot +index bcdc046..e7bac74 100755 +--- a/modules.d/95iscsi/iscsiroot ++++ b/modules.d/95iscsi/iscsiroot +@@ -51,6 +51,11 @@ if getargbool 0 rd.iscsi.firmware -y iscsi_firmware ; then + exit 0 + fi + ++unset iscsi_initiator iscsi_target_name iscsi_target_ip iscsi_target_port ++unset iscsi_target_group iscsi_protocol iscsirw iscsi_lun ++unset iscsi_username iscsi_password ++unset iscsi_in_username iscsi_in_password ++ + # override conf settings by command line options + arg=$(getargs rd.iscsi.initiator iscsi_initiator=) + [ -n "$arg" ] && iscsi_initiator=$arg diff --git a/0003-fix-live-crash-with-livenet-installed.patch b/0003-fix-live-crash-with-livenet-installed.patch deleted file mode 100644 index 4c28383..0000000 --- a/0003-fix-live-crash-with-livenet-installed.patch +++ /dev/null @@ -1,24 +0,0 @@ -From fb216d1a7cc981a50e4cae9179a88406663dda4e Mon Sep 17 00:00:00 2001 -From: Will Woods -Date: Mon, 15 Aug 2011 11:10:59 -0400 -Subject: [PATCH] fix live crash with livenet installed - -parse-livenet.sh shouldn't mess with $root unless it finds a valid URL. ---- - modules.d/90livenet/parse-livenet.sh | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/modules.d/90livenet/parse-livenet.sh b/modules.d/90livenet/parse-livenet.sh -index 78fc906..323fd4a 100755 ---- a/modules.d/90livenet/parse-livenet.sh -+++ b/modules.d/90livenet/parse-livenet.sh -@@ -12,8 +12,8 @@ liveurl="${liveurl#live:}" - case "$liveurl" in - http://*|https://*|ftp://*) - netroot="livenet:$liveurl" -+ root="livenet" # quiet complaints from init - rootok=1 ;; - esac - --root="livenet" # quiet complaints from init - echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/livenet.sh diff --git a/0004-99base-dracut-lib.sh-killproc-prefix-local-variables.patch b/0004-99base-dracut-lib.sh-killproc-prefix-local-variables.patch new file mode 100644 index 0000000..9334b0d --- /dev/null +++ b/0004-99base-dracut-lib.sh-killproc-prefix-local-variables.patch @@ -0,0 +1,36 @@ +From 4d63882615543b19b779607563ab2a098d54b403 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 9 Dec 2011 10:12:05 +0100 +Subject: [PATCH] 99base/dracut-lib.sh: killproc, prefix local variables + +--- + modules.d/99base/dracut-lib.sh | 16 ++++++++-------- + 1 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index e86d209..c881869 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -627,14 +627,14 @@ wait_for_dev() + } + + killproc() { +- local exe="$(command -v $1)" +- local sig=$2 +- local i +- [ -x "$exe" ] || return 1 +- for i in /proc/[0-9]*; do +- [ "$i" = "/proc/1" ] && continue +- if [ -e "$i"/exe ] && [ "$i/exe" -ef "$exe" ] ; then +- kill $sig ${i##*/} ++ local _exe="$(command -v $1)" ++ local _sig=$2 ++ local _i ++ [ -x "$_exe" ] || return 1 ++ for _i in /proc/[0-9]*; do ++ [ "$_i" = "/proc/1" ] && continue ++ if [ -e "$_i"/_exe ] && [ "$_i/_exe" -ef "$_exe" ] ; then ++ kill $_sig ${_i##*/} + fi + done + } diff --git a/0004-profile.py-parse-the-output-of-dracut-profile-for-pr.patch b/0004-profile.py-parse-the-output-of-dracut-profile-for-pr.patch deleted file mode 100644 index 8971e8d..0000000 --- a/0004-profile.py-parse-the-output-of-dracut-profile-for-pr.patch +++ /dev/null @@ -1,75 +0,0 @@ -From e7b8fe03e8b76ec4aa4797759cd849fcf792b33c Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Wed, 17 Aug 2011 10:08:23 +0200 -Subject: [PATCH] profile.py: parse the output of "dracut --profile" for - profiling - ---- - profile.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 files changed, 58 insertions(+), 0 deletions(-) - create mode 100644 profile.py - -diff --git a/profile.py b/profile.py -new file mode 100644 -index 0000000..e1d0cab ---- /dev/null -+++ b/profile.py -@@ -0,0 +1,58 @@ -+# -+# parse the output of "dracut --profile" and produce profiling information -+# -+# Copyright 2011 Harald Hoyer -+# Copyright 2011 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 -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+# -+ -+import sys -+import operator -+import re -+loglines = sys.stdin -+ -+logpats = r'[+]+[ \t]+([^ \t]+)[ \t]+([^ \t:]+):[ ]+.*' -+ -+logpat = re.compile(logpats) -+ -+groups = (logpat.match(line) for line in loglines) -+tuples = (g.groups() for g in groups if g) -+ -+def gen_times(t): -+ oldx=None -+ for x in t: -+ fx=float(x[0]) -+ if oldx: -+ #print fx - float(oldx[0]), x[0], x[1], oldx[0], oldx[1] -+ yield (fx - float(oldx[0]), oldx[1]) -+ -+ oldx = x -+ -+colnames = ('time','line') -+ -+log = (dict(zip(colnames,t)) for t in gen_times(tuples)) -+ -+if __name__ == '__main__': -+ e={} -+ for x in log: -+ if not x['line'] in e: -+ e[x['line']] = x['time'] -+ else: -+ e[x['line']] += x['time'] -+ -+ sorted_x = sorted(e.iteritems(), key=operator.itemgetter(1), reverse=True) -+ for x in sorted_x: -+ print x[0], x[1] -+ diff --git a/0005-add-TEST-16-DMSQUASH.patch b/0005-add-TEST-16-DMSQUASH.patch deleted file mode 100644 index f3ec4f3..0000000 --- a/0005-add-TEST-16-DMSQUASH.patch +++ /dev/null @@ -1,391 +0,0 @@ -From ea8e543bb86660dd6ccc3048ae9916358b58a6b3 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Wed, 17 Aug 2011 13:42:16 +0200 -Subject: [PATCH] add TEST-16-DMSQUASH - -This is a test for Fedora LiveCDs created via livecd-tools ---- - test/TEST-16-DMSQUASH/99-idesymlinks.rules | 8 + - test/TEST-16-DMSQUASH/Makefile | 10 ++ - test/TEST-16-DMSQUASH/create.py | 186 ++++++++++++++++++++++++ - test/TEST-16-DMSQUASH/cryptroot-ask | 6 + - test/TEST-16-DMSQUASH/hard-off.sh | 3 + - test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks | 22 +++ - test/TEST-16-DMSQUASH/test-init | 17 ++ - test/TEST-16-DMSQUASH/test.sh | 66 +++++++++ - 8 files changed, 318 insertions(+), 0 deletions(-) - create mode 100644 test/TEST-16-DMSQUASH/99-idesymlinks.rules - create mode 100644 test/TEST-16-DMSQUASH/Makefile - create mode 100644 test/TEST-16-DMSQUASH/create.py - create mode 100755 test/TEST-16-DMSQUASH/cryptroot-ask - create mode 100755 test/TEST-16-DMSQUASH/hard-off.sh - create mode 100644 test/TEST-16-DMSQUASH/livecd-fedora-minimal.ks - create mode 100755 test/TEST-16-DMSQUASH/test-init - create mode 100755 test/TEST-16-DMSQUASH/test.sh - -diff --git a/test/TEST-16-DMSQUASH/99-idesymlinks.rules b/test/TEST-16-DMSQUASH/99-idesymlinks.rules -new file mode 100644 -index 0000000..d557790 ---- /dev/null -+++ b/test/TEST-16-DMSQUASH/99-idesymlinks.rules -@@ -0,0 +1,8 @@ -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda" -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}" -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb" -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}" -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc" -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}" -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd" -+ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}" -diff --git a/test/TEST-16-DMSQUASH/Makefile b/test/TEST-16-DMSQUASH/Makefile -new file mode 100644 -index 0000000..bc0ddb6 ---- /dev/null -+++ b/test/TEST-16-DMSQUASH/Makefile -@@ -0,0 +1,10 @@ -+all: -+ @make -s --no-print-directory -C ../.. all -+ @basedir=../.. testdir=../ ./test.sh --all -+setup: -+ @make --no-print-directory -C ../.. all -+ @basedir=../.. testdir=../ ./test.sh --setup -+clean: -+ @basedir=../.. testdir=../ ./test.sh --clean -+run: -+ @basedir=../.. testdir=../ ./test.sh --run -diff --git a/test/TEST-16-DMSQUASH/create.py b/test/TEST-16-DMSQUASH/create.py -new file mode 100644 -index 0000000..15d29ff ---- /dev/null -+++ b/test/TEST-16-DMSQUASH/create.py -@@ -0,0 +1,186 @@ -+#!/usr/bin/python -tt -+# -+# livecd-creator : Creates Live CD based for Fedora. -+# -+# Copyright 2007, Red Hat Inc. -+# -+# 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 -+# the Free Software Foundation; version 2 of the License. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU Library General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+import os -+import os.path -+import sys -+import time -+import optparse -+import logging -+import shutil -+from distutils.dir_util import copy_tree -+ -+import imgcreate -+from imgcreate.fs import makedirs -+ -+class myLiveImageCreator(imgcreate.x86LiveImageCreator): -+ def install(self, repo_urls = {}): -+ copy_tree("root-source", self._instroot) -+ -+ def configure(self): -+ self._create_bootconfig() -+ -+ def _get_kernel_versions(self): -+ ret = {} -+ version=os.uname() -+ version=version[2] -+ ret["kernel-" + version] = [version] -+ return ret -+ -+ def __sanity_check(self): -+ pass -+ -+class Usage(Exception): -+ def __init__(self, msg = None, no_error = False): -+ Exception.__init__(self, msg, no_error) -+ -+def parse_options(args): -+ parser = optparse.OptionParser() -+ -+ imgopt = optparse.OptionGroup(parser, "Image options", -+ "These options define the created image.") -+ imgopt.add_option("-c", "--config", type="string", dest="kscfg", -+ help="Path or url to kickstart config file") -+ imgopt.add_option("-b", "--base-on", type="string", dest="base_on", -+ help="Add packages to an existing live CD iso9660 image.") -+ imgopt.add_option("-f", "--fslabel", type="string", dest="fslabel", -+ help="File system label (default based on config name)") -+ # Provided for img-create compatibility -+ imgopt.add_option("-n", "--name", type="string", dest="fslabel", -+ help=optparse.SUPPRESS_HELP) -+ imgopt.add_option("", "--image-type", type="string", dest="image_type", -+ help=optparse.SUPPRESS_HELP) -+ imgopt.add_option("", "--compression-type", type="string", dest="compress_type", -+ help="Compression type recognized by mksquashfs " -+ "(default xz needs a 2.6.38+ kernel, gzip works " -+ "with all kernels, lzo needs a 2.6.36+ kernel, lzma " -+ "needs custom kernel.) Set to 'None' to force read " -+ "from base_on.", -+ default="xz") -+ imgopt.add_option("", "--releasever", type="string", dest="releasever", -+ default=None, -+ help="Value to substitute for $releasever in kickstart repo urls") -+ parser.add_option_group(imgopt) -+ -+ # options related to the config of your system -+ sysopt = optparse.OptionGroup(parser, "System directory options", -+ "These options define directories used on your system for creating the live image") -+ sysopt.add_option("-t", "--tmpdir", type="string", -+ dest="tmpdir", default="/var/tmp", -+ help="Temporary directory to use (default: /var/tmp)") -+ sysopt.add_option("", "--cache", type="string", -+ dest="cachedir", default=None, -+ help="Cache directory to use (default: private cache") -+ parser.add_option_group(sysopt) -+ -+ imgcreate.setup_logging(parser) -+ -+ # debug options not recommended for "production" images -+ # Start a shell in the chroot for post-configuration. -+ parser.add_option("-l", "--shell", action="store_true", dest="give_shell", -+ help=optparse.SUPPRESS_HELP) -+ # Don't compress the image. -+ parser.add_option("-s", "--skip-compression", action="store_true", dest="skip_compression", -+ help=optparse.SUPPRESS_HELP) -+ parser.add_option("", "--skip-minimize", action="store_true", dest="skip_minimize", -+ help=optparse.SUPPRESS_HELP) -+ -+ (options, args) = parser.parse_args() -+ -+ # Pretend to be a image-creator if called with that name -+ options.image_type = 'livecd' -+ if options.image_type not in ('livecd', 'image'): -+ raise Usage("'%s' is a recognized image type" % options.image_type) -+ -+ # image-create compatibility: Last argument is kickstart file -+ if len(args) == 1: -+ options.kscfg = args.pop() -+ if len(args): -+ raise Usage("Extra arguments given") -+ -+ if options.base_on and not os.path.isfile(options.base_on): -+ raise Usage("Image file '%s' does not exist" %(options.base_on,)) -+ if options.image_type == 'livecd': -+ if options.fslabel and len(options.fslabel) > imgcreate.FSLABEL_MAXLEN: -+ raise Usage("CD labels are limited to 32 characters") -+ if options.fslabel and options.fslabel.find(" ") != -1: -+ raise Usage("CD labels cannot contain spaces.") -+ -+ return options -+ -+def main(): -+ try: -+ options = parse_options(sys.argv[1:]) -+ except Usage, (msg, no_error): -+ if no_error: -+ out = sys.stdout -+ ret = 0 -+ else: -+ out = sys.stderr -+ ret = 2 -+ if msg: -+ print >> out, msg -+ return ret -+ -+ if os.geteuid () != 0: -+ print >> sys.stderr, "You must run %s as root" % sys.argv[0] -+ return 1 -+ -+ if options.fslabel: -+ fslabel = options.fslabel -+ name = fslabel -+ else: -+ name = "livecd" -+ -+ fslabel = "LiveCD" -+ logging.info("Using label '%s' and name '%s'" % (fslabel, name)) -+ -+ ks = imgcreate.read_kickstart(options.kscfg) -+ -+ creator = myLiveImageCreator(ks, name, -+ fslabel=fslabel, -+ releasever=options.releasever, -+ tmpdir=os.path.abspath(options.tmpdir)) -+ -+ creator.compress_type = options.compress_type -+ creator.skip_compression = options.skip_compression -+ creator.skip_minimize = options.skip_minimize -+ if options.cachedir: -+ options.cachedir = os.path.abspath(options.cachedir) -+ -+ try: -+ creator.mount(options.base_on, options.cachedir) -+ creator.install() -+ creator.configure() -+ if options.give_shell: -+ print "Launching shell. Exit to continue." -+ print "----------------------------------" -+ creator.launch_shell() -+ creator.unmount() -+ creator.package() -+ except imgcreate.CreatorError, e: -+ logging.error(u"Error creating Live CD : %s" % e) -+ return 1 -+ finally: -+ creator.cleanup() -+ -+ return 0 -+ -+if __name__ == "__main__": -+ sys.exit(main()) -diff --git a/test/TEST-16-DMSQUASH/cryptroot-ask b/test/TEST-16-DMSQUASH/cryptroot-ask -new file mode 100755 -index 0000000..db27c5b ---- /dev/null -+++ b/test/TEST-16-DMSQUASH/cryptroot-ask -@@ -0,0 +1,6 @@ -+#!/bin/sh -+ -+[ -b /dev/mapper/$2 ] && exit 0 -+echo -n test >/keyfile -+/sbin/cryptsetup luksOpen $1 $2 /dev/console 2>&1 -+echo "dracut-root-block-success" >/dev/sda -+export TERM=linux -+export PS1='initramfs-test:\w\$ ' -+[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab -+[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab -+stty sane -+echo "made it to the rootfs!" -+strstr "$CMDLINE" "rd.shell" && sh -i -+echo "Powering down." -+mount -n -o remount,ro / -+poweroff -f -diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh -new file mode 100755 -index 0000000..5d8075c ---- /dev/null -+++ b/test/TEST-16-DMSQUASH/test.sh -@@ -0,0 +1,66 @@ -+#!/bin/bash -+TEST_DESCRIPTION="root filesystem on a LiveCD dmsquash filesystem" -+ -+KVERSION=${KVERSION-$(uname -r)} -+ -+# Uncomment this to debug failures -+#DEBUGFAIL="rd.shell rd.break" -+ -+test_run() { -+ $testdir/run-qemu -boot order=d -cdrom livecd.iso -hda root.img -m 256M -nographic \ -+ -net none -kernel /boot/vmlinuz-$KVERSION \ -+ -append "root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ -+ -initrd initramfs.testing -+ grep -m 1 -q dracut-root-block-success root.img || return 1 -+} -+ -+test_setup() { -+ mkdir -p overlay -+ ( -+ initdir=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 -+ ) -+ -+ dd if=/dev/null of=root.img seek=100 -+ -+ sudo $basedir/dracut -l -i overlay / \ -+ -a "debug" \ -+ -d "piix ide-gd_mod ata_piix ext3 sd_mod" \ -+ -f initramfs.testing $KVERSION || return 1 -+ -+ mkdir -p root-source -+ kernel=$KVERSION -+ # Create what will eventually be our root filesystem onto an overlay -+ ( -+ initdir=root-source -+ . $basedir/dracut-functions -+ dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \ -+ /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient \ -+ umount strace less -+ inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script" -+ inst "$basedir/modules.d/40network/ifup" "/sbin/ifup" -+ dracut_install grep syslinux isohybrid -+ for f in /usr/share/syslinux/*; do -+ inst_simple "$f" -+ done -+ inst ./test-init /sbin/init -+ inst ./initramfs.testing "/boot/initramfs-$KVERSION.img" -+ inst /boot/vmlinuz-$KVERSION -+ find_binary plymouth >/dev/null && dracut_install plymouth -+ (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp ) -+ cp -a /etc/ld.so.conf* $initdir/etc -+ sudo ldconfig -r "$initdir" -+ ) -+ python create.py -d -c livecd-fedora-minimal.ks -+ exit 0 -+} -+ -+test_cleanup() { -+ rm -fr overlay root-source -+ rm -f root.img initramfs.makeroot initramfs.testing livecd.iso -+} -+ -+. $testdir/test-functions diff --git a/0005-dracut.spec-remove-unnecessary-dependencies.patch b/0005-dracut.spec-remove-unnecessary-dependencies.patch new file mode 100644 index 0000000..16e6783 --- /dev/null +++ b/0005-dracut.spec-remove-unnecessary-dependencies.patch @@ -0,0 +1,63 @@ +From 828feae4f1814a915b2f7f362a5920322e0d6fcc Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 9 Dec 2011 10:28:40 +0100 +Subject: [PATCH] dracut.spec: remove unnecessary dependencies + +Since the initramfs generation is done in %postrans of the kernel rpm, +we can drop all hard requirements. + +Also make some requirements a conflict to express the version +dependency. +--- + dracut.spec | 24 ++---------------------- + 1 files changed, 2 insertions(+), 22 deletions(-) + +diff --git a/dracut.spec b/dracut.spec +index 91b62ee..1c50f37 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -68,17 +68,15 @@ Requires: filesystem >= 2.1.0 + Requires: findutils + Requires: grep + Requires: gzip +-Requires: kbd + Requires: mktemp >= 1.5-5 + Requires: module-init-tools >= 3.7-9 + Requires: sed +-Requires: tar + Requires: udev + Requires: util-linux >= 2.20 + + %if 0%{?fedora} || 0%{?rhel} > 6 +-Requires: initscripts >= 8.63-1 +-Requires: plymouth >= 0.8.0-0.2009.29.09.19.1 ++Conflicts: initscripts < 8.63-1 ++Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1 + %endif + + %description +@@ -91,24 +89,6 @@ NFS, iSCSI, NBD, FCoE with the dracut-network package. + %package network + Summary: Dracut modules to build a dracut initramfs with network support + Requires: %{name} = %{version}-%{release} +-Requires: rpcbind +-%if %{with_nbd} +-Requires: nbd +-%endif +-Requires: iproute +-Requires: bridge-utils +- +-%if 0%{?fedora} || 0%{?rhel} > 6 +-Requires: iscsi-initiator-utils +-Requires: nfs-utils +-Requires: dhclient +-%endif +- +-%if 0%{?suse_version} +-Requires: dhcp-client +-Requires: nfs-client +-Requires: vlan +-%endif + Obsoletes: dracut-generic < 008 + Provides: dracut-generic = %{version}-%{release} + diff --git a/0006-TEST-12-RAID-DEG-mkdir-run.patch b/0006-TEST-12-RAID-DEG-mkdir-run.patch new file mode 100644 index 0000000..00dac18 --- /dev/null +++ b/0006-TEST-12-RAID-DEG-mkdir-run.patch @@ -0,0 +1,21 @@ +From 5112bfc8ccd01dee3ef97c6e6ce2e78d709e201f Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 15 Dec 2011 13:42:16 +0100 +Subject: [PATCH] TEST-12-RAID-DEG: mkdir /run + +--- + test/TEST-12-RAID-DEG/create-root.sh | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/test/TEST-12-RAID-DEG/create-root.sh b/test/TEST-12-RAID-DEG/create-root.sh +index 47eb961..7be4a32 100755 +--- a/test/TEST-12-RAID-DEG/create-root.sh ++++ b/test/TEST-12-RAID-DEG/create-root.sh +@@ -28,6 +28,7 @@ mke2fs -L root /dev/dracut/root && \ + mkdir -p /sysroot && \ + mount /dev/dracut/root /sysroot && \ + cp -a -t /sysroot /source/* && \ ++mkdir /sysroot/run && \ + umount /sysroot && \ + lvm lvchange -a n /dev/dracut/root && \ + cryptsetup luksClose /dev/mapper/dracut_crypt_test && \ diff --git a/0006-dracut-functions-s-emergency-shutdown-shutdown-emerg.patch b/0006-dracut-functions-s-emergency-shutdown-shutdown-emerg.patch deleted file mode 100644 index 9031e67..0000000 --- a/0006-dracut-functions-s-emergency-shutdown-shutdown-emerg.patch +++ /dev/null @@ -1,22 +0,0 @@ -From d670e21998f8b13c6b266e29bcc80db55d19f8c8 Mon Sep 17 00:00:00 2001 -From: Harald Hoyer -Date: Wed, 17 Aug 2011 17:40:59 +0200 -Subject: [PATCH] dracut-functions: s/emergency-shutdown/shutdown-emergency/g - ---- - dracut-functions | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/dracut-functions b/dracut-functions -index 936d3c3..241d89a 100755 ---- a/dracut-functions -+++ b/dracut-functions -@@ -518,7 +518,7 @@ inst() { - - [[ $hookdirs ]] || { - hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount" -- hookdirs+=" pre-pivot mount emergency emergency-shutdown shutdown" -+ hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown" - export hookdirs - } - diff --git a/0007-99base-dracut-lib.sh-added-inst_mount_hook-add_mount.patch b/0007-99base-dracut-lib.sh-added-inst_mount_hook-add_mount.patch new file mode 100644 index 0000000..439ee69 --- /dev/null +++ b/0007-99base-dracut-lib.sh-added-inst_mount_hook-add_mount.patch @@ -0,0 +1,127 @@ +From bb61d657c1ff11c4339a777e1fcf57173783bf7d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 15 Dec 2011 14:37:34 +0100 +Subject: [PATCH] 99base/dracut-lib.sh: added inst_mount_hook add_mount_point + +inst_mount_hook