diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2018-05-05 01:22:06 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2018-05-05 01:23:58 +0200 |
commit | 61d1aa3b52e014eba8f662eaa00ad853ebf49298 (patch) | |
tree | 8d67562c74014f8f859e30fd8fc22ce40c773b82 /net-firewall/shorewall | |
parent | sys-apps/nix: bump up to 2.0.2 (diff) | |
download | gentoo-61d1aa3b52e014eba8f662eaa00ad853ebf49298.tar.gz gentoo-61d1aa3b52e014eba8f662eaa00ad853ebf49298.tar.bz2 gentoo-61d1aa3b52e014eba8f662eaa00ad853ebf49298.zip |
net-firewall/shorewall: Bump to v5.2.0.1
Package-Manager: Portage-2.3.34, Repoman-2.3.9
Diffstat (limited to 'net-firewall/shorewall')
-rw-r--r-- | net-firewall/shorewall/Manifest | 7 | ||||
-rw-r--r-- | net-firewall/shorewall/files/shorewall-5.2.0.1-AUTOMAKE-SAVE.patch | 47 | ||||
-rw-r--r-- | net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch | 46 | ||||
-rw-r--r-- | net-firewall/shorewall/files/shorewall-lite.initd-r3 | 90 | ||||
-rw-r--r-- | net-firewall/shorewall/files/shorewall.initd-r3 | 98 | ||||
-rw-r--r-- | net-firewall/shorewall/files/shorewallrc-r3 | 24 | ||||
-rw-r--r-- | net-firewall/shorewall/shorewall-5.2.0.1.ebuild | 462 |
7 files changed, 774 insertions, 0 deletions
diff --git a/net-firewall/shorewall/Manifest b/net-firewall/shorewall/Manifest index c8563a272b63..0a5c06134251 100644 --- a/net-firewall/shorewall/Manifest +++ b/net-firewall/shorewall/Manifest @@ -1,7 +1,14 @@ DIST shorewall-5.1.12.4.tar.bz2 555854 BLAKE2B 697fb7dbe4217b3a8d7230b3d79cec94f33ff69975b9f52477def8424e2ed9c79614e5aff4a40e31c2c0c69bc32f88c40810b7b1e5381037df1cf225b8bf97ec SHA512 25038865df0b3a4d1bcdb14b58108cd0f42e8738c3415ef2ce6fcbf3b15fc651fa90ce6adcfc3c67d6e0dd18709c4862a3ca18f1976e6c96567db6cdae86e000 +DIST shorewall-5.2.0.1.tar.bz2 535180 BLAKE2B 4e7e1d1f43b1bd5a9e683d6ab4e0dde5201dce0616c66c38b518838210bcc69c31a5bb586933ac3d83f8852704166cb7376dd07d8ee4d74e777c483a5178db34 SHA512 9896836e709f728a2320c805cae588dbea37621587bbb0f11937be911c80d0302f63a230642089cdb9839cc55f16b67341392c5d76a71406e0cfadb7b99b4cc5 DIST shorewall-core-5.1.12.4.tar.bz2 86548 BLAKE2B 8384c2f8ec673db3f0fed04af702e1967d41133f3a066ba09cbd58199654878d4d6c73730a933525304d68f7834c80d5c2a2452a4dd6faa71e2580deadf3189e SHA512 f77ae4080fa81a3259ab620ba7615c4188e6bec0244e898702dc641aacd8ac54160331e270b3708d818bfa9452cf96014868199a48c28f15c50d128365cb62e6 +DIST shorewall-core-5.2.0.1.tar.bz2 74523 BLAKE2B b4b204a9802a3fd0a69498acd7bb52a0fe0010a38df6feca5c98f15150e3924346911862745950269af60dd4ee2102a8e935a5c8d9f26edc8e726203bb8c3df2 SHA512 ebb184b33ade8111b961679c3aa90907ddc23410c17dd1fe49848425c465725a5f4c24f6bfbd158e759df6f651046db30120310a3edd7e594399721770cc9471 DIST shorewall-docs-html-5.1.12.4.tar.bz2 4281202 BLAKE2B 51624bf6a36766fa8f1aad9600885dc2b92f656ef3a7bc6cf3704a33d2e014af590bbe1621793bd77d291baa3441a0f493c27f838159ccbb15b0684ab26f4bef SHA512 e1592137013b463a7cbd28c7354f51b36460c054d55e1819198b72c600ccbdc8b3fee4bab33d7a71466397338bd38e0aa6312f1c182e79052f249c51d1017dc1 +DIST shorewall-docs-html-5.2.0.1.tar.bz2 4294859 BLAKE2B 317d1e014f94e040154617a355619317efed4c318e14a6c2a6cfabeb1ee2c5fb0bf49a7e9a80ca8ffbd5828798d33617fdcf18af0bc6ec8333a2a1b8231136c1 SHA512 52c5af9c682bbb233be3e779a45f7d09ca874849e6a118271bf90d6791cceaa31740dee8cdfd08a50807565fb9f8d6191ca1096ab31d1419b7088668c349c71c DIST shorewall-init-5.1.12.4.tar.bz2 41541 BLAKE2B 149b31b2ffd37c64cfc69de7d2d3a39824ce427a98a84f4e96af02aad9e04f0973f862ea0b158245a1d806504dc0dac9a5a554776d9533a7c88dbf6c096d4d07 SHA512 971f0a7a25f49c289e9c9d6d564e05b7f2675d271ef95c15b06a4a4e878a74c5b13a1ea80411014a5130f53267df6691042b313c423db193b9cd6cde172ed359 +DIST shorewall-init-5.2.0.1.tar.bz2 29381 BLAKE2B 6c0c937a8fd7499ce07f9ef0f1ef07c892e3d0585e2d29506377ca311ffa5939160aa62bd4e9602d346bfec2698865228ba69cdfbf6229520288485ced1e7f39 SHA512 ce9ba1a8bec5823650022f80db70b60930fa4b5c65462e4e8317f71ee467f75ff3af2b658c1d3bbe0cb7cb41acd4226cb2cfb657afde1375740c737f4528256f DIST shorewall-lite-5.1.12.4.tar.bz2 47209 BLAKE2B ca39daa7a864b86cd9075f8604d053984ef8c451285520c568b83171163513bdbe7f910b21638f4f69e716d4bdbb4f148856b02dbe83392789d8b962669374e1 SHA512 1bcdb90fccc634103ff190be9a058abf1b5158d562702c8c1ad51e8edebc2939271f3279bcb0fd8ff7389ea175387ce5a090a0d9e5655524a11203b5c0d55604 +DIST shorewall-lite-5.2.0.1.tar.bz2 35244 BLAKE2B b4983c21bb46c684adecb4d771839bc4a31a6737827e68944e75752fc4296aa458f24f9cdba46f19d09308634b00368e7fe5ec7a6417c1348cc083f7d8d437c0 SHA512 5562c41993a6047b5a334ab26d296df836976749da24796f005e12afc1e987b4f784ec25ffe176c81b8e9f129930c91a5869335d15eca649bb7a03c214b700ad DIST shorewall6-5.1.12.4.tar.bz2 197179 BLAKE2B 1c120388d0b8eafdbf6ec2fb64a8cc3e1e301dd109bb03f5dcfce60c534489210f669327eaa07bac5fbc7497e39c9167586f02017318ce9a2b054b4a39e4ae50 SHA512 9ff09b093f641452d3c5d615163336c903c74d4133cd620982760df6b8ee3acc704c460adb5db52b109f768d623152e47617c7d05742c2e6f19527c34eec9a61 +DIST shorewall6-5.2.0.1.tar.bz2 184727 BLAKE2B ff9502e2ff84af146ba42cbfe4a7e383e6e2c56f43cd53c21085908660c672d8e579fd8615f841a202bb6bd796d434f7a462d684e45496880599902a3a3a0acb SHA512 dd34968d2e074e0460aeb562a2c4ab857e6c9a680d4d9f41cf006bfddfffc647d472693401c6a8f03da25af2f1117ae61c640fa7db099af3e5b5cd27be74ecef DIST shorewall6-lite-5.1.12.4.tar.bz2 46902 BLAKE2B 6e9bad615833beacbb0d4b779dc8479cad73c1964bc2220541419b99a7fc8dd1b57ca42d61d6ef708460beffa65106166dbd5c60a90ce7f4cdf60ce3a879defb SHA512 95b5b96b3744bd1a499d00b4f98d71b264369752e6fd9ede21717657785833d1124b97434fe33457bc6f80026b204eb9306d73af9eb8abf23840291ecc1caf32 +DIST shorewall6-lite-5.2.0.1.tar.bz2 34931 BLAKE2B 94155a21be8d8aba07d9742b2d92428285588dbf33f1b522644dd7be4a05dd25b93ad4d3bbc3fd147f544a7d9ce8bf01dbadaee642bcb014f43aef6ba61f1596 SHA512 dc2f1c61efd8673335b117771baf8cec2145b5afc4a6b74b80834daa321f22475e2ec9baa23358c5e2d4787b5ec1cc092b17617cdfe9a921bd0075328eb0cdd5 diff --git a/net-firewall/shorewall/files/shorewall-5.2.0.1-AUTOMAKE-SAVE.patch b/net-firewall/shorewall/files/shorewall-5.2.0.1-AUTOMAKE-SAVE.patch new file mode 100644 index 000000000000..2927d4c17ab9 --- /dev/null +++ b/net-firewall/shorewall/files/shorewall-5.2.0.1-AUTOMAKE-SAVE.patch @@ -0,0 +1,47 @@ +diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli +index 0e2de1525..60499180d 100644 +--- a/Shorewall-core/lib.cli ++++ b/Shorewall-core/lib.cli +@@ -1201,11 +1201,17 @@ show_saves_command() { + echo + + for f in ${VARDIR}/*-iptables; do +- fn=$(basename $f) +- fn=${fn%-iptables} +- mtime=$(ls -lt $f | tail -n 1 | cut -d ' ' -f '6 7 8' ) +- [ $fn = "$RESTOREFILE" ] && fn="$fn (default)" +- echo " $mtime ${fn%-iptables}" ++ case $f in ++ *\**) ++ ;; ++ *) ++ fn=$(basename $f) ++ fn=${fn%-iptables} ++ mtime=$(ls -lt $f | tail -n 1 | cut -d ' ' -f '6 7 8' ) ++ [ $fn = "$RESTOREFILE" ] && fn="$fn (default)" ++ echo " $mtime ${fn%-iptables}" ++ ;; ++ esac + done + + echo +diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std +index 2d8c7df67..46c932335 100644 +--- a/Shorewall/lib.cli-std ++++ b/Shorewall/lib.cli-std +@@ -412,10 +412,14 @@ uptodate() { + elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print)" ]; then + return 1; + fi +- elif [ $AUTOMAKE = recursive ]; then ++ elif [ "$AUTOMAKE" = recursive ]; then + if [ -n "$(${find} ${dir} -newer $1 -print -quit)" ]; then + return 1; + fi ++ elif [ -z "$AUTOMAKE" ]; then ++ if [ -n "$(${find} ${dir} -maxdepth 1 -type f -newer $1 -print -quit)" ]; then ++ return 1; ++ fi + elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print -quit)" ]; then + return 1; + fi diff --git a/net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch b/net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch new file mode 100644 index 000000000000..91791e01c4d4 --- /dev/null +++ b/net-firewall/shorewall/files/shorewall-5.2.0.1-YESNO.patch @@ -0,0 +1,46 @@ +diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std +index 9896e18d4..2d8c7df67 100644 +--- a/Shorewall/lib.cli-std ++++ b/Shorewall/lib.cli-std +@@ -1063,6 +1063,41 @@ restart_command() { + return $rc + } + ++read_yesno_with_timeout() { ++ local timeout ++ timeout=${1:-60} ++ ++ case $timeout in ++ *s) ++ ;; ++ *m) ++ timeout=$((${timeout%m} * 60)) ++ ;; ++ *h) ++ timeout=$((${timeout%h} * 3600)) ++ ;; ++ esac ++ ++ read -t $timeout yn 2> /dev/null ++ if [ $? -eq 2 ] ++ then ++ # read doesn't support timeout ++ test -x /bin/bash || return 2 # bash is not installed so the feature is not available ++ /bin/bash -c "read -t $timeout yn ; if [ \"\$yn\" == \"y\" ] ; then exit 0 ; else exit 1 ; fi" # invoke bash and use its version of read ++ return $? ++ else ++ # read supports timeout ++ case "$yn" in ++ y|Y) ++ return 0 ++ ;; ++ *) ++ return 1 ++ ;; ++ esac ++ fi ++} ++ + # + # Safe-start/safe-reload/safe-restart Command Executor + # diff --git a/net-firewall/shorewall/files/shorewall-lite.initd-r3 b/net-firewall/shorewall/files/shorewall-lite.initd-r3 new file mode 100644 index 000000000000..ee304926f97c --- /dev/null +++ b/net-firewall/shorewall/files/shorewall-lite.initd-r3 @@ -0,0 +1,90 @@ +#!/sbin/openrc-run +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +if [ "${RC_SVCNAME}" = "shorewall6-lite" ]; then + PRODUCT_NAME="Shorewall6-Lite" + command="/usr/sbin/shorewall-lite -6" +else + PRODUCT_NAME="Shorewall-Lite" + command="/usr/sbin/shorewall-lite" +fi + +description="The Shoreline Firewall Lite, more commonly known as \"${PRODUCT_NAME}\", is" +description="${description} a high-level tool for configuring Netfilter." + +extra_commands="clear" +extra_started_commands="reload reset" + +description_clear="Clear will remove all rules and chains installed by" +description_clear="${description_clear} ${PRODUCT_NAME}. The firewall is" +description_clear="${description_clear} then wide open and unprotected." + +description_reload="Reload is similar to \"${RC_SERVICE} start\" except that it assumes" +description_reload="${description_reload} that the firewall is already started." +description_reload="${description_reload} Existing connections are maintained." + +description_reset="All the packet and byte counters in the firewall are reset." + +depend() { + provide firewall + after ulogd +} + +clear() { + ebegin "Clearing all ${RC_SVCNAME} rules and setting policy to ACCEPT" + ${command} ${OPTIONS} clear 1>/dev/null + eend $? +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + ${command} ${OPTIONS} reload ${RELOADOPTIONS} 1>/dev/null + eend $? +} + +reset() { + ebegin "Resetting the packet and byte counters in ${RC_SVCNAME}" + ${command} ${OPTIONS} reset 1>/dev/null + eend $? +} + +restart() { + local _retval + ebegin "Restarting ${RC_SVCNAME}" + ${command} status 1>/dev/null + _retval=$? + if [ ${_retval} = '0' ]; then + svc_start + else + ${command} ${OPTIONS} restart ${RESTARTOPTIONS} 1>/dev/null + fi + eend $? +} + +start() { + ebegin "Starting ${RC_SVCNAME}" + ${command} ${OPTIONS} start ${STARTOPTIONS} 1>/dev/null + eend $? +} + +status() { + local _retval + ${command} status 1>/dev/null + _retval=$? + if [ ${_retval} = '0' ]; then + einfo 'status: started' + mark_service_started "${SVCNAME}" + return 0 + else + einfo 'status: stopped' + mark_service_stopped "${SVCNAME}" + return 3 + fi +} + +stop() { + ebegin "Stopping ${RC_SVCNAME}" + ${command} ${OPTIONS} stop ${STOPOPTIONS} 1>/dev/null + eend $? +} diff --git a/net-firewall/shorewall/files/shorewall.initd-r3 b/net-firewall/shorewall/files/shorewall.initd-r3 new file mode 100644 index 000000000000..a67948155817 --- /dev/null +++ b/net-firewall/shorewall/files/shorewall.initd-r3 @@ -0,0 +1,98 @@ +#!/sbin/openrc-run +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +if [ "${RC_SVCNAME}" = "shorewall6" ]; then + PRODUCT_NAME="Shorewall6" + command="/usr/sbin/shorewall -6" +else + PRODUCT_NAME="Shorewall" + command="/usr/sbin/shorewall" +fi + +description="The Shoreline Firewall, more commonly known as \"${PRODUCT_NAME}\", is" +description="${description} a high-level tool for configuring Netfilter." + +extra_commands="check clear" +extra_started_commands="reload reset" + +description_check="Checks if the configuration will compile or not." + +description_clear="Clear will remove all rules and chains installed by" +description_clear="${description_clear} ${PRODUCT_NAME}. The firewall is then" +description_clear="${description_clear} wide open and unprotected." + +description_reload="Reload is similar to \"${RC_SERVICE} start\" except that it assumes" +description_reload="${description_reload} that the firewall is already started." +description_reload="${description_reload} Existing connections are maintained." + +description_reset="All the packet and byte counters in the firewall are reset." + +depend() { + provide firewall + after ulogd +} + +check() { + ebegin "Checking ${RC_SVCNAME} configuration" + ${command} ${OPTIONS} check 1>/dev/null + eend $? +} + +clear() { + ebegin "Clearing all ${RC_SVCNAME} rules and setting policy to ACCEPT" + ${command} ${OPTIONS} clear 1>/dev/null + eend $? +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + ${command} ${OPTIONS} reload ${RELOADOPTIONS} 1>/dev/null + eend $? +} + +reset() { + ebegin "Resetting the packet and byte counters in ${RC_SVCNAME}" + ${command} ${OPTIONS} reset 1>/dev/null + eend $? +} + +restart() { + local _retval + ebegin "Restarting ${RC_SVCNAME}" + ${command} status 1>/dev/null + _retval=$? + if [ ${_retval} = '0' ]; then + svc_start + else + ${command} ${OPTIONS} restart ${RESTARTOPTIONS} 1>/dev/null + fi + eend $? +} + +start() { + ebegin "Starting ${RC_SVCNAME}" + ${command} ${OPTIONS} start ${STARTOPTIONS} 1>/dev/null + eend $? +} + +status() { + local _retval + ${command} status 1>/dev/null + _retval=$? + if [ ${_retval} = '0' ]; then + einfo 'status: started' + mark_service_started "${SVCNAME}" + return 0 + else + einfo 'status: stopped' + mark_service_stopped "${SVCNAME}" + return 3 + fi +} + +stop() { + ebegin "Stopping ${RC_SVCNAME}" + ${command} ${OPTIONS} stop ${STOPOPTIONS} 1>/dev/null + eend $? +} diff --git a/net-firewall/shorewall/files/shorewallrc-r3 b/net-firewall/shorewall/files/shorewallrc-r3 new file mode 100644 index 000000000000..a0ed9f7f0495 --- /dev/null +++ b/net-firewall/shorewall/files/shorewallrc-r3 @@ -0,0 +1,24 @@ +# +# Gentoo Shorewall 5.2 rc file +# +BUILD=gentoo #Default is to detect the build system +HOST=gentoo #Gentoo GNU Linux +PREFIX=@GENTOO_PORTAGE_EPREFIX@/usr #Top-level directory for shared files, libraries, etc. +SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. +LIBEXECDIR=${PREFIX}/share #Directory for executable scripts. +PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory +CONFDIR=@GENTOO_PORTAGE_EPREFIX@/etc #Directory where subsystem configurations are installed +SBINDIR=${PREFIX}/sbin #Directory where system administration programs are installed +MANDIR=${PREFIX}/share/man #Directory where manpages are installed. +INITDIR=${CONFDIR}/init.d #Directory where SysV init scripts are installed. +INITFILE=${PRODUCT} #Name of the product's installed SysV init script +INITSOURCE=init.gentoo.sh #Name of the distributed file to be installed as the SysV init script +ANNOTATED= #If non-zero, annotated configuration files are installed +SERVICEDIR=tbs #Directory where .service files are installed (systems running systemd only) +SERVICEFILE=gentoo.service #Name of the distributed file to be installed as systemd service file +SYSCONFFILE=default.gentoo #Name of the distributed file to be installed in $SYSCONFDIR +SYSCONFDIR=${CONFDIR}/conf.d #Directory where SysV init parameter files are installed +SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR +VARLIB=@GENTOO_PORTAGE_EPREFIX@/var/lib #Directory where product variable data is stored. +VARDIR=${VARLIB}/${PRODUCT} #Directory where product variable data is stored. +DEFAULT_PAGER=${PAGER} #Pager to use if none specified in shorewall[6].conf diff --git a/net-firewall/shorewall/shorewall-5.2.0.1.ebuild b/net-firewall/shorewall/shorewall-5.2.0.1.ebuild new file mode 100644 index 000000000000..ef57ddf2042b --- /dev/null +++ b/net-firewall/shorewall/shorewall-5.2.0.1.ebuild @@ -0,0 +1,462 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +inherit linux-info prefix systemd versionator + +DESCRIPTION='A high-level tool for configuring Netfilter' +HOMEPAGE="http://www.shorewall.net/" +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=$(get_version_component_range 1-2) +MY_MAJORMINOR_RELEASE_NUMBER=$(get_version_component_range 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/' + + _tmp_last_index=$(($(get_last_version_component_index ${MY_PV})+1)) + _tmp_suffix=$(get_version_component_range ${_tmp_last_index} ${MY_PV}) + if [[ ${_tmp_suffix} = *Beta* ]] || [[ ${_tmp_suffix} = *RC* ]]; then + MY_URL_SUFFIX="-${_tmp_suffix}" + fi + + # Cleaning up temporary variables + unset _tmp_last_index + unset _tmp_suffix +else + KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86" +fi + +SRC_URI=" + http://www.shorewall.net/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-core-${MY_PV}.tar.bz2 + ipv4? ( http://www.shorewall.net/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-${MY_PV}.tar.bz2 ) + ipv6? ( http://www.shorewall.net/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall6-${MY_PV}.tar.bz2 ) + lite4? ( http://www.shorewall.net/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-lite-${MY_PV}.tar.bz2 ) + lite6? ( http://www.shorewall.net/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall6-lite-${MY_PV}.tar.bz2 ) + init? ( http://www.shorewall.net/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}${MY_URL_SUFFIX}/shorewall-init-${MY_PV}.tar.bz2 ) + doc? ( http://www.shorewall.net/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 http://shorewall.net/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." + + 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 + + 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 + + # 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 + + eapply "${FILESDIR}"/shorewall-5.2.0.1-YESNO.patch + eapply "${FILESDIR}"/shorewall-5.2.0.1-AUTOMAKE-SAVE.patch + 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 + 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 + 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 + 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 + + cd "${S}"/${MY_PN_INIT} || die + eapply -p2 "${FILESDIR}"/shorewall-init-01_remove-ipset-functionality-r1.patch + cd "${S}" || 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="${D%/}" ${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="${D%/}" ${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="${D%/}" ${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="${D%/}" ${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="${D%/}" ${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="${D%/}" ${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 "${D}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 \"${D}etc/logrotate.d/shorewall-init\" ..." + rm -rf "${D}"etc/logrotate.d/shorewall-init || die "Removing \"${D}etc/logrotate.d/shorewall-init\" failed" + fi + + if [[ -d "${D}etc/NetworkManager" ]]; then + # On Gentoo, we don't support NetworkManager + # so we don't need this folder at all + einfo "Removing unused \"${D}etc/NetworkManager\" ..." + rm -rf "${D}"etc/NetworkManager || die "Removing \"${D}etc/NetworkManager\" failed" + fi + + if [[ -f "${D}usr/share/shorewall-init/ifupdown" ]]; then + # This script isn't supported on Gentoo + rm -rf "${D}"usr/share/shorewall-init/ifupdown || die "Removing \"${D}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 " http://shorewall.net/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 " - http://shorewall.net/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 " http://www.shorewall.net/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 +} |