6709efa
# To build on Fedora 14 due to https://bugzilla.redhat.com/show_bug.cgi?id=715580
6709efa
#% global _unitdir /lib/systemd/system
6709efa
f783ca4
Name:		3proxy
c7b25b8
Version:		0.6.1
6709efa
Release:		12%{?dist}
f783ca4
f783ca4
Summary:		Tiny but very powerful proxy
f783ca4
Summary(ru):	Маленький, но крайне мощный прокси-сервер
f783ca4
f783ca4
License:		BSD or ASL 2.0 or GPLv2+ or LGPLv2+
f783ca4
Group:		System Environment/Daemons
f783ca4
Url:			http://3proxy.ru/?l=EN
f783ca4
f783ca4
Source0:		http://3proxy.ru/%{version}/%{name}-%{version}.tgz
f783ca4
Source1:		3proxy.init
f783ca4
Source2:		3proxy.cfg
6709efa
Source3:		3proxy.service
f783ca4
# EPEL still require it
f783ca4
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
f783ca4
BuildRequires:	dos2unix
0ae3d34
Requires:		initscripts
f783ca4
cd8f98a
# I correct config path in man only. It is fully Fedora related.
cd8f98a
Patch0:		3proxy-0.6.1-config-path.patch
cd8f98a
6709efa
# Systemd compliant: https://fedoraproject.org/wiki/Systemd_Packaging_Draft
6709efa
# https://fedoraproject.org/wiki/Packaging:Systemd
6709efa
# https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
6709efa
BuildRequires:			systemd-units
6709efa
Requires(post):		systemd-units
6709efa
Requires(preun):		systemd-units
6709efa
Requires(postun):		systemd-units
6709efa
Requires(triggerun):	systemd-units
6709efa
# This is actually needed for the %triggerun script but Requires(triggerun)
6709efa
# is not valid.  We can use %post because this particular %triggerun script
6709efa
# should fire just after this package is installed.
6709efa
Requires(post):		systemd-sysv
6709efa
6709efa
f783ca4
%description
6709efa
%{name} -- light proxy server.
f783ca4
Universal proxy server with HTTP, HTTPS, SOCKS v4, SOCKS v4a, SOCKS v5, FTP,
f783ca4
POP3, UDP and TCP portmapping, access control, bandwith control, traffic
f783ca4
limitation and accounting based on username, client IP, target IP, day time,
f783ca4
day of week, etc.
f783ca4
f783ca4
%description -l ru
6709efa
%{name} -- маленький прокси сервер.
f783ca4
Это универсальное решение поддерживающее HTTP, HTTPS, SOCKS v4, SOCKS v4a,
f783ca4
SOCKS v5, FTP, POP3, UDP и TCP проброс портов (portmapping), списки доступа
f783ca4
управление скоростью доступа, ограничением трафика и статистикоу, базирующейся
f783ca4
на имени пользователя, слиентском IP адресе, IP цели, времени дня, дня недели
f783ca4
и т.д.
f783ca4
6709efa
%package sysvinit
6709efa
Summary:	Legacy SysV initscripts for %{name} server
6709efa
Group:	System Environment/Daemons
6709efa
6709efa
%description sysvinit
6709efa
Legacy SysV initscripts for init mechanisms such as upstart
6709efa
which do not support the systemd unit file format.
6709efa
f783ca4
%prep
f783ca4
%setup -q
f783ca4
cd8f98a
%patch0 -p0 -b .man-cfg
cd8f98a
f783ca4
# To use "fedora" CFLAGS (exported)
f783ca4
sed -i -e "s/CFLAGS =/CFLAGS +=/" Makefile.Linux
f783ca4
f783ca4
dos2unix Changelog
f783ca4
f783ca4
%build
f783ca4
%{__make} -f Makefile.Linux
f783ca4
f783ca4
%install
f783ca4
rm -rf %{buildroot}
f783ca4
f783ca4
mkdir -p %{buildroot}%{_sysconfdir}
0ae3d34
mkdir -p %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/
c5cc3de
mkdir -p %{buildroot}%{_mandir}/man{3,8}
f783ca4
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
6709efa
install -m755 -D src/%{name} %{buildroot}%{_bindir}/%{name}
f783ca4
install -m755 -D src/dighosts %{buildroot}%{_bindir}/dighosts
f783ca4
install -m755 -D src/ftppr %{buildroot}%{_bindir}/ftppr
f783ca4
install -m755 -D src/mycrypt %{buildroot}%{_bindir}/mycrypt
f783ca4
install -m755 -D src/pop3p %{buildroot}%{_bindir}/pop3p
6709efa
install -m755 -D src/%{name} %{buildroot}%{_bindir}/%{name}
f783ca4
install -m755 -D src/proxy %{buildroot}%{_bindir}/htproxy
f783ca4
install -m755 -D src/socks %{buildroot}%{_bindir}/socks
f783ca4
install -m755 -D src/tcppm %{buildroot}%{_bindir}/tcppm
f783ca4
install -m755 -D src/udppm %{buildroot}%{_bindir}/udppm
f783ca4
f783ca4
install -pD -m755 %{SOURCE1} %{buildroot}/%{_initrddir}/%{name}
f783ca4
install -pD -m644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/%{name}.cfg
6709efa
install -pD -m755 %{SOURCE3} %{buildroot}/%{_unitdir}/%{name}.service
f783ca4
c5cc3de
	for man in man/*.{3,8} ; do
c5cc3de
	install "$man" "%{buildroot}%{_mandir}/man${man:(-1)}/"
0ae3d34
	done
0ae3d34
0ae3d34
cat > %{buildroot}%{_sysconfdir}/NetworkManager/dispatcher.d/40-%{name} <
0ae3d34
#!/bin/sh
0ae3d34
0ae3d34
	if [ "\$2" = "up" ]; then
6709efa
	/sbin/service %{name} condrestart || : # reload doesn't work
0ae3d34
	fi
0ae3d34
EOF
0ae3d34
f783ca4
%clean
f783ca4
rm -rf %{buildroot}
f783ca4
f783ca4
%post
6709efa
	if [ $1 -eq 1 ]; then
6709efa
	# Initial installation
6709efa
	/bin/systemctl daemon-reload >/dev/null 2>&1 || :
6709efa
	fi
f783ca4
f783ca4
%preun
6709efa
	if [ $1 -eq 0 ] ; then
6709efa
	# Package removal, not upgrade
6709efa
	/bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
6709efa
	/bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
6709efa
	fi
6709efa
6709efa
%postun
6709efa
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
6709efa
	if [ $1 -ge 1 ] ; then
6709efa
	# Package upgrade, not uninstall
6709efa
	/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
6709efa
	fi
6709efa
6709efa
%triggerun -- %{name} < 0.6.1-10
6709efa
# Save the current service runlevel info
6709efa
# User must manually run systemd-sysv-convert --apply httpd
6709efa
# to migrate them to systemd targets
6709efa
%{_bindir}/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:
6709efa
6709efa
# Run these because the SysV package being removed won't do them
6709efa
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
6709efa
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
f783ca4
f783ca4
%files
f783ca4
%defattr(-,root,root,-)
f783ca4
%{_bindir}/*
f783ca4
%config(noreplace) %{_sysconfdir}/%{name}.cfg
0ae3d34
%attr(0755,root,root) %config %{_sysconfdir}/NetworkManager/dispatcher.d/40-%{name}
f783ca4
%{_localstatedir}/log/%{name}
f783ca4
%doc Readme Changelog authors copying news
0ae3d34
%{_mandir}/man8/*.8.gz
c5cc3de
%{_mandir}/man3/*.3.gz
6709efa
%{_unitdir}/%{name}.service
6709efa
6709efa
%files sysvinit
6709efa
%{_initrddir}/%{name}
f783ca4
f783ca4
%changelog
6709efa
* Thu Jun 23 2011 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6.1-12
6709efa
- Make service systemd compliant (BZ#657412).
6709efa
3b525ef
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-11
3b525ef
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
3b525ef
c5cc3de
* Thu Nov 4 2010 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6.1-10
c5cc3de
- Add man3/3proxy.cfg.3 man (BZ#648204).
c5cc3de
- Gone explicit man gzip - leave it for rpm.
c5cc3de
cd8f98a
* Sun May 30 2010 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6.1-9
cd8f98a
- Correct path to config file in man (BUG#596087) add Patch0: 3proxy-0.6.1-config-path.patch
cd8f98a
c7b25b8
* Mon Mar 15 2010 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6.1-8
c7b25b8
- Update to version 0.6.1
c7b25b8
- In NM event processing replace service restart to condrestart - BZ#572662
c7b25b8
40f31a6
* Wed Nov 25 2009 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6-7
40f31a6
- Again new init-script for Fix BZ#533144 :).
40f31a6
b163d3d
* Wed Nov 25 2009 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6-6
b163d3d
- Forgot commit new init-script for Fix BZ#533144.
b163d3d
8407b3a
* Sun Nov 8 2009 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6-5
0ae3d34
- Fix BZ#533144:
0ae3d34
- Add reload section to service file, fix stop.
0ae3d34
- Add %%{_sysconfdir}/NetworkManager/dispatcher.d/40-%%{name} (Thanks to Pankaj Pandey)
0ae3d34
- Include man-files.
0ae3d34
- Add Requires: initscripts as owner directory %%{_sysconfdir}/NetworkManager/dispatcher.d/
0ae3d34
f783ca4
* Thu Aug 20 2009 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6-3
f783ca4
- Fedora Review started - thank you Peter Lemenkov.
f783ca4
- Change rights (0755->0644) of config.
f783ca4
- Disable service by default.
f783ca4
- Add BR dos2unix.
f783ca4
f783ca4
* Mon Aug 17 2009 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6-2
f783ca4
- /usr/bin/proxy renamed to htproxy to avoid name bump with libproxy-bin.
f783ca4
- Add Source2: 3proxy.cfg from Alt Linux (slightly modified) - http://sisyphus.ru/ru/srpm/Sisyphus/3proxy/sources/1 (thanks to Afanasov Dmitry).
f783ca4
- Add log-dir %%{_localstatedir}/log/%%{name}
f783ca4
f783ca4
* Mon Aug 17 2009 Pavel Alexeev <Pahan@Hubbitus.info> - 0.6-1
f783ca4
- Ressurect old spec. New version 0.6.
f783ca4
- Rename spec to classic %%{name}.spec.
f783ca4
- Remove Hu part from release and add %%{?dist}.
f783ca4
- Change summary, description, URL. Add Russian localisation of sumamry and description.
f783ca4
- Strip some old comments.
f783ca4
- Add to %%doc Readme Changelog authors copying news.
f783ca4
- Turn macros usage from %%name to %%{name} for consistence.
f783ca4
- Change group from System/Servers to standard System Environment/Daemons.
f783ca4
- Add %%defattr(-,root,root,-) in %%files section.
f783ca4
- Add cleanup in %%install section.
f783ca4
- Add %%clean section with cleanup buildroot.
f783ca4
- License changed from just GPL to "BSD or ASL 2.0 or GPLv2+ or LGPLv2+" (according to Makefile.Linux)
f783ca4
- Add %%config(noreplace) mark to all configs.
f783ca4
- Add file %%{_initdir}/%%{name}
f783ca4
- Old %%{_initdir} macros replaced by %%{_initrddir}
f783ca4
- Hack makefile to use system CFLAGS.
f783ca4
- Add %%post/%%postun sections.
f783ca4
f783ca4
* Fri Jan 25 2008 Pavel Alexeev <Pahan [ at ] Hubbitus [ DOT ] info> - 0.5.3k
f783ca4
- Import from ftp://ftp.nluug.nl/pub/os/Linux/distr/altlinux/4.0/Server/4.0.1/files/SRPMS/3proxy-0.5.3h-alt1.src.rpm
f783ca4
	Combine with ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/t/th/three-proxy/3proxy-0.5.3g-1.src.rpm
f783ca4
- Steep to version 0.5.3k
f783ca4
- Comment out packager
f783ca4
- Reformat header of spec with tabs
f783ca4
- Add desc from second src.rpm of import
f783ca4
- Correct source0
f783ca4
- Add -c key fo %%setup macro
f783ca4
- Add BuildRoot definition (this is not ALT)
f783ca4
- Change
f783ca4
	Release:	alt1
f783ca4
	to
f783ca4
	Release:	0.Hu.0
f783ca4
f783ca4
* Fri Apr 13 2007 Lunar Child <luch@altlinux.ru> 0.5.3h-alt1
f783ca4
- new version
f783ca4
f783ca4
* Wed Mar 21 2007 Lunar Child <luch@altlinux.ru> 0.5.3g-alt2
f783ca4
- Added init script.
f783ca4
- Added new trivial config file.
f783ca4
f783ca4
* Tue Mar 20 2007 Lunar Child <luch@altlinux.ru> 0.5.3g-alt1
f783ca4
- First build for ALT Linux Sisyphus