forked from jenkinsci/packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjenkins.spec
More file actions
96 lines (83 loc) · 2.81 KB
/
jenkins.spec
File metadata and controls
96 lines (83 loc) · 2.81 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
# TODO:
# - how to add to the trusted service of the firewall?
%define workdir %{_var}/lib/@@ARTIFACTNAME@@
Name: @@ARTIFACTNAME@@
Version: %{ver}
Release: 1
Summary: @@SUMMARY@@
Source: jenkins.war
Source1: jenkins.service
Source2: jenkins.sh
Source3: migrate.sh
Source4: jenkins.conf
URL: @@HOMEPAGE@@
License: @@LICENSE@@
BuildRoot: %{_tmppath}/build-%{name}-%{version}
# Unfortunately the Oracle Java RPMs do not register as providing anything (including "java" or "jdk")
# So either we make a hard requirement on the OpenJDK or none at all
# Only workaround would be to use a java virtual package, see https://github.com/keystep/virtual-java-rpm
# TODO: If re-enable, fix the matcher for Java 17
# Fedora 42+ removes openjdk-{8,11,17}. Jenkins now uses Eclipse Temurin JDK 21.
%if 0%{?fedora}
Requires: java >= 21
%else
Requires: java >= 17
%endif
Requires: procps
BuildArch: noarch
%systemd_requires
%description
@@DESCRIPTION_FILE@@
Authors:
--------
@@AUTHOR@@
%prep
%setup -q -T -c
%build
%install
rm -rf "%{buildroot}"
%__install -D -m0644 "%{SOURCE0}" "%{buildroot}%{_javadir}/%{name}.war"
%__install -D -m0644 "%{SOURCE1}" "%{buildroot}%{_unitdir}/%{name}.service"
%__install -D -m0755 "%{SOURCE2}" "%{buildroot}%{_bindir}/%{name}"
%__install -D -m0755 "%{SOURCE3}" "%{buildroot}%{_datadir}/%{name}/migrate"
%__install -D -m0755 "%{SOURCE4}" "%{buildroot}%{_tmpfilesdir}/%{name}.conf"
%pre
/usr/bin/getent group %{name} &>/dev/null || /usr/sbin/groupadd -r %{name} &>/dev/null
# SUSE version had -o here, but in Fedora -o isn't allowed without -u
/usr/bin/getent passwd %{name} &>/dev/null || /usr/sbin/useradd -g %{name} -s /bin/false -r -c "@@SUMMARY@@" \
-d "%{workdir}" %{name} &>/dev/null
%post
if [ $1 -eq 1 ]; then
%__install -d -m 0755 -o %{name} -g %{name} %{workdir}
%__install -d -m 0750 -o %{name} -g %{name} %{_localstatedir}/cache/%{name}
elif [ -f "%{_sysconfdir}/sysconfig/%{name}" ]; then
%{_datadir}/%{name}/migrate "/etc/sysconfig/%{name}" || true
fi
%systemd_post %{name}.service
%preun
if [ $1 -eq 0 ]; then
%__rm -rf %{_localstatedir}/cache/%{name}/war
fi
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%{_javadir}/%{name}.war
%ghost %{workdir}
%ghost %{_localstatedir}/cache/%{name}
%{_unitdir}/%{name}.service
%{_bindir}/%{name}
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/migrate
%{_tmpfilesdir}/%{name}.conf
%changelog
* Mon Nov 06 2023 minfrin@sharp.fm
- added unix domain socket support
* Mon Jun 19 2023 projects@unixadm.org
- removed sysv initscript for el>=7
- removed logrotate config
- avoid re-chowning workdir and cachedir on upgrades
* Sat Apr 19 2014 mbarr@mbarr.net
- Removed the jenkins.repo installation. Per https://issues.jenkins-ci.org/browse/JENKINS-22690
* Wed Sep 28 2011 kk@kohsuke.org
- See [@@CHANGELOG_PAGE@@] for complete details