# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 PYTHON_COMPAT=( python3_{7,8} ) DISTUTILS_IN_SOURCE_BUILD=1 DISTUTILS_USE_SETUPTOOLS=no inherit bash-completion-r1 distutils-r1 eutils linux-info systemd DESCRIPTION="A program used to manage a netfilter firewall" HOMEPAGE="https://launchpad.net/ufw" SRC_URI="https://launchpad.net/ufw/${PV}/${PV}/+download/${P}.tar.gz" LICENSE="GPL-3" SLOT="0" KEYWORDS="amd64 ~ia64 ppc ppc64 sparc x86" IUSE="examples ipv6" DEPEND="" RDEPEND=">=net-firewall/iptables-1.4[ipv6?] ! /dev/null || die local lang for lang in *.po; do if ! has "${lang%.po}" ${LINGUAS}; then rm "${lang}" || die else _EMPTY_LOCALE_LIST="no" fi done popd > /dev/null || die else _EMPTY_LOCALE_LIST="no" fi distutils-r1_python_prepare_all } python_install_all() { newconfd "${FILESDIR}"/ufw.confd ufw newinitd "${FILESDIR}"/ufw-2.initd ufw systemd_dounit "${FILESDIR}/ufw.service" exeinto /usr/share/${PN} doexe tests/check-requirements # users normally would want it insinto "/usr/share/doc/${PF}/logging/syslog-ng" doins -r "${FILESDIR}"/syslog-ng/* insinto "/usr/share/doc/${PF}/logging/rsyslog" doins -r "${FILESDIR}"/rsyslog/* doins doc/rsyslog.example if use examples; then insinto "/usr/share/doc/${PF}/examples" doins -r examples/* fi newbashcomp shell-completion/bash "${PN}" [[ $_EMPTY_LOCALE_LIST != "yes" ]] && domo locales/mo/*.mo distutils-r1_python_install_all python_replicate_script "${D}/usr/sbin/ufw" } pkg_postinst() { local print_check_req_warn print_check_req_warn=false if [[ -z "${REPLACING_VERSIONS}" ]]; then echo elog "To enable ufw, add it to boot sequence and activate it:" elog "-- # rc-update add ufw boot" elog "-- # /etc/init.d/ufw start" echo elog "If you want to keep ufw logs in a separate file, take a look at" elog "/usr/share/doc/${PF}/logging." print_check_req_warn=true else local rv for rv in "${REPLACING_VERSIONS}"; do local major=${rv%%.*} local minor=${rv#${major}.} if [[ "${major}" -eq 0 && "${minor}" -lt 34 ]]; then print_check_req_warn=true fi done fi if [[ "${print_check_req_warn}" == "true" ]]; then echo elog "/usr/share/ufw/check-requirements script is installed." elog "It is useful for debugging problems with ufw. However one" elog "should keep in mind that the script assumes IPv6 is enabled" elog "on kernel and net-firewall/iptables, and fails when it's not." fi echo ewarn "Note: once enabled, ufw blocks also incoming SSH connections by" ewarn "default. See README, Remote Management section for more information." }