]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
md/dm/lvm: install pre-pivot cleanup hooks only if actually needed
authorHarald Hoyer <harald@redhat.com>
Fri, 18 Sep 2009 09:40:12 +0000 (11:40 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 18 Sep 2009 10:20:21 +0000 (12:20 +0200)
- removed dmraid cleanup
- only call lvm cleanup, if no lvm.conf provided
- copy over lvm.conf by default
- add --nolvmconf --lvmconf parameters

12 files changed:
dracut
dracut.conf
dracut.spec
modules.d/90dmraid/dmraid-cleanup.sh [deleted file]
modules.d/90dmraid/dmraid.sh
modules.d/90dmraid/install
modules.d/90lvm/install
modules.d/90lvm/lvm_scan.sh
modules.d/90mdraid/install
modules.d/90mdraid/mdadm_auto.sh
modules.d/90mdraid/mdcontainer_start.sh
modules.d/90mdraid/mdraid_start.sh

diff --git a/dracut b/dracut
index b96ad5e0f078164422fcf6a1f41d887623c18e99..a74a3d321bd7ae0cff3b90819f23ad35182657ed 100755 (executable)
--- 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
index ded37767719f1d5f4b382b80168d6e78b9004d67..2ebeeda9847cbd9432a0d161b096c8521e3eadfc 100644 (file)
@@ -15,3 +15,6 @@
 
 # install local /etc/mdadm.conf
 mdadmconf="yes"
+
+# install local /etc/lvm/lvm.conf
+lvmconf="yes"
index f53779852c8c2ac56642693faf5cd5e19fcfcadf..52e0d3d7ad426bf539c7b173f26d021cf94caaf3 100644 (file)
@@ -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 <harald@redhat.com> 002-2
+- do not cleanup dmraids
+- copy over lvm.conf
+
 * Thu Sep 17 2009 Harald Hoyer <harald@redhat.com> 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 (executable)
index 458cae9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# close everything which is not busy
-dmraid -an >/dev/null 2>&1
index de66634834863ffd67f8c9991f436e1611c2e33e..4e47e2d86b2c45af5980e24227d6fdb772ee604b 100755 (executable)
@@ -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
+
index 816512e034226d36ccd0727fd12d9cf2e8d1f4a3..bb9dc5a5f5c3b006db441b3bdc519ae74050a007 100755 (executable)
@@ -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"
 
index c0952e26119e35140487098ec922b85a8ee5a009..fe5492f506c9ba99afa21a6b8887a6af352b57b2 100755 (executable)
@@ -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
index f606055ca08c425c8d95f655083abfbb19a86807..fd21ed79b7dd1459927936ee08957b48a55da1db 100755 (executable)
@@ -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
index 69032ef7712ff778b41e7ad79c7b388ae095909f..059edfbd5beae8345b7c3dac9349c5ab383221d6 100755 (executable)
@@ -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
index a971a5a1797110bd4987e5e52f9797f5490e733c..3841765868ac90df3498174e8e19541d3410d3a9 100755 (executable)
@@ -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
index f08647d003493808ec406b773dcaa0446c1b5517..46340a2f0e9fad680595463af7c205f7085090ae 100755 (executable)
@@ -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
index ab459862463e0560c45cc9233a79f094d0a21879..1701b6cb903842b2a3e38d76419195c31512a601 100755 (executable)
@@ -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