-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlivereduce.spec
More file actions
107 lines (86 loc) · 2.97 KB
/
livereduce.spec
File metadata and controls
107 lines (86 loc) · 2.97 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
%global srcname livereduce
%global summary Daemon for running live data reduction with systemd
# This only supports python3
%define release 1
# give default version for linting
%if "%{?version}" == ""
%define version 0.0
%endif
Summary: %{summary}
Name: python-%{srcname}
Version: %{version}
Release: %{release}%{?dist}
Source0: %{srcname}-%{version}.tar.gz
License: MIT
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: Pete Peterson
Url: https://github.com/mantidproject/livereduce
BuildRequires: python%{python3_pkgversion}
BuildRequires: systemd-rpm-macros
Requires: python%{python3_pkgversion}
Requires: jq
Requires: nsd-app-wrap
Requires: polkit
Requires: systemd
%description
Daemon for running the algorithm StartLiveData
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
%package watchdog
Summary: Watchdog for restarting livereduce daemon
# may need to tweak the main package name as macros change
Requires: python-%{srcname} = %{version}-%{release}
%description watchdog
Daemon that monitors the livereduce log file and restarts service livereduce if necessary
%prep
%setup -q -n %{srcname}-%{version}
%build
# no build step
%install
%{__rm} -rf $RPM_BUILD_ROOT
# put things in the bin directory
%{__mkdir} -p %{buildroot}%{_bindir}/
%{__install} -m 644 scripts/livereduce.py %{buildroot}%{_bindir}/
%{__install} -m 755 scripts/livereduce.sh %{buildroot}%{_bindir}/
%{__mkdir} -p %{buildroot}%{_unitdir}/
%{__install} -m 644 livereduce.service %{buildroot}%{_unitdir}/
# watchdog service
%{__install} -m 755 scripts/livereduce_watchdog.sh %{buildroot}%{_bindir}/
%{__install} -m 644 livereduce_watchdog.service %{buildroot}%{_unitdir}/
%{__mkdir} -p %{buildroot}%{_sysconfdir}/polkit-1/rules.d/
%{__install} -m 644 50-snsdata-livereduce.rules %{buildroot}%{_sysconfdir}/polkit-1/rules.d/
%check
# no test step
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
# Check if required users exist; fail install if snsdata missing
%{__id} snsdata > /dev/null 2>&1 || { echo "Error: snsdata user not found. Please create it before installing this package."; exit 1; }
%post
%systemd_post livereduce.service
%{__mkdir} -p /var/log/SNS_applications/
%{__chown} snsdata /var/log/SNS_applications/
%{__chmod} 1755 /var/log/SNS_applications/
%post watchdog
%systemd_post livereduce_watchdog.service
%preun
%systemd_preun livereduce.service
%{__rm} -f /var/log/SNS_applications/livereduce.log*
%preun watchdog
%systemd_preun livereduce_watchdog.service
%{__rm} -f /var/log/SNS_applications/livereduce_watchdog.log*
%postun
%systemd_postun_with_restart livereduce.service
%postun watchdog
%systemd_postun_with_restart livereduce_watchdog.service
%files
%doc README.md
%{_bindir}/livereduce.py
%{_bindir}/livereduce.sh
%{_unitdir}/livereduce.service
%files watchdog
%{_bindir}/livereduce_watchdog.sh
%{_unitdir}/livereduce_watchdog.service
%config(noreplace) %{_sysconfdir}/polkit-1/rules.d/50-snsdata-livereduce.rules