summaryrefslogtreecommitdiff
path: root/hpiutil/mkrpm
blob: e64f99539de9c6548e0b73acbfdbcfb2ce4065ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# mkrpm
#    Make the rpms for hpiutil
#
# Reliab11 = RedHat 8.0    (rh80)
# Reliab12 = RedHat 9.0    (rh90)
# Reliab13 = MV CGE 2.1    (mv21)
# Reliab14 = MV CGE 3.0    (mv30p3)
# Reliab01 = MV CGE 3.1    (mv31p3)
# Reliab03 = RedHat AS 2.1 (as21)
# chapin4  = MV CGE 3.1    (mv31p4)
# grumpy   = RedHat EL 3   (el3)
# chesnee1 = RedHat EL 3   (el3)
# telcoraid= SuSE UL 1.0   (ul10)
#
ROOT=`pwd`
# usually /mnt/pub/panich/hpi/hpiutil
RTARG=rpm
RSPEC=hpiutil.spec
RTO=$ROOT/$RTARG/usr/bin
STO=$ROOT/$RTARG/usr/share/hpiutil
ETO=$ROOT/$RTARG/etc/hpi
OS=el3
VER=`grep "^%define Version" $RSPEC |cut -f3 -d' '`
tmpe=/tmp/ed.tmp
rpmcmd=rpmbuild

if [ $# -ge 1 ]
then
  OS=$1
fi
case $OS in
"mv21")
	archv=x86_pentium3
	;;
"mv30")
	archv=x86_pentium3
	;;
"mv30wv")
	archv=x86_pentium4
	;;
"mv31p4")
	archv=x86_pentium4
	;;
"mv31p3")
	archv=x86_pentium3
	;;
"ul10")
	rpmcmd=rpm
	archv=i386
	;;
*)
	archv=i386
	;;
esac

# Modify the env for EL3 & others 
if [ "$OS" = "el3" ]
then
   cmt=
else
   cmt="#"
fi
cat - <<%%% >$tmpe
1
/LD_ASSUME_KERNEL
c
$cmt        export LD_ASSUME_KERNEL=2.4.1
.
w
q
%%%
ed hpiinit.sh <$tmpe
ed env.hpi    <$tmpe
ed obj/env.hpi <$tmpe

echo "Copying lib files to rpm, OS=$OS ..."
mkdir -p $RTO
mkdir -p $ROOT/$RTARG/usr/lib
cp -uf $ROOT/obj/${OS}/SpiLibd   $RTO
cp -uf $ROOT/obj/${OS}/*.so      $ROOT/$RTARG/usr/lib
cp -uf $ROOT/obj/${OS}/*.so-open $ROOT/$RTARG/usr/lib

# Make the matching hpiutil binaries
cd $ROOT
make clean
make
echo "Copying files for rpm, OS=$OS ..."
mkdir -p $ETO
mkdir -p $ROOT/$RTARG/etc/init.d
mkdir -p $STO
cp -uf $ROOT/hpialarmpanel $RTO
cp -uf $ROOT/hpisensor  $RTO
cp -uf $ROOT/hpisel     $RTO
cp -uf $ROOT/hpifru     $RTO
cp -uf $ROOT/hpiwdt     $RTO
cp -uf $ROOT/hpireset   $RTO
cp -uf $ROOT/hpiinit.sh $ETO
cp -uf $ROOT/README         $STO
cp -uf $ROOT/COPYING        $STO
cp -uf $ROOT/obj/env.hpi    $STO
cp -uf $ROOT/obj/spi-daemon.conf $ETO
cp -uf $ROOT/obj/spi-lib.conf    $ETO


# (new:)
# libSaHpi.so          libSpiIpmiImb.so     libSpiModIpmi.so   SpiLibd
# libSpiDaemonCore.so  libSpiModGeneric.so  libSpiTsdMaplx.so
# (old:)
# libSaHpi.so libSpiDaemonCore.so libSpiGenericMaplx.so libSpiModGeneric.so
# libSpiModIpmi.so libSpiModMullins.so libSpiMullinsMaplx.so
# libSpiIpmiImb.so libSpiIpmiOpenIpmi.so

echo "Making hpiutil rpm ..."
#rpmbuild -bb $RSPEC
#HOME=`pwd`
#export HOME
rm -f $ROOT/$RTARG/$archv/hpiutil*.rpm
echo "%_rpmdir  ${ROOT}/${RTARG}" > $HOME/.rpmmacros
$rpmcmd -bb --buildroot ${ROOT}/${RTARG} $RSPEC
rm -f $HOME/.rpmmacros

# save the rpm
rfil=$ROOT/$RTARG/$archv/hpiutil-$VER-?.$archv.rpm
echo $OS |grep mv31p4 >/dev/null 2>&1
if [ $? -eq 0 ]
then
  rfil=/usr/src/montavista/RPMS/$archv/hpiutil-$VER-?.$archv.rpm
fi
cp $rfil $ROOT/obj/hpiutil-$VER-$OS.$archv.rpm 
if [ $? -eq 0 ]
then
  # remove the directory
  rm -rf $ROOT/$RTARG
fi