[linux-lvm] IOP selection scripts (was: '/etc/init.d/lvm' script in debian package)

Andreas Dilger adilger at turbolinux.com
Thu Dec 21 00:34:43 UTC 2000


Claudio writes:
> if [ "$util" = "lvm-wrapper" ]; then
>     echo "$util: you don't want to call the wrapper directly" 1>&2
>     exit -2
           ^^ I don't think this is legal...
> fi

Is there ever a reason why you would want to install this program as
"lvm-wrapper" anywhere?

> if [ -f $proclvm ]; then
>     IOP=`grep "$ver_str" $proclvm|sed "s/.*$ver_str\([0-9]*\).*/\1/"`
> elif [ -d $proclvm ]; then
>     IOP=`grep "$ver_str" $proclvm/global|sed "s/.*$ver_str\([0-9]*\).*/\1/"`
> else
>     echo "$util: $proclvm not found (can't determine IOP version)" 1>&2
>     exit -1
> fi
> 
> exec /lib/lvm-iop${IOP}/$util $*

Probably some simple checks for the existence of /lib/lvm-iop$iop and
/lib/lvm-iop$iop/$util and printing a nice message would be helpful, like:

LIBLVM=/lib/lvm-iop${IOP}
LVMPKG=lvm-iop${IOP}

if [ ! -d $LIBLVM ]; then
	echo "$util: $LIBLVM not found.  Is $LVMPKG installed?" 1>&2
	exit 3
fi
exec $LIBLVM/$util "$@"	# this will print out a localized error message for us


I think I will go with an approach like this as well, since it still keeps
/sbin/<lvmcommand> in place (for scripts that have this hard-coded).

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert



More information about the linux-lvm mailing list