forked from patternfly/patternfly-react-seed
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsoftether-patternfly-ui.spec
More file actions
346 lines (304 loc) · 12 KB
/
Copy pathsoftether-patternfly-ui.spec
File metadata and controls
346 lines (304 loc) · 12 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#
# vim: syntax=spec
%define V5_VERSION 5.02.5180
%define V4_VERSION 4.38-9760-rtm
%define console_path src/bin/hamcore/wwwroot/admin/manager
%define systemd_unit_path %{_prefix}/lib/systemd/system
%define ncpu_features aarch64 %{arm} s390x
%define nv4_arches s390x ppc64le
%define unit_gen()\
if [ %1 == "5" ]; then\
echo "[Unit]\
Description=SoftEther%1 VPN %2\
After=network.target auditd.service\
ConditionPathExists=!%{_sharedstatedir}/softether%1/vpn%2/do_not_run\
\
[Service]\
Type=forking\
ExecStart=%{_libexecdir}/softether%1/vpn%2/vpn%2 start\
ExecStop=%{_libexecdir}/softether%1/vpn%2/vpn%2 stop\
LogsDirectory=softether%1\
RuntimeDirectory=softether%1\
KillMode=process\
Restart=on-failure\
\
# Hardening\
PrivateTmp=yes\
ProtectHome=yes\
ProtectSystem=full\
ReadOnlyPaths=/\
ReadWritePaths=-%{_sysconfdir}/softether%1\
ReadWritePaths=-/run/softether%1\
ReadWritePaths=-/var/log/softether%1\
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID\
\
[Install]\
WantedBy=multi-user.target" > %{buildroot}/%{systemd_unit_path}/softether%1-%2.service; \
else\
echo "[Unit]\
Description=SoftEther%1 VPN %2\
After=network.target auditd.service\
ConditionPathExists=!/opt/softether%1/vpn%2/do_not_run\
\
[Service]\
Type=forking\
ExecStart=/opt/softether%1/vpn%2/vpn%2 start\
ExecStop=/opt/softether%1/vpn%2/vpn%2 stop\
KillMode=process\
Restart=on-failure\
\
# Hardening\
PrivateTmp=yes\
ProtectHome=yes\
ProtectSystem=full\
ReadOnlyPaths=/\
ReadWritePaths=-/opt/softether%1/vpn%2\
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID\
\
[Install]\
WantedBy=multi-user.target" > %{buildroot}/%{systemd_unit_path}/softether%1-%2.service;\
fi
### Main package aka sources
Name: SoftEtherVPN-patternfly-sources
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: A PatternFly 4 web administration console for SoftEtherVPN Software
License: BSD-3
URL: https://github.com/Leuca/softether-patternfly-ui
# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS: {{{ git_dir_vcs }}}
BuildRequires: npm wget cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel
BuildRequires: gettext diffstat doxygen git patch patchutils subversion systemtap
BuildRequires: nodejs gcc-c++
Source: {{{ git_dir_pack }}}
%package -n SoftEtherVPN5-common
Summary: SoftEtherVPN version 5 common files
License: Apache License Version 2.0
URL: https://github.com/SoftEtherVPN/SoftEtherVPN
%package -n SoftEtherVPN5-server
Summary: SoftEtherVPN version 5 server
License: Apache License Version 2.0
Requires: SoftEtherVPN5-common
URL: https://github.com/SoftEtherVPN/SoftEtherVPN
%package -n SoftEtherVPN5-client
Summary: SoftEtherVPN version 5 client
License: Apache License Version 2.0
Requires: SoftEtherVPN5-common
URL: https://github.com/SoftEtherVPN/SoftEtherVPN
%package -n SoftEtherVPN5-bridge
Summary: SoftEtherVPN version 5 bridge
License: Apache License Version 2.0
Requires: SoftEtherVPN5-common
URL: https://github.com/SoftEtherVPN/SoftEtherVPN
%ifnarch %{nv4_arches}
%package -n SoftEtherVPN4-common
Summary: SoftEtherVPN version 4 common files
License: Apache License Version 2.0
URL: https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
%package -n SoftEtherVPN4-server
Summary: SoftEtherVPN version 4 server
License: Apache License Version 2.0
Requires: SoftEtherVPN4-common
URL: https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
%package -n SoftEtherVPN4-client
Summary: SoftEtherVPN version 4 client
License: Apache License Version 2.0
Requires: SoftEtherVPN4-common
URL: https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
%package -n SoftEtherVPN4-bridge
Summary: SoftEtherVPN version 4 bridge
License: Apache License Version 2.0
Requires: SoftEtherVPN4-common
URL: https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
%endif
## Descriptions
%description
Source code for the Web Administration Console for SoftEtherVPN Server made using the PatternFly 4 react framework
%description -n SoftEtherVPN5-common
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 5 common files and provides the vpncmd command.
%description -n SoftEtherVPN5-server
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 5 server files and binary.
%description -n SoftEtherVPN5-bridge
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 5 bridge files and binary.
%description -n SoftEtherVPN5-client
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 5 client files and binary.
%ifnarch %{nv4_arches}
%description -n SoftEtherVPN4-common
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 4 common files and provides the vpncmd command.
%description -n SoftEtherVPN4-server
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 4 server files and binary.
%description -n SoftEtherVPN4-bridge
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 4 bridge files and binary.
%description -n SoftEtherVPN4-client
SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the
world's most powerful and easy-to-use multi-protocol VPN software.
This package contains version 4 client files and binary.
%endif
%prep
{{{ git_dir_setup_macro }}}
git clone -b %{V5_VERSION} https://github.com/SoftEtherVPN/SoftEtherVPN.git
mv SoftEtherVPN SoftEtherVPN-%{V5_VERSION}
pushd SoftEtherVPN-%{V5_VERSION}
git submodule init && git submodule update
%ifnarch %{nv4_arches}
pushd ..
wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/archive/refs/tags/v%{V4_VERSION}.tar.gz
tar -xvf v%{V4_VERSION}.tar.gz
%endif
%build
# Build console
npm install
npm run build
# Put the console in the source tree
mkdir SoftEtherVPN-%{V5_VERSION}/%{console_path}
cp -r dist/* SoftEtherVPN-%{V5_VERSION}/%{console_path}
pushd SoftEtherVPN-%{V5_VERSION}
git submodule init && git submodule update
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_SYSTEMD_UNITDIR=%{systemd_unit_path} -DSE_PIDDIR=%{_rundir}/softether5 -DSE_LOGDIR=%{_localstatedir}/log/softether5 -DSE_DBDIR=%{_sysconfdir}/softether5" ./configure
make -C build
# Now build v4 if possible
%ifnarch %{nv4_arches}
pushd ..
mkdir SoftEtherVPN_Stable-%{V4_VERSION}/%{console_path}
cp -r dist/* SoftEtherVPN_Stable-%{V4_VERSION}/%{console_path}
pushd SoftEtherVPN_Stable-%{V4_VERSION}
./configure
make
%endif
%install
# V5
# directories
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_rundir}/softether5
mkdir -p %{buildroot}/%{_localstatedir}/log/softether5
mkdir -p %{buildroot}/%{_sharedstatedir}/softether5
mkdir -p %{buildroot}/%{systemd_unit_path}
mkdir -p %{buildroot}/%{_sysconfdir}/softether5
# Install v5 and generate units
pushd SoftEtherVPN-%{V5_VERSION}
make DESTDIR=%{buildroot} -C build install
# rename systemd units
mv %{buildroot}/%{systemd_unit_path}/softether-vpnbridge.service %{buildroot}/%{systemd_unit_path}/softether5-bridge.service
mv %{buildroot}/%{systemd_unit_path}/softether-vpnserver.service %{buildroot}/%{systemd_unit_path}/softether5-server.service
mv %{buildroot}/%{systemd_unit_path}/softether-vpnclient.service %{buildroot}/%{systemd_unit_path}/softether5-client.service
# backup the only binary we want before losing it if needed
%ifnarch %{ncpu_features}
cp %{buildroot}/%{_bindir}/list_cpu_features %{buildroot}/list_cpu_features
%endif
rm -rf %{buildroot}/%{_bindir}
mv %{buildroot}/%{_libexecdir}/softether %{buildroot}/%{_libexecdir}/softether5
# Create systemd units
%unit_gen "5" "server"
%unit_gen "5" "bridge"
%unit_gen "5" "client"
# V4 if possible
%ifnarch %{nv4_arches}
pushd ../SoftEtherVPN_Stable-%{V4_VERSION}
mkdir -p %{buildroot}/%{_bindir}
INSTALL_BINDIR=%{buildroot}/%{_bindir}/ INSTALL_VPNSERVER_DIR=%{buildroot}/opt/softether4/vpnserver/ INSTALL_VPNBRIDGE_DIR=%{buildroot}/opt/softether4/vpnbridge/ INSTALL_VPNCLIENT_DIR=%{buildroot}/opt/softether4/vpnclient/ INSTALL_VPNCMD_DIR=%{buildroot}/opt/softether4/vpncmd/ make -e install
rm -rf %{buildroot}/%{_bindir}
# Create systemd units
%unit_gen "4" "server"
%unit_gen "4" "bridge"
%unit_gen "4" "client"
mkdir -p %{buildroot}/%{_bindir}
echo "#!/bin/sh
/opt/softether4/vpncmd/vpncmd \"\$@\"
exit $?" > %{buildroot}/%{_bindir}/vpncmd4
chmod 755 %{buildroot}/%{_bindir}/vpncmd4
%endif
# now it is safe to create the script
echo "#!/bin/sh
%{_libexecdir}/softether5/vpncmd/vpncmd \"\$@\"
exit $?" > %{buildroot}/%{_bindir}/vpncmd5
chmod 755 %{buildroot}/%{_bindir}/vpncmd5
# restore list_cpu_features if needed
%ifnarch %{ncpu_features}
mv %{buildroot}/list_cpu_features %{buildroot}/%{_bindir}/list_cpu_features
%endif
# Install sources
mkdir -p %{buildroot}/%{_usrsrc}/SoftEtherVPN-patternfly-sources
wget https://github.com/Leuca/softether-patternfly-ui/archive/refs/heads/master.zip
mv master.zip %{buildroot}/%{_usrsrc}/SoftEtherVPN-patternfly-sources
%files
%license LICENSE
%{_usrsrc}/SoftEtherVPN-patternfly-sources/master.zip
%files -n SoftEtherVPN5-common
%license SoftEtherVPN-%{V5_VERSION}/LICENSE
%{_sysconfdir}/softether5
%{_libexecdir}/softether5/vpncmd/vpncmd
%{_libexecdir}/softether5/vpncmd/hamcore.se2
%{_bindir}/vpncmd5
%{_rundir}/softether5
%{_localstatedir}/log/softether5
%{_libdir}/libcedar.so
%{_libdir}/libmayaqua.so
# in case the build uses cpu_features
%ifnarch %{ncpu_features}
%{_libdir}/libcpu_features.a
%{_includedir}/cpu_features/cpuinfo_aarch64.h
%{_includedir}/cpu_features/cpuinfo_arm.h
%{_includedir}/cpu_features/cpuinfo_mips.h
%{_includedir}/cpu_features/cpuinfo_ppc.h
%{_includedir}/cpu_features/cpuinfo_x86.h
%{_includedir}/cpu_features/cpu_features_macros.h
%{_bindir}/list_cpu_features
%{_libdir}/cmake/CpuFeatures/CpuFeaturesTargets.cmake
%{_libdir}/cmake/CpuFeatures/CpuFeaturesTargets-relwithdebinfo.cmake
%{_libdir}/cmake/CpuFeatures/CpuFeaturesConfig.cmake
%{_libdir}/cmake/CpuFeatures/CpuFeaturesConfigVersion.cmake
%endif
%files -n SoftEtherVPN5-server
%license SoftEtherVPN-%{V5_VERSION}/LICENSE
%{_libexecdir}/softether5/vpnserver/vpnserver
%{_libexecdir}/softether5/vpnserver/hamcore.se2
%{systemd_unit_path}/softether5-server.service
%files -n SoftEtherVPN5-bridge
%license SoftEtherVPN-%{V5_VERSION}/LICENSE
%{_libexecdir}/softether5/vpnbridge/vpnbridge
%{_libexecdir}/softether5/vpnbridge/hamcore.se2
%{systemd_unit_path}/softether5-bridge.service
%files -n SoftEtherVPN5-client
%license SoftEtherVPN-%{V5_VERSION}/LICENSE
%{_libexecdir}/softether5/vpnclient/vpnclient
%{_libexecdir}/softether5/vpnclient/hamcore.se2
%{systemd_unit_path}/softether5-client.service
%ifnarch %{nv4_arches}
%files -n SoftEtherVPN4-common
%license SoftEtherVPN_Stable-%{V4_VERSION}/LICENSE
/opt/softether4/vpncmd/vpncmd
/opt/softether4/vpncmd/hamcore.se2
%{_bindir}/vpncmd4
%files -n SoftEtherVPN4-server
%license SoftEtherVPN_Stable-%{V4_VERSION}/LICENSE
/opt/softether4/vpnserver/vpnserver
/opt/softether4/vpnserver/hamcore.se2
%{systemd_unit_path}/softether4-server.service
%files -n SoftEtherVPN4-bridge
%license SoftEtherVPN_Stable-%{V4_VERSION}/LICENSE
/opt/softether4/vpnbridge/vpnbridge
/opt/softether4/vpnbridge/hamcore.se2
%{systemd_unit_path}/softether4-bridge.service
%files -n SoftEtherVPN4-client
%license SoftEtherVPN_Stable-%{V4_VERSION}/LICENSE
/opt/softether4/vpnclient/vpnclient
/opt/softether4/vpnclient/hamcore.se2
%{systemd_unit_path}/softether4-client.service
%endif
%changelog
{{{ git_dir_changelog }}}