-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpython-ircjabberrelay.spec
More file actions
110 lines (89 loc) · 2.59 KB
/
python-ircjabberrelay.spec
File metadata and controls
110 lines (89 loc) · 2.59 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
108
109
110
%global libname ircjabberrelay
Name: python-%{libname}
Version: 0.0.1
Release: 1%{?dist}
Summary: Relay between IRC and Jabber
Group: System Environment/Daemons
License: Public Domain
URL: https://github.com/atorkhov/ircjabberrelay
Source0: %{libname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-devel python-setuptools
Requires: python-twisted-core python-twisted-names python-wokkel-muc
%if 0%{?fedora}
BuildRequires: systemd-units
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%else
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
%endif
%description
Relay between IRC and Jabber
%prep
%setup -q -c -n %{libname}-%{version}
%build
%{__python} setup.py build
%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot}
mkdir -p %{buildroot}/%{_sysconfdir}/%{libname}
mv %{buildroot}/%{python_sitelib}/%{libname}/config.py %{buildroot}/%{_sysconfdir}/%{libname}
ln -s %{_sysconfdir}/%{libname}/config.py %{buildroot}/%{python_sitelib}/%{libname}/config.py
%if 0%{?fedora}
mkdir -p %{buildroot}/%{_unitdir}
cp %{libname}.service %{buildroot}/%{_unitdir}
%else
mkdir -p %{buildroot}/%{_initddir}
cp %{libname}.init %{buildroot}/%{_initddir}/%{libname}
%endif
%if 0%{?fedora}
%post
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable ircjabberrelay.service > /dev/null 2>&1 || :
/bin/systemctl stop ircjabberrelay.service > /dev/null 2>&1 || :
fi
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart ircjabberrelay.service >/dev/null 2>&1 || :
fi
%else
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add ircjabberrelay
%preun
if [ $1 -eq 0 ] ; then
/sbin/service ircjabberrelay stop >/dev/null 2>&1
/sbin/chkconfig --del ircjabberrelay
fi
%postun
if [ "$1" -ge "1" ] ; then
/sbin/service ircjabberrelay condrestart >/dev/null 2>&1 || :
fi
%endif
%files
%defattr(-,root,root,-)
%doc README
%dir %{_sysconfdir}/%{libname}
%config(noreplace) %{_sysconfdir}/%{libname}/*
%{_bindir}/%{libname}.tac
%{python_sitelib}/%{libname}
%{python_sitelib}/%{libname}-%{version}-py*.egg-info
%if 0%{?fedora}
%{_unitdir}/*
%else
%{_initddir}/*
%endif
%changelog
* Thu Jun 14 2012 Alexey Torkhov <atorkhov@gmail.com> - 0.0.1-1
- Initial package