-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpdb.spec
72 lines (58 loc) · 1.93 KB
/
gpdb.spec
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
#
# RPM spec file for GPDB
#
%define name apache-greenplum-db
%define gpdbname apache-greenplum-db
%define version %{gpdb_ver}
%define release %{gpdb_rel}
%define arch x86_64
%define prefix /usr/local
%define installdir /usr/local/%{name}-%{version}-%{release}
%define symlink /usr/local/%{name}
%define gpdbtarball %{gpdbname}-%{version}-%{release}-%{arch}.tar.gz
%define __os_install_post %{___build_post}
Requires(pre): shadow-utils
Summary: Apache Greenplum DB
Name: %{name}
Version: %{version}
Release: %{release}
License: ASL 2.0
Group: Applications/Databases
URL: https://github.com/greenplum-db
BuildArch: %{arch}
AutoReqProv: no
BuildRoot: %{_topdir}/temp
Prefix: %{prefix}
%description
Apache Greenplum DB
%prep
%pre
if grep ^gpadmin: /etc/group >> /dev/null ; then
: # group already exists
else
%{_sbindir}/groupadd gpadmin
fi
if ! id gpadmin >& /dev/null; then
%{_sbindir}/adduser gpadmin -g gpadmin -d /home/gpadmin
echo 'source /usr/local/apache-greenplum-db/greenplum_path.sh' >> /home/gpadmin/.bashrc
fi
exit 0
%build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}
tar zxf %{_sourcedir}/%{gpdbtarball} -C $RPM_BUILD_ROOT/%{prefix}
cd $RPM_BUILD_ROOT%{prefix}
ln -s %{name}-%{version}-%{release} %{name}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%attr(755, gpadmin, gpadmin) %{installdir}
%attr(755, gpadmin, gpadmin) %{symlink}
%post
INSTDIR=$RPM_INSTALL_PREFIX0/%{name}-%{version}-%{release}
# Update GPHOME in greenplum_path.sh
# Have to use sed to replace it into another file, and then move it back to greenplum_path.sh
# Made sure that even after this step, rpm -e removes greenplum_path.sh as well
#sed "s#GPHOME=.*#GPHOME=${INSTDIR}#g" ${INSTDIR}/greenplum_path.sh > ${INSTDIR}/greenplum_path.sh.updated
#mv ${INSTDIR}/greenplum_path.sh.updated ${INSTDIR}/greenplum_path.sh