summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-03-10 23:04:51 +0000
committerRoy Marples <uberlord@gentoo.org>2007-03-10 23:04:51 +0000
commit69fc9b9a62e98d2adc5acb432f4ccd1378fc013b (patch)
treef0f0305a5a3ed86de3076d8c72dac94682decf6b /net-firewall
parentMarking stable on PPC & PPC64, bug #170333. PPC64 tested on 64UL with GCC 4.1.2 (diff)
downloadgentoo-2-69fc9b9a62e98d2adc5acb432f4ccd1378fc013b.tar.gz
gentoo-2-69fc9b9a62e98d2adc5acb432f4ccd1378fc013b.tar.bz2
gentoo-2-69fc9b9a62e98d2adc5acb432f4ccd1378fc013b.zip
Remove bashisms from init script, #170085 thanks to Natanael Copa.
(Portage version: 2.1.2.2)
Diffstat (limited to 'net-firewall')
-rw-r--r--net-firewall/iptables/ChangeLog5
-rwxr-xr-xnet-firewall/iptables/files/iptables-1.3.2.init45
2 files changed, 28 insertions, 22 deletions
diff --git a/net-firewall/iptables/ChangeLog b/net-firewall/iptables/ChangeLog
index 936adfb1880e..ba48a51ffb3f 100644
--- a/net-firewall/iptables/ChangeLog
+++ b/net-firewall/iptables/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for net-firewall/iptables
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/ChangeLog,v 1.128 2007/03/08 18:24:33 gustavoz Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/ChangeLog,v 1.129 2007/03/10 23:04:51 uberlord Exp $
+
+ 10 Mar 2007; Roy Marples <uberlord@gentoo.org> files/iptables-1.3.2.init:
+ Remove bashisms from init script, #170085 thanks to Natanael Copa.
08 Mar 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+files/iptables-1.3.7-sparc64.patch, iptables-1.3.7.ebuild:
diff --git a/net-firewall/iptables/files/iptables-1.3.2.init b/net-firewall/iptables/files/iptables-1.3.2.init
index 94f8338dc9d3..3339a3abdd4c 100755
--- a/net-firewall/iptables/files/iptables-1.3.2.init
+++ b/net-firewall/iptables/files/iptables-1.3.2.init
@@ -1,17 +1,17 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/files/iptables-1.3.2.init,v 1.4 2006/11/11 08:25:00 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/files/iptables-1.3.2.init,v 1.5 2007/03/10 23:04:51 uberlord Exp $
opts="save reload panic"
iptables_name=${SVCNAME}
-if [[ ${iptables_name} != "iptables" && ${iptables_name} != "ip6tables" ]] ; then
+if [ "${iptables_name}" != "iptables" -a "${iptables_name}" != "ip6tables" ] ; then
iptables_name="iptables"
fi
iptables_bin="/sbin/${iptables_name}"
-case ${iptables_name} in
+case "${iptables_name}" in
iptables) iptables_proc="/proc/net/ip_tables_names"
iptables_save=${IPTABLES_SAVE};;
ip6tables) iptables_proc="/proc/net/ip6_tables_names"
@@ -25,7 +25,7 @@ depend() {
set_table_policy() {
local chains table=$1 policy=$2
- case ${table} in
+ case "${table}" in
nat) chains="PREROUTING POSTROUTING OUTPUT";;
mangle) chains="PREROUTING INPUT FORWARD OUTPUT POSTROUTING";;
filter) chains="INPUT FORWARD OUTPUT";;
@@ -33,12 +33,12 @@ set_table_policy() {
esac
local chain
for chain in ${chains} ; do
- ${iptables_bin} -t ${table} -P ${chain} ${policy}
+ "${iptables_bin}" -t "${table}" -P "${chain}" "${policy}"
done
}
checkkernel() {
- if [[ ! -e ${iptables_proc} ]] ; then
+ if [ ! -e "${iptables_proc}" ] ; then
eerror "Your kernel lacks ${iptables_name} support, please load"
eerror "appropriate modules and try again."
return 1
@@ -46,7 +46,7 @@ checkkernel() {
return 0
}
checkconfig() {
- if [[ ! -f ${iptables_save} ]] ; then
+ if [ ! -f "${iptables_save}" ] ; then
eerror "Not starting ${iptables_name}. First create some rules then run:"
eerror "/etc/init.d/${iptables_name} save"
return 1
@@ -57,21 +57,22 @@ checkconfig() {
start() {
checkconfig || return 1
ebegin "Loading ${iptables_name} state and starting firewall"
- ${iptables_bin}-restore ${SAVE_RESTORE_OPTIONS} < "${iptables_save}"
+ "${iptables_bin}"-restore ${SAVE_RESTORE_OPTIONS} < "${iptables_save}"
eend $?
}
stop() {
- if [[ ${SAVE_ON_STOP} == "yes" ]] ; then
+ if [ "${SAVE_ON_STOP}" = "yes" ] ; then
save || return 1
fi
checkkernel || return 1
ebegin "Stopping firewall"
- for a in $(<${iptables_proc}) ; do
+ local a=
+ for a in $(cat "${iptables_proc}") ; do
set_table_policy $a ACCEPT
- ${iptables_bin} -F -t $a
- ${iptables_bin} -X -t $a
+ "${iptables_bin}" -F -t "$a"
+ "${iptables_bin}" -X -t "$a"
done
eend $?
}
@@ -79,9 +80,10 @@ stop() {
reload() {
checkkernel || return 1
ebegin "Flushing firewall"
- for a in $(<${iptables_proc}) ; do
- ${iptables_bin} -F -t $a
- ${iptables_bin} -X -t $a
+ local a=
+ for a in $(cat "${iptables_proc}") ; do
+ "${iptables_bin}" -F -t "$a"
+ "${iptables_bin}" -X -t "$a"
done
eend $?
@@ -92,20 +94,21 @@ save() {
ebegin "Saving ${iptables_name} state"
touch "${iptables_save}"
chmod 0600 "${iptables_save}"
- ${iptables_bin}-save ${SAVE_RESTORE_OPTIONS} > "${iptables_save}"
+ "${iptables_bin}"-save ${SAVE_RESTORE_OPTIONS} > "${iptables_save}"
eend $?
}
panic() {
checkkernel || return 1
- [[ -e ${svcdir}/started/${iptables_name} ]] && svc_stop
+ service_started "${iptables_name}" && svc_stop
+ local a=
ebegin "Dropping all packets"
- for a in $(<${iptables_proc}) ; do
- ${iptables_bin} -F -t $a
- ${iptables_bin} -X -t $a
+ for a in $(cat "${iptables_proc}") ; do
+ "${iptables_bin}" -F -t "$a"
+ "${iptables_bin}" -X -t "$a"
- set_table_policy $a DROP
+ set_table_policy "$a" DROP
done
eend $?
}