Systemd migration bz#657412
This commit is contained in:
parent
3b525efc95
commit
6709efae05
1 changed files with 66 additions and 13 deletions
79
3proxy.spec
79
3proxy.spec
|
|
@ -1,6 +1,9 @@
|
|||
# To build on Fedora 14 due to https://bugzilla.redhat.com/show_bug.cgi?id=715580
|
||||
#% global _unitdir /lib/systemd/system
|
||||
|
||||
Name: 3proxy
|
||||
Version: 0.6.1
|
||||
Release: 11%{?dist}
|
||||
Release: 12%{?dist}
|
||||
|
||||
Summary: Tiny but very powerful proxy
|
||||
Summary(ru): Маленький, но крайне мощный прокси-сервер
|
||||
|
|
@ -12,6 +15,7 @@ Url: http://3proxy.ru/?l=EN
|
|||
Source0: http://3proxy.ru/%{version}/%{name}-%{version}.tgz
|
||||
Source1: 3proxy.init
|
||||
Source2: 3proxy.cfg
|
||||
Source3: 3proxy.service
|
||||
# EPEL still require it
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: dos2unix
|
||||
|
|
@ -20,21 +24,43 @@ Requires: initscripts
|
|||
# I correct config path in man only. It is fully Fedora related.
|
||||
Patch0: 3proxy-0.6.1-config-path.patch
|
||||
|
||||
# Systemd compliant: https://fedoraproject.org/wiki/Systemd_Packaging_Draft
|
||||
# https://fedoraproject.org/wiki/Packaging:Systemd
|
||||
# https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
|
||||
BuildRequires: systemd-units
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
Requires(triggerun): systemd-units
|
||||
# This is actually needed for the %triggerun script but Requires(triggerun)
|
||||
# is not valid. We can use %post because this particular %triggerun script
|
||||
# should fire just after this package is installed.
|
||||
Requires(post): systemd-sysv
|
||||
|
||||
|
||||
%description
|
||||
3proxy -- light proxy server.
|
||||
%{name} -- light proxy server.
|
||||
Universal proxy server with HTTP, HTTPS, SOCKS v4, SOCKS v4a, SOCKS v5, FTP,
|
||||
POP3, UDP and TCP portmapping, access control, bandwith control, traffic
|
||||
limitation and accounting based on username, client IP, target IP, day time,
|
||||
day of week, etc.
|
||||
|
||||
%description -l ru
|
||||
3proxy -- маленький прокси сервер.
|
||||
%{name} -- маленький прокси сервер.
|
||||
Это универсальное решение поддерживающее HTTP, HTTPS, SOCKS v4, SOCKS v4a,
|
||||
SOCKS v5, FTP, POP3, UDP и TCP проброс портов (portmapping), списки доступа
|
||||
управление скоростью доступа, ограничением трафика и статистикоу, базирующейся
|
||||
на имени пользователя, слиентском IP адресе, IP цели, времени дня, дня недели
|
||||
и т.д.
|
||||
|
||||
%package sysvinit
|
||||
Summary: Legacy SysV initscripts for %{name} server
|
||||
Group: System Environment/Daemons
|
||||
|
||||
%description sysvinit
|
||||
Legacy SysV initscripts for init mechanisms such as upstart
|
||||
which do not support the systemd unit file format.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
|
|
@ -55,12 +81,12 @@ mkdir -p %{buildroot}%{_sysconfdir}
|
|||
mkdir -p %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/
|
||||
mkdir -p %{buildroot}%{_mandir}/man{3,8}
|
||||
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
|
||||
install -m755 -D src/3proxy %{buildroot}%{_bindir}/3proxy
|
||||
install -m755 -D src/%{name} %{buildroot}%{_bindir}/%{name}
|
||||
install -m755 -D src/dighosts %{buildroot}%{_bindir}/dighosts
|
||||
install -m755 -D src/ftppr %{buildroot}%{_bindir}/ftppr
|
||||
install -m755 -D src/mycrypt %{buildroot}%{_bindir}/mycrypt
|
||||
install -m755 -D src/pop3p %{buildroot}%{_bindir}/pop3p
|
||||
install -m755 -D src/3proxy %{buildroot}%{_bindir}/3proxy
|
||||
install -m755 -D src/%{name} %{buildroot}%{_bindir}/%{name}
|
||||
install -m755 -D src/proxy %{buildroot}%{_bindir}/htproxy
|
||||
install -m755 -D src/socks %{buildroot}%{_bindir}/socks
|
||||
install -m755 -D src/tcppm %{buildroot}%{_bindir}/tcppm
|
||||
|
|
@ -68,6 +94,7 @@ install -m755 -D src/udppm %{buildroot}%{_bindir}/udppm
|
|||
|
||||
install -pD -m755 %{SOURCE1} %{buildroot}/%{_initrddir}/%{name}
|
||||
install -pD -m644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/%{name}.cfg
|
||||
install -pD -m755 %{SOURCE3} %{buildroot}/%{_unitdir}/%{name}.service
|
||||
|
||||
for man in man/*.{3,8} ; do
|
||||
install "$man" "%{buildroot}%{_mandir}/man${man:(-1)}/"
|
||||
|
|
@ -77,7 +104,7 @@ cat > %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/40-%{name} <<EOF
|
|||
#!/bin/sh
|
||||
|
||||
if [ "\$2" = "up" ]; then
|
||||
/sbin/service 3proxy condrestart || : # reload doesn't work
|
||||
/sbin/service %{name} condrestart || : # reload doesn't work
|
||||
fi
|
||||
EOF
|
||||
|
||||
|
|
@ -85,27 +112,53 @@ EOF
|
|||
rm -rf %{buildroot}
|
||||
|
||||
%post
|
||||
# Register service
|
||||
/sbin/chkconfig --add %{name}
|
||||
if [ $1 -eq 1 ]; then
|
||||
# Initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then
|
||||
/sbin/service %{name} stop > /dev/null 2>&1
|
||||
/sbin/chkconfig --del %{name}
|
||||
fi
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop %{name}.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 %{name}.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%triggerun -- %{name} < 0.6.1-10
|
||||
# Save the current service runlevel info
|
||||
# User must manually run systemd-sysv-convert --apply httpd
|
||||
# to migrate them to systemd targets
|
||||
%{_bindir}/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:
|
||||
|
||||
# Run these because the SysV package being removed won't do them
|
||||
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_bindir}/*
|
||||
%config(noreplace) %{_sysconfdir}/%{name}.cfg
|
||||
%attr(0755,root,root) %config %{_sysconfdir}/NetworkManager/dispatcher.d/40-%{name}
|
||||
%{_initrddir}/%{name}
|
||||
%{_localstatedir}/log/%{name}
|
||||
%doc Readme Changelog authors copying news
|
||||
%{_mandir}/man8/*.8.gz
|
||||
%{_mandir}/man3/*.3.gz
|
||||
%{_unitdir}/%{name}.service
|
||||
|
||||
%files sysvinit
|
||||
%{_initrddir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Thu Jun 23 2011 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6.1-12
|
||||
- Make service systemd compliant (BZ#657412).
|
||||
|
||||
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue