rpms/kexec-tools/devel manifest,NONE,1.1 mkdumprd2,1.4,1.5

Neil Horman nhorman at fedoraproject.org
Tue May 19 20:08:48 UTC 2009


Author: nhorman

Update of /cvs/extras/rpms/kexec-tools/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11885

Modified Files:
	mkdumprd2 
Added Files:
	manifest 
Log Message:
Adding default manifest and some mkdumprd2 bug fixes


--- NEW FILE manifest ---
######################################################
# Generic kdump initramfs manifest
# 1) Loads all modules
# 2) Starts all mdraid, lvm partitions
# 3) Mounts the rootfs
# 4) Copies /proc/vmcore to /mnt/var/crash/<date>/vmcore
#
# Notes on syntax:
# There are 6 major commands to use when generating manifest files
# They are:
# 1) reg
#    reg <source file> <dest path>
#    A regular file copy from the source to the dst directory
# 2) creg
#    creg <source file> <dest path>
#    like reg, but only copy if the source file exists
#
# 3) ren
#    ren <src file> <dst file>
#    rename a file into the initramfs
#
# 4) cren
#    cren <src file> <dst file>
#    like creg, but rename the dst file
#
# 5) gen
#    gen <binary> <dst file> <options>
#    execute the specified binary, redirecting stdout to <dst>
#
# 6) exec
#    exec <binary> <options>
#    execute the specified binary.  Option 1 is the 
#    base dir where the initramfs is being built
#    $1/temp is temp file space, $1/stage is the initramfs
#    options passed on command line after that
#####################################################

####################################################
#This script populates the initramfs with:
# busybox
# kpartx
# lvm
# dmsetup
# It also symlinks all the supported apps in busybox to
# busybox
#################################################### 
exec	populate_kdump_std_files

####################################################
# This is a rudimentary module population script
# It looks at the currently loaded modules, copies them
# To the initramfs, and generates /etc/module_load_list
# which is a dependency ordered list of those modules
# which can be used at runtime for module loading
###################################################
exec	generate_module_list

###################################################
# Lets get all our lvm and mdraid configs on board
###################################################
creg	/etc/lvm/lvm.conf /etc/lvm
creg	/etc/mdadm.conf /etc

###################################################
# Grab fstab, modifying it to mount under /mnt
###################################################
gen	awk	/etc/fstab	'/^[^#]/{print $1 " /mnt"$2 " "$3 " "$4 " "$5 " "$6}' /etc/fstab

###################################################
# Grab the standard initscript to capture to the local
# rootfs
###################################################
ren	/usr/share/kexec-tools/kdumpinit.rootfs	/init


Index: mkdumprd2
===================================================================
RCS file: /cvs/extras/rpms/kexec-tools/devel/mkdumprd2,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- mkdumprd2	18 May 2009 01:16:40 -0000	1.4
+++ mkdumprd2	19 May 2009 20:08:18 -0000	1.5
@@ -1,5 +1,4 @@
 #!/bin/sh
-
 ##########################################################
 #File: mkdumprd2
 #Author: Neil Horman <nhorman at redhat.com>
@@ -168,6 +167,10 @@ validate_manifest_line()
 {
 
 	case "$1" in
+	creg|cren)
+		# Just like reg/ren, but check nothing
+		# we don't copy anything if its not there
+		;;
 	reg|ren)
 		# Regular file, make sure that the file exists
 		if [ ! -f $2 ]
@@ -195,12 +198,18 @@ validate_manifest_line()
 		fi
 		;;
 	*)
-		echo $1 | grep -q "^#"
+		echo $1 | grep -q "^#.*$"
 		if [ $? -eq 0 ]
 		then
 			# its a comment
 			continue
 		fi
+		echo $1 | grep -q "^ *$"
+		if [ $? -eq 0 ]
+		then
+			# Blank line
+			continue
+		fi
 		# Unknown manifest type, fail
 		return 1
 		;;
@@ -235,6 +244,20 @@ populate_from_manifest()
 		fi
 
 		case "$type" in
+		creg|cren)
+			# Conditional regular copy/rename
+			if [ -f $sarg ]
+			then
+				if [ "$type" == "creg" ]
+				then
+					ddir=$STAGE_DIR/$dpath
+				else
+					ddir=$(dirname $STAGE_DIR/$dpath)
+				fi
+				mkdir -p $ddir
+				cp $sarg $STAGE_DIR/$dpath	
+			fi
+			;;
 		reg|ren)
 			# Just do a raw copy from the source path
 			# to the dest path
@@ -253,7 +276,7 @@ populate_from_manifest()
 			# to stdout
 			ddir=$(dirname $STAGE_DIR/$dpath)
 			mkdir -p $ddir
-			$sarg $opts > $STAGE_DIR/$dpath
+			/bin/sh -c "$sarg $opts > $STAGE_DIR/$dpath"
 			if [ $? != 0 ]
 			then
 				cleanup_and_exit 1 "$sarg: Non-zero exit"




More information about the scm-commits mailing list