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

Re: lvm-version -- beginning of wrapper (was: Re: lvm - I'll maintain it. - ITP lvm24)



On 2000-12-14 18:14, Arthur Korn wrote:
>lewis@sistina.com schrieb:
>> I can almost guarantee that the protocol will change during the 2.4.*
>> kernels. And I can also tell you that there is a backpatch for the 2.2.x
>> kernels.  LVM 0.8.1 and LVM 0.9 work with both 2.2.x and 2.4.x.
>
>Regardless of this it should be possible to have multiple
>versions of the lvm tools installed at once, and it should Just
>Work (TM).
>
>Probably we should come up with a lvm-common package that
>contains a wrapper. I tried to script a LVM version detector,
>but don't have any other versions than 0.8i around, thus I'd
>appreciate if others could verify that this works:
>
>------ lvm-version
>#! /bin/sh
>
>set -e
>
># figure out the version of LVM in the kernel.

This is bad.  Proc shouldn't be mounted if it isn't there.  If you run "ps" 
or "top" as root when /proc isn't mounted they don't try to mount it!  The 
principle of least surprise should be used here.

># mount proc in case it is not yet there
>if [ ! -f /proc/uptime ]; then
>        [ -d /proc || mkdir /proc
>        mount -t proc none /proc
>fi
>
># check for lvm support
>if [ ! -f /proc/lvm ]; then
    modprobe lvm-mod
    if [ ! -f /proc/lvm ]; then
>        echo 'No lvm support in kernel.'
>        exit 1
    fi
>fi


>
># extract version number.
>head -1 /proc/lvm |tr ' ' "\n"|grep '[0-9]\.[0-9]'
>
>-----------
>
>Around this it should be fairly easy to write a wrapper.

I will consider this.

-- 
http://www.coker.com.au/bonnie++/     Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/       Postal SMTP/POP benchmark
http://www.coker.com.au/projects.html Projects I am working on
http://www.coker.com.au/~russell/     My home page



Reply to: