[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[linux-lvm] Please remove bash from lvm2



I've been trying to pack a bunch of tools onto an embedded systems and
it's very frustrating how man of them have requirements on bash, for no
real reason.  Just a bit more care could easily take care of this
problem.  I definitely don't want to be forced to include bash, instead
of using busybox sh for example, only because of a few scripts that
could just as easily be written in standard sh.

Here's a patch that removes bash requirements from lvm_dump.  The init
scripts I looked at can be fixed by just changing #!/bin/bash to
#!/bin/sh.

Cheers!
diff -ubB -r LVM2.2.02.25-orig/scripts/lvm_dump.sh LVM2.2.02.25/scripts/lvm_dump.sh
--- LVM2.2.02.25-orig/scripts/lvm_dump.sh	2007-04-25 10:49:27.000000000 -0400
+++ LVM2.2.02.25/scripts/lvm_dump.sh	2008-08-11 23:09:21.000000000 -0400
@@ -1,5 +1,4 @@
-#!/bin/bash
-# we use some bash-isms (getopts?)
+#!/bin/sh
 
 # lvm_dump: This script is used to collect pertinent information for
 #           the debugging of lvm issues.
@@ -50,17 +49,17 @@
 	exit 1
 }
 
-advanced=0
-clustered=0
-metadata=0
+advanced=false
+clustered=false
+metadata=false
 while getopts :acd:hm opt; do
 	case $opt in 
-		s)      sysreport=1 ;;
-		a)	advanced=1 ;;
-		c)	clustered=1 ;;
+		s)      sysreport=true ;;
+		a)	advanced=true ;;
+		c)	clustered=true ;;
 		d)	userdir=$OPTARG ;;
 		h)	usage ;;
-		m)	metadata=1 ;;
+		m)	metadata=true ;;
 		:)	echo "$0: $OPTARG requires a value:"; usage ;;
 		\?)     echo "$0: unknown option $OPTARG"; usage ;;
 		*)	usage ;;
@@ -94,7 +93,7 @@
 myecho "Creating dump directory: $dir"
 echo " "
 
-if (( $advanced )); then
+if $advanced; then
 	myecho "Gathering LVM volume info..."
 
 	myecho "  vgscan..."
@@ -113,7 +112,7 @@
 	log "$LVM vgs -v > $dir/vgs 2>> $log"
 fi
 
-if (( $clustered )); then
+if $clustered; then
 	myecho "Gathering cluster info..."
 	echo "STATUS: " > $dir/cluster_info
 	echo "----------------------------------" >> $dir/cluster_info
@@ -152,7 +151,7 @@
 myecho "Gathering /sys/block listing..."
 log "$LS -laR /sys/block > $dir/sysblock_listing"
 
-if (( $metadata )); then
+if $metadata; then
 	myecho "Gathering LVM metadata from Physical Volumes..."
 
 	log "$MKDIR -p $dir/metadata"

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]