summaryrefslogtreecommitdiffstats
path: root/packages/net-firewall/ufw/ufw-0.36.2.exheres-0
blob: c55c871642c463589ac6d8fdabfad554011bbf7d (plain)
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
# Copyright 2026 Gurov <thuggerthugger1@duck.com>
# Distributed under the terms of the GNU General Public License v2

require python [ blacklist="2 3.9 3.10" multibuild=false ] systemd-service

SUMMARY="Uncomplicated firewall frontend for iptables"
HOMEPAGE="https://launchpad.net/ufw"
DOWNLOADS="${HOMEPAGE}/${PV%.*}/${PV}/+download/${PNV}.tar.gz"

LICENCES="GPL-3"
SLOT="0"
PLATFORMS="~amd64"
RESTRICT="test"

DEPENDENCIES="
    build:
        dev-python/setuptools[python_abis:*(-)?]
        sys-devel/gettext

    run:
        net-firewall/iptables
"

DEFAULT_SRC_PREPARE_PATCHES=(
    "${FILES}/${PN}-0.36.1-move-path.patch"
    "${FILES}/${PN}-0.36.1-dont-check-iptables.patch"
    "${FILES}/${PN}-0.36.1-shebang.patch"
    "${FILES}/${PN}-0.36-bash-completion.patch"
    "${FILES}/${PN}-0.36.1-distutils.patch"
)

src_compile() {
    edo "${PYTHON}" -B setup.py install --prefix=/usr \
        --root="${WORK}/staging-root" --install-lib="$(python_get_sitedir)" \
        --no-compile
}

src_install() {
    edo cp -R "${WORK}/staging-root/." "${IMAGE}/"

    dodir /usr/$(exhost --target)/bin
    edo mv "${IMAGE}/usr/sbin/ufw" "${IMAGE}/usr/$(exhost --target)/bin/ufw"
    edo rmdir "${IMAGE}/usr/sbin"
    edo sed -i "1c#! /usr/$(exhost --target)/bin/python$(python_get_abi)" \
        "${IMAGE}/usr/$(exhost --target)/bin/ufw"

    insinto /usr/share/bash-completion/completions
    newins shell-completion/bash ufw
    install_systemd_files
    keepdir /etc/ufw/user
    dodoc README
    python_bytecompile
}

pkg_postinst() {
    ewarn "Allow remote SSH before enabling UFW; enabling it can interrupt your connection."
}