diff options
Diffstat (limited to 'net-firewall')
-rw-r--r-- | net-firewall/shorewall/Manifest | 7 | ||||
-rw-r--r-- | net-firewall/shorewall/shorewall-5.2.7.ebuild | 482 |
2 files changed, 489 insertions, 0 deletions
diff --git a/net-firewall/shorewall/Manifest b/net-firewall/shorewall/Manifest index 650ef17bfa0c..7839ef382584 100644 --- a/net-firewall/shorewall/Manifest +++ b/net-firewall/shorewall/Manifest @@ -1,14 +1,21 @@ DIST shorewall-5.2.6.1.tar.bz2 552329 BLAKE2B c4bfd10dd3c4c236761acde39bf9108c8c4d02b1304fc10432600506fefb5aed16c61bd9abc04308f4b5af1db8fea60a9e7cf663b110541bf7040f48d2194ecf SHA512 a9df0d53899e3b5d4590b6690c298ff99be3d0dd8d7a1147b0ed15b45c81c6533087f2edb2b5c670e63f3a171081d9a404b55b08506e61386a77c290c7ff4303 DIST shorewall-5.2.6.tar.bz2 584293 BLAKE2B 2efd724fe06da93e31e9c7f146f4cb860118765a9decbbde8ca4b54832fa97f0152eeee3e4d82c171ae6bf11c4541404935bba5597b293b454bb8dceb976b977 SHA512 fe769c3ee8b3800bd7a55e2296e7ddeef2682653352e7b06bf3fe26238a8791eb1bdb93c96dde8a06fa4485149679429135d9bc838e7a94c3cf4b07530590a36 +DIST shorewall-5.2.7.tar.bz2 585135 BLAKE2B 614a993d34927b6f976f8d783608832014e1e2c94d02f53904cc977d3a05cc7ef21bc3dd32545c11b705da7c84ca472f0dc2ec6438af6b60eb705f741d432269 SHA512 abe3f2bfa8944cdecf24e8a2b3bcc5a786bc6bafb1e85e10257f4ff3002689b1e0ed23ddf866f63ce301c6bec43959b6ce77bbbbe8ffeb0f48a18c858be226a2 DIST shorewall-core-5.2.6.1.tar.bz2 76036 BLAKE2B ab223fa97b11f06c9ab112a828b7eda86e355b706cac7e50e6e403157c8a0eea4ded0e5a4dada431b5bb7b76a6cb1e13d438a8b90ab10fd4d525a389d030410c SHA512 4676ecd743f814dd87c097f2533c69fa333651cf6144a31ac8f7da360dee392c1ae8843b948868a63d58cc7b267e0ecb1fedf7b7ed88cdaa86b6066b73bedd8b DIST shorewall-core-5.2.6.tar.bz2 75731 BLAKE2B aef68badb12dcb3c7e7a30b2aae7b0e2dda02c1449fbe71eec7cf513889653d8f026f29f62be39d45c6db61abbadc97c3e24fd8d211cc2773d915c4740e6fa27 SHA512 63448cbd6e7b6444ab11d0dc412469237818717f3e6847c8857c1bf4bc9079b1abfd5cf33d30826252bb990abf611d3a14427dd3e228ea1f97919de6ee10a36e +DIST shorewall-core-5.2.7.tar.bz2 76504 BLAKE2B 5456b0f844c3f1c99cd8a89dff58ab5cf86d085a763a8de3918c2cf6fb5e59779912fae103f8b4284ba7a2c474beb786422a5de77eb3a67480d1d6ee0b316839 SHA512 0ed2f2e05abafa60e5d1560c5ee8419e7a3d0afe20192597a1efd263cfbe9331369682d6caa22ebdda128a410197010bb4429a3fa1500f9ac06ce8afcc1e6cc8 DIST shorewall-docs-html-5.2.6.1.tar.bz2 4328494 BLAKE2B 9640a9ca63c9797f5318cf62ffd5c36c1e3c683c0b58ae99eb692a9eaaec4474a98d08c299a63fea09c779aaecbf189e9f93aa4a84c314bf62bae6830ee22dfa SHA512 374716993c25884a0aef2e1d6b261dab9dd64be5afb681489c3b40b4de05dd1dab93e0f34c1a74df7faffe27793d24d277865ad6a72b6c54f223ee1bce9b5a65 DIST shorewall-docs-html-5.2.6.tar.bz2 4310351 BLAKE2B 6ad3e461657d78c937c80968a5a3404359c6a86b16b2965997f2a37a8d0883b83b285cbb9bb824993d174203e31ccbd0aca811c9948649a438aedbc192bbf038 SHA512 123c84033fc0f470250be7f3cba19d371b658c8e9ec39f382827e5cb6218b3b5c0a730cddec13a3fd41dd3bb0ff94da24543452f59ce3119b2e161c1d9ed4151 +DIST shorewall-docs-html-5.2.7.tar.bz2 4316006 BLAKE2B a981e050501d7fa9bdd2ecfc3fba279989089b1e6977abc881c2bc04df698e88cf7260acb28a06ce90d296e17944140ab24af98914839717811f2eb6af84da33 SHA512 4e381ad8fe8db5fe614c6dd6e4b595539519091c4aac2f7aa7ff8655e97fa8d07bec651c428492f334f632968ad94e1c863aeb1888964d696aca011e980fcbc6 DIST shorewall-init-5.2.6.1.tar.bz2 41005 BLAKE2B e625569376c303fc5baab6e786ae5c13892c3b498421a369550de0e56a9207b5cf1d6838f7fdf9a0a344d6a1c62d102e4abc6414baec3bc96ad92f9399c74695 SHA512 9cf993217f40a3a948a58db1aca4dd76916e08e1dd0c4b2d23e1e416b24a7be53ef40e6358070b8c05a0b8bc44a0dacbf8b381c7fc2921ceed7df193c11e7578 DIST shorewall-init-5.2.6.tar.bz2 40640 BLAKE2B 746d72ba6c4d8fae116cef5180286f19f2ace7baa84a027a5f29305cd5a18323dcae316651fd066b71fe6bc9636c016856820215f306e0db1388394bfd15812c SHA512 e5e4e3f2ed24789c0483c93437b6cd41cabd8d3a7940f0c3f7d0b57c52b8a1fac43e073b09d18f5263f00dcd72912778c3230db93136c5cffd67cdbf63e57647 +DIST shorewall-init-5.2.7.tar.bz2 41377 BLAKE2B d39cf687ed4a5592fb8ea7b2d0a4b1313cb80ba81000e3692700a5a95d8035260991626c3e7466d3b9d1a9e8b3e61c559286f08b20494b81b59e5edbc8383378 SHA512 2dd81a4ae87496079990864a7b7a42814855d13210b996e3881e34d7cfb692035a2394adc912337800c72bc8565ae90426a0f1ddbf3e0384048a7c2d3e18aa43 DIST shorewall-lite-5.2.6.1.tar.bz2 45611 BLAKE2B f1da73d50b2ce4da8d3123f1cd2ebf4a76fc98613a8149aaf8a32ecca0358bd70d57438de30fda2559845975c9e95d35239f43341a45b210ae903ee176af700b SHA512 51f4354969e98dc3c6173d19d07d73b66d219a9e1cbbb5a2fcf5dcfbe0ecf421260b46c815cc7af6e3104b737082fdb0c48345af2228739c0bf880ad1179f5f6 DIST shorewall-lite-5.2.6.tar.bz2 45245 BLAKE2B 6b5b16b41ed8eaf3cfe4eeaa831e5a320b57579c072d5d64c051bf099c7e519bd7e8f659b483843e866ae39301284a13a45a257d284aac46bc921dea0bd043d5 SHA512 9c1f3c5729afa5bef6329b797530e2f428992eb235aec7213685b6568af81c5ff93e53182b5d5ef90ec3ba2c8ff8470c9a47b3f1988c90ef1ba125594a6d04c4 +DIST shorewall-lite-5.2.7.tar.bz2 45949 BLAKE2B 9d56d57c8bbf0d6478aa2b834750c6545fb323bb8ac513eb8df4f377ec70faa1c71c2105ac40bb5c88272bf56e34f39d93d41215b96b889a4fa9bd80339993ac SHA512 9e48d6d48a0a12577518a3b729cb2ad63e5be9a748fd58ef4c450d9f31527773f2fa790f38e7b1547257b49786a56dc293a16fe97b9c6eddd007edcd35efaee8 DIST shorewall6-5.2.6.1.tar.bz2 201076 BLAKE2B d41764a5a64bdc3cd86cdf80aaff89ad0bf9077267958d1c9de484f98a652ef42469964fb71b8841299b52e387605bfee1bca5df1ffc24ece9db5a999e09b09f SHA512 03444f976ba64c76eda866dbad6eaa61e766156fde6fcede31acc834ef9f6e45897538be54c99f62a0d6ae857f694921f7ee5d1f2f4209e37cff3f392554e8b0 DIST shorewall6-5.2.6.tar.bz2 202933 BLAKE2B 66cd897e6ae12a5efa5f857020a00f9455123bc767551072b9d6a7f48442c72bdb0bc7c323a9238a8adbf67f9360d14cf777036ba634e809c6103b3a0f1e7ced SHA512 0b64a0d709c8a621b9983b50dfb64d0374c545e59a08b46997be3249826c802b38e06be0248ee7d4ca1c2c207c21640a7152bec2df46f97ab301676237c48063 +DIST shorewall6-5.2.7.tar.bz2 203996 BLAKE2B b8b721d54c5aafae773d0d80b38106a17000793ff16f217ac6ec21f8702afe7a3fd8e99941056e508a8d8c93819e0e5644f1f8ce83c61dc6e3be49fb8fcd70c9 SHA512 039e0092770262f22ba08c2cfd536eccb9530da48306791fa6683e34c34f862001ca827dcb79b535243e68a24bffe92dbd866cf9d7ea8754161b5a8326a86d8e DIST shorewall6-lite-5.2.6.1.tar.bz2 45613 BLAKE2B 0c54e6d86d0831ddf3f38d96f32f6a76d57a646dabb9ec7e3d7fa1811d28aaf8dad308e98dadabb5696b228ce393889ec78ec7422d1148e96e3b435fef05d362 SHA512 bf2f4d15c5faf52c9fb1ed918ce3afeab6c1cc01e67758ca93ede3a507fa798a3751155f9145e672d987f2ed8f53f29fcc1f9590f6808c63d1c748a898365472 DIST shorewall6-lite-5.2.6.tar.bz2 45249 BLAKE2B 0498ae556d2b7f475f40fa0013df3ecea5ca5928b4df582419d2252f6f3e6500657731c687fced47584b3857c138a66eb0d8d90e552a3baf71411bc58510ad70 SHA512 7590765ae943567bc7b18dc18aedcc81ea5737f4a7992f33abdd6cf95dd893c6e2666a2d24e6692b6f531b0e62e5dadd98969b2344dcbf75ba26c650f345b823 +DIST shorewall6-lite-5.2.7.tar.bz2 45989 BLAKE2B ae698fb3b580bcc373958932d07b8e27bc805616dabe3b6cbf349fd29fa10299f91fffa6d1a74530b008d8806c62cdaf3868d1830cb3869bcfc6ca422cd9a2ef SHA512 c694c00c96e45d437e62ff600f85bb70b9431211ef9ff84753e880b165d694c5cd1a581a8163ed580cee78e790893b6239a8504b422554f14b4d4b7dd3c70601 diff --git a/net-firewall/shorewall/shorewall-5.2.7.ebuild b/net-firewall/shorewall/shorewall-5.2.7.ebuild new file mode 100644 index 000000000000..95a3c0906eab --- /dev/null +++ b/net-firewall/shorewall/shorewall-5.2.7.ebuild @@ -0,0 +1,482 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +inherit linux-info prefix systemd + +DESCRIPTION='A high-level tool for configuring Netfilter' +HOMEPAGE="https://shorewall.org/" +LICENSE="GPL-2" +SLOT="0" +IUSE="doc +init +ipv4 ipv6 lite4 lite6 selinux" + +MY_PV=${PV/_rc/-RC} +MY_PV=${MY_PV/_beta/-Beta} +MY_P=${PN}-${MY_PV} + +MY_MAJOR_RELEASE_NUMBER=$(ver_cut 1-2) +MY_MAJORMINOR_RELEASE_NUMBER=$(ver_cut 1-3) + +# shorewall +MY_PN_IPV4=Shorewall +MY_P_IPV4=${MY_PN_IPV4/#S/s}-${MY_PV} + +# shorewall6 +MY_PN_IPV6=Shorewall6 +MY_P_IPV6=${MY_PN_IPV6/#S/s}-${MY_PV} + +# shorewall-lite +MY_PN_LITE4=Shorewall-lite +MY_P_LITE4=${MY_PN_LITE4/#S/s}-${MY_PV} + +# shorewall6-lite +MY_PN_LITE6=Shorewall6-lite +MY_P_LITE6=${MY_PN_LITE6/#S/s}-${MY_PV} + +# shorewall-init +MY_PN_INIT=Shorewall-init +MY_P_INIT=${MY_PN_INIT/#S/s}-${MY_PV} + +# shorewall-core +MY_PN_CORE=Shorewall-core +MY_P_CORE=${MY_PN_CORE/#S/s}-${MY_PV} + +# shorewall-docs-html +MY_PN_DOCS=Shorewall-docs-html +MY_P_DOCS=${MY_PN_DOCS/#S/s}-${MY_PV} + +# Upstream URL schema: +# Beta: $MIRROR/pub/shorewall/development/4.6/shorewall-4.6.4-Beta2/shorewall-4.6.4-Beta2.tar.bz2 +# RC: $MIRROR/pub/shorewall/development/4.6/shorewall-4.6.4-RC1/shorewall-4.6.4-RC1.tar.bz2 +# Release: $MIRROR/pub/shorewall/4.6/shorewall-4.6.3/shorewall-4.6.3.3.tar.bz2 + +MY_URL_PREFIX= +MY_URL_SUFFIX= +if [[ ${MY_PV} = *-Beta* ]] || [[ ${MY_PV} = *-RC* ]]; then + MY_URL_PREFIX='development/' + + if [[ ${MY_PV} = *-Beta* ]] ; then + MY_URL_SUFFIX="-Beta${MY_PV##*-Beta}" + elif [[ ${MY_PV} = *-RC* ]] ; then + MY_URL_SUFFIX="-RC${MY_PV##*-RC}" + fi + + # Cleaning up temporary variables + unset _tmp_last_index + unset _tmp_suffix +else + KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86" +fi + +SRC_URI=" + https://shorewall.org/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-core-${MY_PV}.tar.bz2 + ipv4? ( https://shorewall.org/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-${MY_PV}.tar.bz2 ) + ipv6? ( https://shorewall.org/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall6-${MY_PV}.tar.bz2 ) + lite4? ( https://shorewall.org/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-lite-${MY_PV}.tar.bz2 ) + lite6? ( https://shorewall.org/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall6-lite-${MY_PV}.tar.bz2 ) + init? ( https://shorewall.org/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-init-${MY_PV}.tar.bz2 ) + doc? ( https://shorewall.org/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/${MY_P_DOCS}.tar.bz2 ) +" + +# - Shorewall6 requires Shorewall +# - Installing Shorewall-init or just the documentation doesn't make any sense, +# that's why we force the user to select at least one "real" Shorewall product +# +# See https://shorewall.org/download.htm#Which +REQUIRED_USE=" + ipv6? ( ipv4 ) + || ( ipv4 lite4 lite6 ) +" + +# No build dependencies! Just plain shell scripts... +DEPEND="" + +RDEPEND=" + >=net-firewall/iptables-1.4.20 + >=sys-apps/iproute2-3.8.0[-minimal] + >=sys-devel/bc-1.06.95 + ipv4? ( + >=dev-lang/perl-5.16 + virtual/perl-Digest-SHA + ) + ipv6? ( + >=dev-perl/Socket6-0.230.0 + >=net-firewall/iptables-1.4.20[ipv6] + >=sys-apps/iproute2-3.8.0[ipv6] + ) + lite6? ( + >=net-firewall/iptables-1.4.20[ipv6] + >=sys-apps/iproute2-3.8.0[ipv6] + ) + init? ( >=sys-apps/coreutils-8.20 ) + selinux? ( >=sec-policy/selinux-shorewall-2.20161023-r3 ) + !net-firewall/shorewall-core + !net-firewall/shorewall6 + !net-firewall/shorewall-lite + !net-firewall/shorewall6-lite + !net-firewall/shorewall-init + !<sys-apps/systemd-214 +" + +S=${WORKDIR} + +pkg_pretend() { + local CONFIG_CHECK="~NF_CONNTRACK" + + local WARNING_CONNTRACK="Without NF_CONNTRACK support, you will be unable" + local WARNING_CONNTRACK+=" to run any shorewall-based firewall on the local system." + + # kernel >=4.19 has unified NF_CONNTRACK module, bug 671176 + if kernel_is -lt 4 19; then + if use ipv4 || use lite4; then + CONFIG_CHECK="${CONFIG_CHECK} ~NF_CONNTRACK_IPV4" + + local WARNING_CONNTRACK_IPV4="Without NF_CONNTRACK_IPV4 support, you will" + local WARNING_CONNTRACK_IPV4+=" be unable to run any shorewall-based IPv4 firewall on the local system." + fi + + if use ipv6 || use lite6; then + CONFIG_CHECK="${CONFIG_CHECK} ~NF_CONNTRACK_IPV6" + + local WARNING_CONNTRACK_IPV6="Without NF_CONNTRACK_IPV6 support, you will" + local WARNING_CONNTRACK_IPV6+=" be unable to run any shorewall-based IPv6 firewall on the local system." + fi + fi + + check_extra_config +} + +pkg_setup() { + if [[ -n "${DIGEST}" ]]; then + einfo "Unsetting environment variable \"DIGEST\" to prevent conflicts with package's \"install.sh\" script ..." + unset DIGEST + fi +} + +src_prepare() { + # We are moving each unpacked source from MY_P_* to MY_PN_*. + # This allows us to use patches from upstream and keeps epatch_user working + + einfo "Preparing shorewallrc ..." + cp "${FILESDIR}"/shorewallrc-r3 "${S}"/shorewallrc.gentoo || die "Copying shorewallrc failed" + eprefixify "${S}"/shorewallrc.gentoo + sed -i \ + -e "s|SERVICEDIR=tbs|SERVICEDIR=$(systemd_get_systemunitdir)|" \ + "${S}"/shorewallrc.gentoo || die "Failed to update shorewallrc" + + # shorewall-core + mv "${S}"/${MY_P_CORE} "${S}"/${MY_PN_CORE} || die "Failed to move '${S}/${MY_P_CORE}' to '${S}/${MY_PN_CORE}'" + ebegin "Applying Gentoo-specific changes to ${MY_P_CORE} ..." + ln -s ../shorewallrc.gentoo ${MY_PN_CORE}/shorewallrc.gentoo || die "Failed to symlink shorewallrc.gentoo" + eend 0 + + pushd "${S}"/${MY_PN_CORE} &>/dev/null || die + eapply "${FILESDIR}"/shorewall-core-5.2.1-no-gzipped-manpages.patch + popd &>/dev/null || die + + # shorewall + if use ipv4; then + mv "${S}"/${MY_P_IPV4} "${S}"/${MY_PN_IPV4} || die "Failed to move '${S}/${MY_P_IPV4}' to '${S}/${MY_PN_IPV4}'" + ebegin "Applying Gentoo-specific changes to ${MY_P_IPV4}" + ln -s ../shorewallrc.gentoo ${MY_PN_IPV4}/shorewallrc.gentoo || die "Failed to symlink shorewallrc.gentoo" + cp "${FILESDIR}"/shorewall.confd-r1 "${S}"/${MY_PN_IPV4}/default.gentoo || die "Copying shorewall.confd-r1 failed" + cp "${FILESDIR}"/shorewall.initd-r3 "${S}"/${MY_PN_IPV4}/init.gentoo.sh || die "Copying shorewall.initd-r2 failed" + cp "${FILESDIR}"/shorewall.systemd "${S}"/${MY_PN_IPV4}/gentoo.service || die "Copying shorewall.systemd failed" + eend 0 + + pushd "${S}"/${MY_PN_IPV4} &>/dev/null || die + eapply "${FILESDIR}"/shorewall-5.2.1-no-gzipped-manpages.patch + popd &>/dev/null || die + fi + + # shorewall6 + if use ipv6; then + mv "${S}"/${MY_P_IPV6} "${S}"/${MY_PN_IPV6} || die "Failed to move '${S}/${MY_P_IPV6}' to '${S}/${MY_PN_IPV6}'" + ebegin "Applying Gentoo-specific changes to ${MY_P_IPV6}" + ln -s ../shorewallrc.gentoo ${MY_PN_IPV6}/shorewallrc.gentoo || die "Failed to symlink shorewallrc.gentoo" + cp "${FILESDIR}"/shorewall.confd-r1 "${S}"/${MY_PN_IPV6}/default.gentoo || die "Copying shorewall.confd-r1 failed" + cp "${FILESDIR}"/shorewall.initd-r3 "${S}"/${MY_PN_IPV6}/init.gentoo.sh || die "Copying shorewall.initd-r2 failed" + cp "${FILESDIR}"/shorewall6.systemd "${S}"/${MY_PN_IPV6}/gentoo.service || die "Copying shorewall6.systemd failed" + eend 0 + + pushd "${S}"/${MY_PN_IPV6} &>/dev/null || die + eapply "${FILESDIR}"/shorewall-5.2.1-no-gzipped-manpages.patch + popd &>/dev/null || die + fi + + # shorewall-lite + if use lite4; then + mv "${S}"/${MY_P_LITE4} "${S}"/${MY_PN_LITE4} || die "Failed to move '${S}/${MY_P_LITE4}' to '${S}/${MY_PN_LITE4}'" + ebegin "Applying Gentoo-specific changes to ${MY_P_LITE4}" + ln -s ../shorewallrc.gentoo ${MY_PN_LITE4}/shorewallrc.gentoo || die "Failed to symlink shorewallrc.gentoo" + cp "${FILESDIR}"/shorewall-lite.confd-r1 "${S}"/${MY_PN_LITE4}/default.gentoo || die "Copying shorewall-lite.confd-r1 failed" + cp "${FILESDIR}"/shorewall-lite.initd-r3 "${S}"/${MY_PN_LITE4}/init.gentoo.sh || die "Copying shorewall-lite.initd-r2 failed" + cp "${FILESDIR}"/shorewall-lite.systemd "${S}"/${MY_PN_LITE4}/gentoo.service || die "Copying shorewall-lite.systemd failed" + eend 0 + + pushd "${S}"/${MY_PN_LITE4} &>/dev/null || die + eapply "${FILESDIR}"/shorewall-lite-5.2.1-no-gzipped-manpages.patch + popd &>/dev/null || die + fi + + # shorewall6-lite + if use lite6; then + mv "${S}"/${MY_P_LITE6} "${S}"/${MY_PN_LITE6} || die "Failed to move '${S}/${MY_P_LITE6}' to '${S}/${MY_PN_LITE6}'" + ebegin "Applying Gentoo-specific changes to ${MY_P_LITE6}" + ln -s ../shorewallrc.gentoo ${MY_PN_LITE6}/shorewallrc.gentoo || die "Failed to symlink shorewallrc.gentoo" + cp "${FILESDIR}"/shorewall-lite.confd-r1 "${S}"/${MY_PN_LITE6}/default.gentoo || die "Copying shorewall-lite.confd-r1 failed" + cp "${FILESDIR}"/shorewall-lite.initd-r3 "${S}"/${MY_PN_LITE6}/init.gentoo.sh || die "Copying shorewall-lite.initd-r2 failed" + cp "${FILESDIR}"/shorewall6-lite.systemd "${S}"/${MY_PN_LITE6}/gentoo.service || die "Copying shorewall6-lite.systemd failed" + eend 0 + + pushd "${S}"/${MY_PN_LITE6} &>/dev/null || die + eapply "${FILESDIR}"/shorewall-lite-5.2.1-no-gzipped-manpages.patch + popd &>/dev/null || die + fi + + # shorewall-init + if use init; then + mv "${S}"/${MY_P_INIT} "${S}"/${MY_PN_INIT} || die "Failed to move '${S}/${MY_P_INIT}' to '${S}/${MY_PN_INIT}'" + ebegin "Applying Gentoo-specific changes to ${MY_P_INIT}" + ln -s ../shorewallrc.gentoo ${MY_PN_INIT}/shorewallrc.gentoo || die "Failed to symlink shorewallrc.gentoo" + cp "${FILESDIR}"/shorewall-init.confd "${S}"/${MY_PN_INIT}/default.gentoo || die "Copying shorewall-init.confd failed" + cp "${FILESDIR}"/shorewall-init.initd "${S}"/${MY_PN_INIT}/init.gentoo.sh || die "Copying shorewall-init.initd failed" + cp "${FILESDIR}"/shorewall-init.systemd "${S}"/${MY_PN_INIT}/gentoo.service || die "Copying shorewall-init.systemd failed" + cp "${FILESDIR}"/shorewall-init.readme "${S}"/${MY_PN_INIT}/shorewall-init.README.Gentoo.txt || die "Copying shorewall-init.systemd failed" + eend 0 + + eprefixify "${S}"/${MY_PN_INIT}/init.gentoo.sh + + pushd "${S}"/${MY_PN_INIT} &>/dev/null || die + eapply -p2 "${FILESDIR}"/shorewall-init-01_remove-ipset-functionality-r2.patch + popd &>/dev/null || die + fi + + # shorewall-docs-html + if use doc; then + mv "${S}"/${MY_P_DOCS} "${S}"/${MY_PN_DOCS} || die "Failed to move '${S}/${MY_P_DOCS}' to '${S}/${MY_PN_DOCS}'" + fi + + eapply_user +} + +src_configure() { + :; +} + +src_compile() { + :; +} + +src_install() { + # shorewall-core + einfo "Installing ${MY_P_CORE} ..." + DESTDIR="${ED}" ${MY_PN_CORE}/install.sh shorewallrc.gentoo || die "${MY_PN_CORE}/install.sh failed" + dodoc "${S}"/${MY_PN_CORE}/changelog.txt "${S}"/${MY_PN_CORE}/releasenotes.txt + + # shorewall + if use ipv4; then + einfo "Installing ${MY_P_IPV4} ..." + DESTDIR="${ED}" ${MY_PN_IPV4}/install.sh shorewallrc.gentoo || die "${MY_PN_IPV4}/install.sh failed" + keepdir /var/lib/shorewall + + if use doc; then + dodoc -r "${S}"/${MY_PN_IPV4}/Samples + fi + fi + + # shorewall6 + if use ipv6; then + einfo "Installing ${MY_P_IPV6} ..." + DESTDIR="${ED}" ${MY_PN_IPV6}/install.sh shorewallrc.gentoo || die "${MY_PN_IPV6}/install.sh failed" + keepdir /var/lib/shorewall6 + + if use doc; then + dodoc -r "${S}"/${MY_PN_IPV6}/Samples6 + fi + fi + + # shorewall-lite + if use lite4; then + einfo "Installing ${MY_P_LITE4} ..." + DESTDIR="${ED}" ${MY_PN_LITE4}/install.sh shorewallrc.gentoo || die "${MY_PN_LITE4}/install.sh failed" + keepdir /var/lib/shorewall-lite + fi + + # shorewall6-lite + if use lite6; then + einfo "Installing ${MY_P_LITE6} ..." + DESTDIR="${ED}" ${MY_PN_LITE6}/install.sh shorewallrc.gentoo || die "${MY_PN_LITE6}/install.sh failed" + keepdir /var/lib/shorewall6-lite + fi + + # shorewall-init + if use init; then + einfo "Installing ${MY_P_INIT} ..." + DESTDIR="${ED}" ${MY_PN_INIT}/install.sh shorewallrc.gentoo || die "${MY_PN_INIT}/install.sh failed" + dodoc "${S}"/${MY_PN_INIT}/shorewall-init.README.Gentoo.txt + + if [[ -f "${ED}/etc/logrotate.d/shorewall-init" ]]; then + # On Gentoo, shorewall-init will not create shorewall-ifupdown.log, + # so we don't need a logrotate configuration file for shorewall-init + einfo "Removing unused \"${ED}/etc/logrotate.d/shorewall-init\" ..." + rm -rf "${ED}"/etc/logrotate.d/shorewall-init || die "Removing \"${ED}/etc/logrotate.d/shorewall-init\" failed" + fi + + if [[ -d "${ED}/etc/NetworkManager" ]]; then + # On Gentoo, we don't support NetworkManager + # so we don't need this folder at all + einfo "Removing unused \"${ED}/etc/NetworkManager\" ..." + rm -rf "${ED}"/etc/NetworkManager || die "Removing \"${ED}/etc/NetworkManager\" failed" + fi + + if [[ -f "${ED}/usr/share/shorewall-init/ifupdown" ]]; then + # This script isn't supported on Gentoo + rm -rf "${ED}"/usr/share/shorewall-init/ifupdown || die "Removing \"${ED}/usr/share/shorewall-init/ifupdown\" failed" + fi + fi + + if use doc; then + einfo "Installing ${MY_P_DOCS} ..." + docinto html && dodoc -r "${S}"/${MY_PN_DOCS}/* + fi +} + +pkg_postinst() { + if [[ -z "${REPLACING_VERSIONS}" ]]; then + # This is a new installation + + # Show first steps for shorewall/shorewall6 + local _PRODUCTS="" + if use ipv4; then + _PRODUCTS="shorewall" + + if use ipv6; then + _PRODUCTS="${_PRODUCTS}/shorewall6" + fi + fi + + if [[ -n "${_PRODUCTS}" ]]; then + elog "Before you can use ${_PRODUCTS}, you need to edit its configuration in:" + elog "" + elog " /etc/shorewall/shorewall.conf" + + if use ipv6; then + elog " /etc/shorewall6/shorewall6.conf" + fi + + elog "" + elog "To activate your shorewall-based firewall on system start, please add ${_PRODUCTS} to your default runlevel:" + elog "" + elog " # rc-update add shorewall default" + + if use ipv6; then + elog " # rc-update add shorewall6 default" + fi + fi + + # Show first steps for shorewall-lite/shorewall6-lite + _PRODUCTS="" + if use lite4; then + _PRODUCTS="shorewall-lite" + fi + + if use lite6; then + if [[ -z "${_PRODUCTS}" ]]; then + _PRODUCTS="shorewall6-lite" + else + _PRODUCTS="${_PRODUCTS}/shorewall6-lite" + fi + fi + + if [[ -n "${_PRODUCTS}" ]]; then + if use ipv4; then + elog "" + fi + + elog "Before you can use ${_PRODUCTS}, you need to provide a configuration, which you can" + elog "create using ${CATEGORY}/shorewall (with \"ipv4\" and or \"ipv6\" USE flag)." + elog "" + elog "To read more about ${_PRODUCTS}, please visit" + elog " https://shorewall.org/CompiledPrograms.html" + elog "" + elog "To activate your shorewall-lite-based firewall on system start, please add ${PRODUCTS} to your default runlevel:" + elog "" + + if use lite4; then + elog " # rc-update add shorewall-lite default" + fi + + if use lite6; then + elog " # rc-update add shorewall6-lite default" + fi + fi + + if use init; then + elog "" + elog "To secure your system on boot, please add shorewall-init to your boot runlevel:" + elog "" + elog " # rc-update add shorewall-init boot" + elog "" + elog "and review \$PRODUCTS in" + elog "" + elog " /etc/conf.d/shorewall-init" + fi + + fi + + local v + for v in ${REPLACING_VERSIONS}; do + if ! version_is_at_least ${MY_MAJOR_RELEASE_NUMBER} ${v}; then + # This is an upgrade + + elog "You are upgrading from a previous major version. It is highly recommended that you read" + elog "" + elog " - /usr/share/doc/shorewall*/releasenotes.tx*" + elog " - https://shorewall.org/Shorewall-5.html#idm214" + + if use ipv4; then + elog "" + elog "You can auto-migrate your configuration using" + elog "" + elog " # shorewall update -A" + + if use ipv6; then + elog " # shorewall6 update -A" + fi + + elog "" + elog "*after* you have merged the changed files using one of the configuration" + elog "files update tools of your choice (dispatch-conf, etc-update...)." + + elog "" + elog "But if you are not familiar with the \"shorewall[6] update\" command," + elog "please read the shorewall[6] man page first." + fi + + # Show this elog only once + break + fi + done + + if ! use init; then + elog "" + elog "Consider emerging ${CATEGORY}/${PN} with USE flag \"init\" to secure your system on boot" + elog "before your shorewall-based firewall is ready to start." + elog "" + elog "To read more about shorewall-init, please visit" + elog " https://shorewall.org/Shorewall-init.html" + fi + + if ! has_version "net-firewall/conntrack-tools"; then + elog "" + elog "Your Shorewall firewall can utilize \"conntrack\" from the \"net-firewall/conntrack-tools\"" + elog "package. if you want to use this feature, you need to install \"net-firewall/conntrack-tools\"!" + fi + + if ! has_version "dev-perl/Devel-NYTProf"; then + elog "" + elog "If you want to profile your Shorewall firewall you need to install \"dev-perl/Devel-NYTProf\"!" + fi +} |