forked from imeyer/runit-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunit.spec
188 lines (154 loc) · 4.93 KB
/
runit.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
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
#
# spec file for package runit (Version 2.1.2)
#
# Copyright (c) 2010 Ian Meyer <[email protected]>
# Copyright (c) 2014 Brian Shore <[email protected]>
## This package understands the following switches:
## --with dietlibc ... statically links against dietlibc
Name: runit
Version: 2.1.2
Release: 8%{?_with_dietlibc:diet}%{?dist}.seastar
Group: System/Base
License: BSD
# Override _sbindir being /usr/sbin
%define _sbindir /sbin
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://smarden.org/runit/
Source0: http://smarden.org/runit/runit-%{version}.tar.gz
Source1: runsvdir-start.service
Source2: 1
Source3: 2
Source4: 3
Source5: runit.init
Patch0: runit-2.1.2-pid1exit.patch
Obsoletes: runit <= %{version}-%{release}
Provides: runit = %{version}-%{release}
BuildRequires: make gcc
%if 0%{?rhel} >= 6
BuildRequires: glibc-static
%endif
Requires: coreutils bash
PreReq: bash chkconfig coreutils grep rpm
%{?_with_dietlibc:BuildRequires: dietlibc}
Summary: A UNIX init scheme with service supervision
%description
runit is a cross-platform Unix init scheme with service supervision; a
replacement for sysvinit and other init schemes. It runs on GNU/Linux, *BSD,
Mac OS X, and Solaris, and can easily be adapted to other Unix operating
systems. runit implements a simple three-stage concept. Stage 1 performs the
system's one-time initialization tasks. Stage 2 starts the system's uptime
services (via the runsvdir program). Stage 3 handles the tasks necessary to
shutdown and halt or reboot.
Authors:
---------
Gerrit Pape <[email protected]>
%prep
%setup -q -n admin/%{name}-%{version}
pushd src
echo "%{?_with_dietlibc:diet -Os }%__cc $RPM_OPT_FLAGS" >conf-cc
echo "%{?_with_dietlibc:diet -Os }%__cc -Os -pipe" >conf-ld
popd
%patch0 -p 2
%build
sh package/compile
%install
%{__rm} -rf %{buildroot}
EXTRA_FILES=$RPM_BUILD_ROOT/extra_files
touch %{EXTRA_FILES}
for i in $(< package/commands) ; do
%{__install} -D -m 0755 command/$i %{buildroot}%{_sbindir}/$i
done
for i in man/*8 ; do
%{__install} -D -m 0755 $i %{buildroot}%{_mandir}/man8/${i##man/}
done
%{__install} -d -m 0755 %{buildroot}/service
%{__install} -d -m 0755 %{buildroot}/etc/service
%{__install} -d -m 0755 %{buildroot}/etc/runit
%{__install} -d -m 0755 %{buildroot}/etc/runit/envdir-runsvdir
%{__install} -d -m 0755 %{buildroot}/etc/runit/1.d
%{__install} -d -m 0755 %{buildroot}/etc/runit/3.d
%{__install} -m 0755 $RPM_SOURCE_DIR/1 %{buildroot}/etc/runit/1
%{__install} -m 0755 $RPM_SOURCE_DIR/2 %{buildroot}/etc/runit/2
%{__install} -m 0755 $RPM_SOURCE_DIR/3 %{buildroot}/etc/runit/3
%{__install} -D -m 0755 $RPM_SOURCE_DIR/runit.init %{buildroot}%{_initddir}/%{name}
# For systemd only
%if 0%{?rhel} >= 7
%{__install} -D -p -m 0644 $RPM_SOURCE_DIR/runsvdir-start.service \
$RPM_BUILD_ROOT%{_unitdir}/runsvdir-start.service
echo %{_unitdir}/runsvdir-start.service > %{EXTRA_FILES}
%endif
%clean
%{__rm} -rf %{buildroot}
%post
if [ $1 = 1 ] ; then
/bin/ln -sf /etc/runit/2 /sbin/runsvdir-start
%if 0%{?rhel} > 6
/bin/rpm --queryformat='%%{name}' -qf /sbin/init | /bin/grep -q upstart
if [ $? -eq 0 ]; then
cat >/etc/init/runsvdir.conf <<\EOT
# for runit - manage /usr/sbin/runsvdir-start
start on runlevel [2345]
stop on runlevel [^2345]
normal exit 0 111
respawn
exec /sbin/runsvdir-start
EOT
fi
%endif
%if 0%{?rhel} <= 6
/sbin/chkconfig --add runit
%endif
fi
%preun
if [ $1 = 0 ]; then
if [ -f /etc/init/runsvdir.conf ]; then
stop runsvdir
elif [ -f /etc/init.d/runit ]; then
/sbin/chkconfig --del runit
fi
fi
%postun
if [ $1 = 0 ]; then
/bin/rm -vf /sbin/runsvdir-start
if [ -f /etc/init/runsvdir.conf ]; then
rm -f /etc/init/runsvdir.conf
fi
fi
%files -f %{EXTRA_FILES}
%defattr(-,root,root,-)
%{_sbindir}/chpst
%{_sbindir}/runit
%{_sbindir}/runit-init
%{_sbindir}/runsv
%{_sbindir}/runsvchdir
%{_sbindir}/runsvdir
%{_sbindir}/sv
%{_sbindir}/svlogd
%{_sbindir}/utmpset
%{_mandir}/man8/*.8*
%doc doc/*
%doc package/CHANGES package/COPYING package/README package/THANKS package/TODO
%dir /service
%dir /etc/service
%dir /etc/runit
%dir /etc/runit/envdir-runsvdir
%dir /etc/runit/1.d
%dir /etc/runit/3.d
/etc/runit/1
/etc/runit/2
/etc/runit/3
%{_initddir}/runit
%changelog
* Thu Aug 21 2014 Chris Gaffney <[email protected]> 2.1.2-1
- Initial release of 2.1.2
* Fri Jan 20 2012 Joe Miller <[email protected]> 2.1.1-6
- modified spec to build on centos-5 (by only requiring glibc-static on centos-6)
* Wed Oct 26 2011 Karsten Sperling <[email protected]> 2.1.1-5
- Optionally shut down cleanly even on TERM
- Don't call rpm in preun, it can cause problems
- Upstart / inittab tweaks
* Wed Jul 20 2011 Robin Bowes <[email protected]> 2.1.1-4
- 2.1.1-3 Add BuildRequires
- 2.1.1-4 Support systems using upstart
* Sun Jan 23 2011 [email protected]
- Make compatible with Redhat based systems