#!/bin/bash ################################################################################ ## ## Copyright 2002 Sistina Software, Inc. ## ## This is free software released under the GNU General Public License. ## There is no warranty for this software. See the file COPYING for ## details. ## ## See the file CONTRIBUTORS for a list of contributors. ## ## This file is maintained by: ## Heinz Mauelshagen ## ## File name: libver ## ## Description: outputs the library version of lvm in the src directory ## specified to stdout ## ################################################################################ # help message usage() { echo "usage: $0 [OPTIONS]"; echo -e "\t-d\tLVM src directory"; echo -e "\t-h\tDisplay this help message"; exit 0; } while getopts "d:h" option ; do case $option in d) lvm_src=${OPTARG};; *) usage; exit;; esac done if [ -z "${lvm_src}" ]; then lvm_src="."; fi file1="${lvm_src}/tools/lib/liblvm.h"; ver1=`sed -e '/#define[[:space:]]*LVM_LIB_VERSION/!d;s!^.*LVM_LIB_VERSION[[:space:]]*\([^[:space:]]*\).*$!\1!' $file1` if [ -z "$ver1" ]; then echo "Error: $cmd can't determine the library version from $file1" > \ /dev/stderr; exit -1; fi echo "$ver1"