forked from indexdata/metaproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metaproxy.spec
163 lines (141 loc) · 4.5 KB
/
metaproxy.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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
%define idmetaversion %(. ./IDMETA; echo $VERSION)
Summary: Z39.50/SRU router
Name: metaproxy
Version: %{idmetaversion}
Release: 1.indexdata
License: GPL
Group: Applications/Internet
Vendor: Index Data ApS <[email protected]>
Source: metaproxy-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Prefix: %{_prefix} /etc/metaproxy
BuildRequires: pkgconfig, libyaz5-devel >= 5.18.0, libyazpp6-devel >= 1.6.0
BuildRequires: libxslt-devel, boost-devel
Conflicts: cf-engine <= 2.12.5
Packager: Adam Dickmeiss <[email protected]>
URL: http://www.indexdata.com/metaproxy
Requires: libmetaproxy6 = %{version}
Provides: metaproxy6
%description
Metaproxy daemon.
%package doc
Summary: Metaproxy documentation
Group: Documentation
%description doc
Metaproxy documentation.
%package -n libmetaproxy6
Summary: Metaproxy library
Group: Libraries
Requires: libyazpp6 >= 1.6.0, libyaz5 >= 5.18.0
%description -n libmetaproxy6
The Metaproxy libraries.
%package -n libmetaproxy6-devel
Summary: Metaproxy development package
Group: Development/Libraries
Requires: libmetaproxy6 = %{version}, libyazpp6-devel, boost-devel
Conflicts: libmetaproxy3-devel, libmetaproxy4-devel, libmetaproxy5-devel
%description -n libmetaproxy6-devel
Development libraries and include files for the Metaproxy package.
%prep
%setup
%build
CFLAGS="$RPM_OPT_FLAGS" \
./configure --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_mandir} \
--enable-shared --with-yazpp=/usr/bin
%if %{?make_build:1}%{!?make_build:0}
%make_build
%else
make -j4 CFLAGS="$RPM_OPT_FLAGS"
%endif
%install
rm -fr ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT}
rm ${RPM_BUILD_ROOT}/%{_libdir}/*.la
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/metaproxy/*
mkdir -p ${RPM_BUILD_ROOT}/%{_libdir}/metaproxy6/modules
mkdir -p ${RPM_BUILD_ROOT}/etc/metaproxy/filters-enabled
mkdir -p ${RPM_BUILD_ROOT}/etc/metaproxy/filters-available
mkdir -p ${RPM_BUILD_ROOT}/etc/metaproxy/ports.d
mkdir -p ${RPM_BUILD_ROOT}/etc/metaproxy/routes.d
mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d
mkdir -p ${RPM_BUILD_ROOT}/etc/init.d
mkdir -p ${RPM_BUILD_ROOT}/etc/sysconfig
install -m 644 rpm/metaproxy.xml ${RPM_BUILD_ROOT}/etc/metaproxy/metaproxy.xml
install -m 644 rpm/metaproxy.user ${RPM_BUILD_ROOT}/etc/metaproxy/metaproxy.user
install -m 755 rpm/metaproxy.init ${RPM_BUILD_ROOT}/etc/init.d/metaproxy
install -m 644 rpm/metaproxy.sysconfig ${RPM_BUILD_ROOT}/etc/sysconfig/metaproxy
install -m 644 rpm/metaproxy.logrotate ${RPM_BUILD_ROOT}/etc/logrotate.d/metaproxy
%clean
rm -fr ${RPM_BUILD_ROOT}
%files -n libmetaproxy6
%doc README.md LICENSE NEWS
%defattr(-,root,root)
%{_libdir}/*.so.*
%dir %{_libdir}/metaproxy6/modules
%post -n libmetaproxy6 -p /sbin/ldconfig
%postun -n libmetaproxy6 -p /sbin/ldconfig
%files -n libmetaproxy6-devel
%defattr(-,root,root)
%{_includedir}/metaproxy
%{_libdir}/*.so
%{_libdir}/*.a
%{_bindir}/metaproxy-config
%{_mandir}/man1/metaproxy-config.*
%files doc
%defattr(-,root,root)
%{_prefix}/share/doc/metaproxy
%files
%defattr(-,root,root)
%{_datadir}/metaproxy
%{_bindir}/metaproxy
%{_mandir}/man3/*
%{_mandir}/man1/metaproxy.*
%config /etc/init.d/metaproxy
%config(noreplace) /etc/metaproxy/metaproxy.xml
%config /etc/metaproxy/metaproxy.user
%dir /etc/metaproxy/filters-available
%dir /etc/metaproxy/filters-enabled
%dir /etc/metaproxy/ports.d
%dir /etc/metaproxy/routes.d
%config(noreplace) /etc/logrotate.d/metaproxy
%config(noreplace) /etc/sysconfig/metaproxy
%post
. /etc/metaproxy/metaproxy.user
# 1. create group if not existing
if ! getent group | grep -q "^$SERVER_GROUP:" ; then
echo -n "Adding group $SERVER_GROUP.."
groupadd -r $SERVER_GROUP 2>/dev/null ||true
echo "..done"
fi
# 2. create user if not existing
if ! getent passwd | grep -q "^$SERVER_USER:"; then
echo -n "Adding system user $SERVER_USER.."
useradd \
-r \
-s /sbin/nologin \
-c "$SERVER_NAME" \
-d $SERVER_HOME \
-g $SERVER_GROUP \
$SERVER_USER 2>/dev/null || true
echo "..done"
fi
if test ! -d $SERVER_HOME; then
mkdir $SERVER_HOME
chown $SERVER_USER:$SERVER_GROUP $SERVER_HOME
fi
if [ $1 = 1 ]; then
/sbin/chkconfig --add metaproxy
/sbin/service metaproxy start > /dev/null 2>&1
else
/sbin/service metaproxy restart > /dev/null 2>&1
fi
%preun
if [ $1 = 0 ]; then
if test -f /etc/init.d/metaproxy; then
/sbin/service metaproxy stop > /dev/null 2>&1
/sbin/chkconfig --del metaproxy
fi
. /etc/metaproxy/metaproxy.user
test -d $SERVER_HOME && rm -fr $SERVER_HOME
userdel $SERVER_USER
fi