• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# Builds ipmitool
4
5# Copyright (C) 2003-2006 IBM
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 2 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20# 02111-1307, USA.
21
22source "$POUNDER_HOME/libpounder.sh"
23
24#TODO: Move to config file variables
25Req_Maj=1
26Req_Min=8
27Req_Pat=7
28
29TESTCURRENTIPMI=1 #TODO: 0
30
31PKGNAME=ipmitool-1.8.9
32#end of stuff to move
33TARNAME="$PKGNAME.tar.gz"
34PROGNAME=ipmitool
35if [ $TESTCURRENTIPMI -ne 0 ]; then
36
37	# Is it already installed?
38	PROG=`which $PROGNAME`
39	if [ ! -z "$PROG" ]; then
40		Maj_ver=`ipmitool -V | cut -b 18- | awk -F "." '{print $1}'`
41		Min_ver=`ipmitool -V | cut -b 18- | awk -F "." '{print $2}'`
42		Pat_ver=`ipmitool -V | cut -b 18- | awk -F "." '{print $3}'`
43		if [ $Maj_ver -gt $Req_Maj ]; then
44			exit 0;
45		elif [[ $Maj_ver -eq $Req_Maj && $Min_ver -gt $Req_Min ]]; then
46			exit 0;
47		elif [[ $Maj_ver -eq $Req_Maj && $Min_ver -eq $Req_Min && $Pat_ver -ge $Req_Pat ]]; then
48			exit 0;
49		fi
50	fi
51
52	# Retrieve binary, if necessary
53	cd "$POUNDER_OPTDIR"
54	if [ ! -f "$TARNAME" ]; then
55		if [ $USE_CACHE -eq 1 ]; then
56			wget "${POUNDER_CACHE}${TARNAME}"
57		fi
58		if [ ! -f "$TARNAME" ]; then
59			get_from_sourceforge $PROGNAME $TARNAME
60		fi
61		#TODO: what if no target found?
62	fi
63
64	# Unpack if req'd
65	if [ ! -d "$PKGNAME" ]; then
66		tar -xzf "$TARNAME"
67	fi
68
69	# Build
70	cd "$PKGNAME"
71	./configure
72	make $*
73fi
74