Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
24cf3157a5 Adjust packaging to allow building for RHEL 6 and 7 2017-01-31 21:13:40 +01:00
267e190479 Fix python2 build 2017-01-31 20:57:44 +01:00
2 changed files with 166 additions and 3 deletions

94
ufw.init Normal file
View file

@ -0,0 +1,94 @@
#!/bin/sh
#
# ufw - Uncomplicated firewall
#
# chkconfig: - 08 92
# description: The Uncomplicated Firewall(ufw) is a front-end for netfilter, which aims to \
# make it easier for people unfamiliar with firewall concepts. Ufw provides a \
# framework for managing netfilter as well as manipulating the firewall.
### BEGIN INIT INFO
# Provides: ufw
# Default-Start:
# Default-Stop: 0 1 6
# Short-Description: Uncomplicated firewall
# Description: The Uncomplicated Firewall(ufw) is a front-end for netfilter, which aims to
# make it easier for people unfamiliar with firewall concepts. Ufw provides a
# framework for managing netfilter as well as manipulating the firewall.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
prog="Uncomplicated firewall"
exec="/usr/libexec/ufw/ufw-init"
lockfile="/var/lock/subsys/ufw"
[ -e /etc/sysconfig/ufw ] && . /etc/sysconfig/ufw
start() {
[ -x $exec ] || exit 5
echo -n $"Starting $prog: "
$exec start
RETVAL=$?
[ $RETVAL -eq 0 ] && (touch $lockfile; success) || failure
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
$exec stop
RETVAL=$?
[ $RETVAL -eq 0 ] && (rm -f $lockfile; success) || failure
echo
return $RETVAL
}
rh_status() {
if [ -f $lockfile ]; then
echo $"${prog} is running..."
return 0
else
echo $"${prog} is stopped"
return 3
fi
}
rh_status_q() {
rh_status > /dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
stop
start
;;
reload)
exit 3
;;
force-reload)
restart
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?

View file

@ -1,6 +1,18 @@
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 8
%bcond_without python3
%else
%bcond_with python3
%endif
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%bcond_without systemd
%else
%bcond_with systemd
%endif
Name: ufw
Version: 0.35
Release: 7%{?dist}
Release: 9%{?dist}
Summary: Uncomplicated Firewall
License: GPLv3
@ -8,6 +20,8 @@ URL: https://launchpad.net/%{name}
Source0: https://launchpad.net/%{name}/%{version}/%{version}/+download/ufw-%{version}.tar.gz
# systemd service file
Source1: ufw.service
# System V init script file
Source2: ufw.init
# Install translations to the systemwide standard location for %%find_lang
Patch0: ufw-0.35-trans-dir.patch
# Separate libexec_dir from state_dir because the state files must go into /var,
@ -39,16 +53,26 @@ Patch8: ufw-0.35-no-pointless-env.patch
BuildArch: noarch
%if %{with python3}
BuildRequires: python3-devel
%else
BuildRequires: python2-devel
%endif
BuildRequires: iptables
BuildRequires: gettext
%if %{with systemd}
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires: systemd
%else
BuildRequires: iptables-ipv6
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service, /sbin/chkconfig
Requires(postun): /sbin/service
Requires: iptables-ipv6
%endif
Requires: iptables
%description
@ -72,31 +96,70 @@ rm -f profiles/*.additional-profiles
%patch8 -p1 -b .no-pointless-env
%build
%if %{with python3}
%py3_build
%else
%py2_build
%endif
%install
%if %{with python3}
%py3_install
%else
%py2_install
%endif
%if %{with systemd}
install -D -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/ufw.service
%else
install -D -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
%endif
%find_lang %{name}
%post
%if %{with systemd}
%systemd_post ufw.service
%else
/sbin/chkconfig --add %{name}
%endif
%preun
%if %{with systemd}
%systemd_preun ufw.service
%else
if [ $1 -eq 0 ]; then
/sbin/service %{name} stop > /dev/null 2>&1 || :
/sbin/chkconfig --del %{name}
fi
%endif
%postun
%if %{with systemd}
%systemd_postun_with_restart ufw.service
%else
if [ $1 -ne 0 ]; then
/sbin/service %{name} condrestart > /dev/null 2>&1 || :
fi
%endif
%files -f %{name}.lang
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc ChangeLog README TODO AUTHORS
%{_sbindir}/ufw
%{_libexecdir}/ufw/
%if %{with python3}
%{python3_sitelib}/ufw-%{version}-py*.egg-info
%{python3_sitelib}/ufw/
%else
%{python2_sitelib}/ufw-%{version}-py*.egg-info
%{python2_sitelib}/ufw/
%endif
%{_datadir}/ufw/
%if %{with systemd}
%{_unitdir}/ufw.service
%else
%{_sysconfdir}/rc.d/init.d/%{name}
%endif
# config files under /etc, directly user-editable, should survive updates
%dir %{_sysconfdir}/ufw/
%config(noreplace) %{_sysconfdir}/ufw/after.init
@ -120,6 +183,12 @@ install -D -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/ufw.service
%changelog
* Tue Jan 31 2017 Robert Scheck <robert@fedoraproject.org> 0.35-9
- Adjust packaging to allow building for RHEL 6 and 7
* Wed Jan 19 2017 Helge Wiethoff <helge@nicht-laut.de> 0.35-8
- Fix python2 build
* Tue Jan 03 2017 Kevin Kofler <Kevin@tigcc.ticalc.org> 0.35-7
- Bump Release for official build