-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmousetrapd.redhat-spec
119 lines (104 loc) · 4.93 KB
/
mousetrapd.redhat-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
#--------------------------------------------------------------------------------
# Program: mousetrapd.spec
#
# Purpose: This is the data file user to generate RPM files so that we can
# distrbute 'canned' versions of what we have done more easily.
#--------------------------------------------------------------------------------
# 10-Nov-06 - REP - Initial version
#--------------------------------------------------------------------------------
# Some basic definitions for use to use later in the file. We really only want
# to define things once, and have to change things in only one place.
#--------------------------------------------------------------------------------
%define name mousetrapd
%define version 0.2.0
%define release 1
%define mandir /usr/share/man
%define sbindir /usr/sbin
#--------------------------------------------------------------------------------
# Basic package information
#--------------------------------------------------------------------------------
Summary: mousetrapd log monitoring and active response daemon
Name: %{name}
Version: %{version}
Release: %{release}
Group: System Environment/Daemons
License: ISC-style
Url: https://github.com/mikey-austin/mousetrapd
Source0: %{name}_%{version}.orig.tar.gz
Requires: perl perl-YAML-LibYAML
Buildroot: %{_tmppath}/%{name}-buildroot
#--------------------------------------------------------------------------------
# Description of the package
#--------------------------------------------------------------------------------
%description
This program monitors multiple file sources as specified in the
configuration file and executes arbitrary actions based on the
frequency of observer "events".
#--------------------------------------------------------------------------------
# What things to do in preparation of making the package
#--------------------------------------------------------------------------------
%prep
%setup
#--------------------------------------------------------------------------------
# The build process for the package
#--------------------------------------------------------------------------------
%build
#--------------------------------------------------------------------------------
# Configuration process for the package
#--------------------------------------------------------------------------------
### No configure process for mousetrapd
#--------------------------------------------------------------------------------
# The install process for the package
#--------------------------------------------------------------------------------
%install
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}
mkdir -p %{buildroot}%{_initrddir}
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
mkdir -p %{buildroot}/etc/sysconfig
mkdir -p %{buildroot}/usr/share/man/man8/
mkdir -p %{buildroot}/var/run/
mkdir -p %{buildroot}/var/empty/%{name}
make DESTDIR=%{buildroot} mandir=%{_mandir} install
install -m755 mousetrapd.redhat-init %{buildroot}%{_initrddir}/%{name}
#--------------------------------------------------------------------------------
# Things to run after it has been installed.
#--------------------------------------------------------------------------------
%post
/sbin/chkconfig --add %{name}
# Manually add user/group
%{sbindir}/groupadd %{name}
%{sbindir}/useradd -g %{name} -d /var/empty/%{name} -s /bin/false %{name}
#--------------------------------------------------------------------------------
# Take mousetrapd out of runlevels
#--------------------------------------------------------------------------------
%preun
if [ "$1" = 0 ]; then
/sbin/chkconfig --del %{name}
fi
#--------------------------------------------------------------------------------
# Remove mousetrapd user/group if necessary (since "mousetrapd" is the only
# member of group "mousetrapd", then deletion of "mousetrapd" user deletes
# the group.
#--------------------------------------------------------------------------------
%postun
if [ "$1" = 0 ]; then
%{sbindir}/userdel %{name}
%{sbindir}/groupdel %{name}
fi
#--------------------------------------------------------------------------------
# What files and permissions are included in the package
#--------------------------------------------------------------------------------
%files
%defattr(644,root,root,755)
/usr/share/perl5/MT/*
%doc README CREDITS LICENSE
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%attr(755,root,root) %config(noreplace) %{_initrddir}/%{name}
%attr(755,root,root) /usr/local/sbin/%{name}
%{_mandir}/man8/%{name}.8*
#--------------------------------------------------------------------------------
# What final cleanup should occur after the package construction has been
# completed
#--------------------------------------------------------------------------------
%clean
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}