summaryrefslogtreecommitdiff
path: root/utils/buildrpm
blob: 3a9ab86f5371d530c9af57e91ec14a1f06ba7267 (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
#!/bin/bash

source=.
version=`cat $source/../version`
package=$source/../alsa-utils-$version.tar.bz2
packagedir=/usr/src/redhat
xrpmbuild=rpm
rpmbuild --usage 2> /dev/null > /dev/null && xrpmbuild=rpmbuild

# SuSE path
if [ -d /usr/src/packages ]; then
  packagedir=/usr/src/packages
fi

make -C .. clean
make -C .. dist

if [ ! -r $package ]; then
  echo "Error: wrong package: $package"
  exit 1
fi

cp -fv $package ${packagedir}/SOURCES

if [ ! -r $source/buildrpm ]; then
  echo "Error: invalid directory: $source"
  exit 1
fi

if [ ! -d ${packagedir} ]; then
  echo "Error: ${packagedir} directory not found"
  exit 1
fi

if [ ! -r $source/alsadriver.spec ]; then
  cd $source/..
  ./configure
  cd utils
fi

cp -fv $source/alsa-utils.spec ${packagedir}/SPECS
cd ${packagedir}/SPECS
$xrpmbuild -ba alsa-utils.spec
cd ${packagedir}