Linux LVM users
 help / color / mirror / Atom feed
From: Paul Smith <paul@mad-scientist.us>
To: linux-lvm@redhat.com
Subject: [linux-lvm] Please remove bash from lvm2
Date: Tue, 12 Aug 2008 00:30:21 -0400	[thread overview]
Message-ID: <1218515421.8242.164.camel@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

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!

[-- Attachment #2: no-bash.patch --]
[-- Type: text/x-patch, Size: 1630 bytes --]

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"

                 reply	other threads:[~2008-08-12  4:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218515421.8242.164.camel@localhost \
    --to=paul@mad-scientist.us \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox