-
Notifications
You must be signed in to change notification settings - Fork 10
/
peekaboo.spec
63 lines (56 loc) · 1.45 KB
/
peekaboo.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
%define name %NAME%
%define version %VERSION%
%define release %RELEASE%
%define buildroot %{_topdir}/BUILDROOT
%define sources %{_topdir}/SOURCES
BuildRoot: %{buildroot}
Source: %SOURCE%
Summary: %{name}
Name: %{name}
Version: %{version}
Release: %{release}
License: Apache License, Version 2.0
Group: System
AutoReqProv: no
%description
%{name}
%prep
mkdir -p %{buildroot}/usr/bin
cp %{sources}/bin/* %{buildroot}/usr/bin
mkdir -p %{buildroot}/var/lib/%{name}
cp -r %{sources}/static %{buildroot}/var/lib/%{name}
mkdir -p %{buildroot}/etc/systemd/system
cp %{sources}/files/%{name}.service %{buildroot}/etc/systemd/system/%{name}.service
mkdir -p %{buildroot}/etc/init.d
cp %{sources}/files/%{name}.initd %{buildroot}/etc/init.d/%{name}
mkdir -p %{buildroot}/etc/sysconfig
cp %{sources}/files/%{name} %{buildroot}/etc/sysconfig/%{name}
%post
which systemctl &>/dev/null && systemctl daemon-reload
%preun
# Disable and stop on uninstall
if [ "${1}" == "0" ]; then
if which systemctl &>/dev/null; then
systemctl stop peekaboo
systemctl disable peekaboo
else
service peekaboo stop
chkconfig program off
fi
fi
%postun
# Restart on upgrade
if [ "${1}" == "1" ]; then
if which systemctl &>/dev/null; then
systemctl condrestart peekaboo
else
service peekaboo condrestart
fi
fi
%files
%defattr(-,root,root)
/usr/bin/%{name}
/var/lib/%{name}
/etc/systemd/system/%{name}.service
%(755,-,-) /etc/init.d/%{name}
%config(noreplace) /etc/sysconfig/%{name}