summaryrefslogtreecommitdiffstats
path: root/validator/rpm/buildasroot.sh
blob: 94076c26f75c5adea910dcbc9249fe6f9177d3b6 (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
#! /usr/bin/env bash
# Builds the pharosvalidator package as root (it must be built as root)
# then copies the finished package to /tmp. The script can either be called
# as root or with sudo

tarball=pharos-validator-1.tar.gz
specfile=pharosvalidator.spec
arch=x86_64

if [ "$(id -u)" != 0 ]; then
	echo "This script must be run as root (or with sudo)"
	exit 1
fi;

rpmdev-setuptree

cp "$specfile" ~/rpmbuild/SPECS/

# Prepare the "source package" for the rpm build process using .spec file
pushd ../../
tar -cvf "$tarball" pharos-validator
cp "$tarball" ~/rpmbuild/SOURCES
popd


cd ~/rpmbuild/

rpmlint SPECS/"$specfile"
printf "\n\nRPM BUILD PROCESS\n\n"
rpmbuild -ba SPECS/"$specfile"

cp -rfv RPMS/"$arch"/* /tmp/