From: Harald Hoyer Date: Fri, 18 Sep 2009 09:40:12 +0000 (+0200) Subject: md/dm/lvm: install pre-pivot cleanup hooks only if actually needed X-Git-Tag: 003~170 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a34efa5c4a4943ff5622cda8963af8443c54159;p=thirdparty%2Fdracut.git md/dm/lvm: install pre-pivot cleanup hooks only if actually needed - removed dmraid cleanup - only call lvm cleanup, if no lvm.conf provided - copy over lvm.conf by default - add --nolvmconf --lvmconf parameters --- diff --git a/dracut b/dracut index b96ad5e0f..a74a3d321 100755 --- a/dracut +++ b/dracut @@ -47,6 +47,8 @@ Creates initial ramdisk images for preloading modules --nostrip Do not strip binaries in the initramfs --mdadmconf Include local /etc/mdadm.conf --nomdadmconf Do not include local /etc/mdadm.conf + --lvmconf Include local /etc/lvm/lvm.conf + --nolvmconf Do not include local /etc/lvm/lvm.conf -h, --help This message --debug Output debug information of the build process -v, --verbose Verbose output during the build process @@ -82,6 +84,8 @@ while (($# > 0)); do --nostrip) do_strip_l="no";; --mdadmconf) mdadmconf_l="yes";; --nomdadmconf) mdadmconf_l="no";; + --lvmconf) lvmconf_l="yes";; + --nolvmconf) lvmconf_l="no";; -h|--help) usage; exit 1 ;; --debug) debug="yes";; -v|--verbose) beverbose="yes";; @@ -121,6 +125,7 @@ export PATH [[ $do_strip_l ]] && do_strip=$do_strip_l [[ $hostonly_l ]] && hostonly=$hostonly_l [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l +[[ $lvmconf_l ]] && lvmconf=$lvmconf_l [[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut [[ $fw_dir ]] || fw_dir=/lib/firmware [[ $do_strip ]] || do_strip=yes @@ -169,7 +174,7 @@ chmod 755 "$initdir" export initdir hookdirs dsrc dracutmodules drivers \ fw_dir drivers_dir debug beverbose no_kernel kernel_only \ - add_drivers mdadmconf + add_drivers mdadmconf lvmconf if [[ $kernel_only != yes ]]; then # Create some directory structure first diff --git a/dracut.conf b/dracut.conf index ded377677..2ebeeda98 100644 --- a/dracut.conf +++ b/dracut.conf @@ -15,3 +15,6 @@ # install local /etc/mdadm.conf mdadmconf="yes" + +# install local /etc/lvm/lvm.conf +lvmconf="yes" diff --git a/dracut.spec b/dracut.spec index f53779852..52e0d3d7a 100644 --- a/dracut.spec +++ b/dracut.spec @@ -13,7 +13,7 @@ Name: dracut Version: 002 -Release: 1%{?rdist} +Release: 2%{?rdist} Summary: Initramfs generator using udev Group: System Environment/Base License: GPLv2+ @@ -180,6 +180,10 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut/overlay %changelog +* Fri Sep 18 2009 Harald Hoyer 002-2 +- do not cleanup dmraids +- copy over lvm.conf + * Thu Sep 17 2009 Harald Hoyer 002-1 - version 002 - set correct PATH diff --git a/modules.d/90dmraid/dmraid-cleanup.sh b/modules.d/90dmraid/dmraid-cleanup.sh deleted file mode 100755 index 458cae9f9..000000000 --- a/modules.d/90dmraid/dmraid-cleanup.sh +++ /dev/null @@ -1,2 +0,0 @@ -# close everything which is not busy -dmraid -an >/dev/null 2>&1 diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh index de6663483..4e47e2d86 100755 --- a/modules.d/90dmraid/dmraid.sh +++ b/modules.d/90dmraid/dmraid.sh @@ -4,6 +4,8 @@ DM_RAIDS=$(getargs rd_DM_UUID=) +DM_CLEANUP="no" + # run dmraid if udev has settled info "Scanning for dmraid devices $DM_RAIDS" SETS=$(dmraid -c -s) @@ -35,3 +37,4 @@ else [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo done fi + diff --git a/modules.d/90dmraid/install b/modules.d/90dmraid/install index 816512e03..bb9dc5a5f 100755 --- a/modules.d/90dmraid/install +++ b/modules.d/90dmraid/install @@ -7,7 +7,6 @@ if [ ! -x /lib/udev/vol_id ]; then fi inst_rules "$moddir/61-dmraid-imsm.rules" -inst_hook pre-pivot 30 "$moddir/dmraid-cleanup.sh" -inst_hook pre-pivot 31 "$moddir/dmraid-cleanup.sh" +inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup inst_hook pre-trigger 30 "$moddir/parse-dm.sh" diff --git a/modules.d/90lvm/install b/modules.d/90lvm/install index c0952e261..fe5492f50 100755 --- a/modules.d/90lvm/install +++ b/modules.d/90lvm/install @@ -3,11 +3,10 @@ inst lvm inst_rules "$moddir/64-lvm.rules" 64-lvm.rules -if [[ $hostonly ]]; then +if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then [ -f /etc/lvm/lvm.conf ] && inst /etc/lvm/lvm.conf fi inst "$moddir/lvm_scan.sh" /sbin/lvm_scan inst_hook cmdline 30 "$moddir/parse-lvm.sh" -inst_hook pre-pivot 30 "$moddir/lvm-cleanup.sh" -inst_hook pre-pivot 31 "$moddir/lvm-cleanup.sh" \ No newline at end of file +inst "$moddir/lvm-cleanup.sh" /sbin/lvm-cleanup diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh index f606055ca..fd21ed79b 100755 --- a/modules.d/90lvm/lvm_scan.sh +++ b/modules.d/90lvm/lvm_scan.sh @@ -31,5 +31,9 @@ fi info "Scanning devices $lvmdevs for LVM volume groups $VGS" lvm vgscan 2>&1 | vinfo lvm vgchange -ay $VGS 2>&1 | vinfo -[ "$lvmwritten" ] && rm -f /etc/lvm/lvm.conf +if [ "$lvmwritten" ]; then + rm -f /etc/lvm/lvm.conf + ln -s /sbin/lvm-cleanup /pre-pivot/30-lvm-cleanup.sh 2>/dev/null + ln -s /sbin/lvm-cleanup /pre-pivot/31-lvm-cleanup.sh 2>/dev/null +fi unset lvmwritten diff --git a/modules.d/90mdraid/install b/modules.d/90mdraid/install index 69032ef77..059edfbd5 100755 --- a/modules.d/90mdraid/install +++ b/modules.d/90mdraid/install @@ -36,5 +36,4 @@ inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto inst "$moddir/md_finished.sh" /sbin/md_finished.sh inst_hook pre-trigger 30 "$moddir/parse-md.sh" -inst_hook pre-pivot 30 "$moddir/mdraid-cleanup.sh" -inst_hook pre-pivot 31 "$moddir/mdraid-cleanup.sh" +inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup diff --git a/modules.d/90mdraid/mdadm_auto.sh b/modules.d/90mdraid/mdadm_auto.sh index a971a5a17..384176586 100755 --- a/modules.d/90mdraid/mdadm_auto.sh +++ b/modules.d/90mdraid/mdadm_auto.sh @@ -3,3 +3,5 @@ info "Autoassembling MD Raid" /sbin/mdadm -As --auto=yes --run 2>&1 | vinfo +ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null +ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null diff --git a/modules.d/90mdraid/mdcontainer_start.sh b/modules.d/90mdraid/mdcontainer_start.sh index f08647d00..46340a2f0 100755 --- a/modules.d/90mdraid/mdcontainer_start.sh +++ b/modules.d/90mdraid/mdcontainer_start.sh @@ -5,4 +5,6 @@ md=$1 udevadm control --stop-exec-queue # and activate any containers mdadm -IR $md 2>&1 | vinfo +ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null +ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null udevadm control --start-exec-queue diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh index ab4598624..1701b6cb9 100755 --- a/modules.d/90mdraid/mdraid_start.sh +++ b/modules.d/90mdraid/mdraid_start.sh @@ -5,4 +5,6 @@ info "Assembling MD RAID arrays" udevadm control --stop-exec-queue mdadm -IRs 2>&1 | vinfo +ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null +ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null udevadm control --start-exec-queue