summaryrefslogtreecommitdiffstats
path: root/pki/dogtag/meta/build_dogtag
blob: 1bbaf1c61bba7a613ce7aa23f4451cebc72bc0fe (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
#!/bin/bash
# BEGIN COPYRIGHT BLOCK
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# (C) 2010 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK

# Always switch into the base directory of this
# shell script prior to executing it so that all
# of its output is written to this directory
cd `dirname $0`

# Retrieve the directory name housing this component
PWD=`pwd`

# Establish release root for 'meta' packages
RELEASE_ROOT="${PWD}/../../../release/pki/meta"

# Specify 'meta' functions
clean_release_root()
{
	printf "Removing 'meta' release root . . . "
	rm -rf ${RELEASE_ROOT}
	printf "done.\n"
}

create_RPM_build_directories()
{
	printf "Creating 'meta' RPM build directories . . . "
	mkdir -p ${RELEASE_ROOT}
	mkdir -p ${RELEASE_ROOT}/BUILD
	mkdir -p ${RELEASE_ROOT}/BUILDROOT
	mkdir -p ${RELEASE_ROOT}/RPMS
	mkdir -p ${RELEASE_ROOT}/SOURCES
	mkdir -p ${RELEASE_ROOT}/SPECS
	mkdir -p ${RELEASE_ROOT}/SRPMS
	printf "done.\n"
}

build_specified_meta_package()
{
	package=$1
	spec_file="${package}.spec"

	printf "BEGIN: Building 'meta' package called '${package}' . . .\n"
	cp ${spec_file} ${RELEASE_ROOT}/SPECS
	rpmbuild --define "_topdir ${RELEASE_ROOT}" -ba --clean ${RELEASE_ROOT}/SPECS/${spec_file}
	printf "END:   Building 'meta' package called ${package}'.\n"
}

destroy_RPM_build_directories()
{
	printf "Destroying 'meta' RPM build directories . . . "
	rm -rf ${RELEASE_ROOT}/BUILD
	rm -rf ${RELEASE_ROOT}/BUILDROOT
	rm -rf ${RELEASE_ROOT}/SOURCES
	rm -rf ${RELEASE_ROOT}/SPECS
	printf "done.\n"
}

# Build the 'meta' package called 'dogtag-pki'
clean_release_root
create_RPM_build_directories
build_specified_meta_package dogtag-pki
destroy_RPM_build_directories