From: Roy Marples Date: Sat, 10 Mar 2007 23:04:51 +0000 (+0000) Subject: Remove bashisms from init script, #170085 thanks to Natanael Copa. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a17d9476ddabd5f1a7f196492da9b384ed5c8ce7;p=gentoo.git Remove bashisms from init script, #170085 thanks to Natanael Copa. Package-Manager: portage-2.1.2.2 --- 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 files/iptables-1.3.2.init: + Remove bashisms from init script, #170085 thanks to Natanael Copa. 08 Mar 2007; Gustavo Zacarias +files/iptables-1.3.7-sparc64.patch, iptables-1.3.7.ebuild: diff --git a/net-firewall/iptables/Manifest b/net-firewall/iptables/Manifest index 7c68fe30e653..7880bf6a5779 100644 --- a/net-firewall/iptables/Manifest +++ b/net-firewall/iptables/Manifest @@ -1,6 +1,3 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - AUX 1.3.1-files/grsecurity-1.2.8-iptables.patch-1.3.1 1315 RMD160 3665aaa6788261f16372c1e34810fe99fd60453c SHA1 b3c88dc5ceebc15aca73fcc02afdf8d0fa6a389f SHA256 f86e32f84af0e68b927b712a60e5d02d1bc27972537f476c71a311711fdcfc12 MD5 319d0b089a495ce1ab8ca02b3820dfe3 files/1.3.1-files/grsecurity-1.2.8-iptables.patch-1.3.1 1315 RMD160 3665aaa6788261f16372c1e34810fe99fd60453c files/1.3.1-files/grsecurity-1.2.8-iptables.patch-1.3.1 1315 @@ -37,10 +34,10 @@ AUX iptables-1.3.2.confd 290 RMD160 cb180068f86a608b16d850635ae909ea7b9cc059 SHA MD5 956ebf5ab69e5a1e1d3983541eab643b files/iptables-1.3.2.confd 290 RMD160 cb180068f86a608b16d850635ae909ea7b9cc059 files/iptables-1.3.2.confd 290 SHA256 351e123ba9e0ec7db2bcff42849aa627d29a3b2e77a47b82386f5e3a7e21bd30 files/iptables-1.3.2.confd 290 -AUX iptables-1.3.2.init 2548 RMD160 0f45a7dd2f1215d46b6e7d42d27da0d10c932c54 SHA1 693a6352917e80d23204939ca8d17b6aa2a151f1 SHA256 072857516e98886c151a69e8d384688308b72962aacef2bfdab4e502815c5a55 -MD5 f3deaed443d73190338f759c82ab9fd0 files/iptables-1.3.2.init 2548 -RMD160 0f45a7dd2f1215d46b6e7d42d27da0d10c932c54 files/iptables-1.3.2.init 2548 -SHA256 072857516e98886c151a69e8d384688308b72962aacef2bfdab4e502815c5a55 files/iptables-1.3.2.init 2548 +AUX iptables-1.3.2.init 2629 RMD160 9db2d7c479684cbc332ca3703c760810dc330326 SHA1 4c1e4aac41ce85d926dccd8f4c379b4d6ae58f02 SHA256 c9f41457b3331a99cd8e92139713207aff263602eaf8c0ada5474b7dd9ed4c55 +MD5 711e98fe93ceea9013d6efbaeb168859 files/iptables-1.3.2.init 2629 +RMD160 9db2d7c479684cbc332ca3703c760810dc330326 files/iptables-1.3.2.init 2629 +SHA256 c9f41457b3331a99cd8e92139713207aff263602eaf8c0ada5474b7dd9ed4c55 files/iptables-1.3.2.init 2629 AUX iptables-1.3.7-more-exact-check-grep.patch 602 RMD160 80c80f9d2a2567b164932adc1e9ddb1392b34791 SHA1 5bb693f7ddc641b793334d072b106ab998f4202e SHA256 aa26f352dc2b870363b7de1586105a4bf19eb9a6c6703a23f64ef9656017021d MD5 0b0e12c269db9fd7c8e9835f0a9fd3fa files/iptables-1.3.7-more-exact-check-grep.patch 602 RMD160 80c80f9d2a2567b164932adc1e9ddb1392b34791 files/iptables-1.3.7-more-exact-check-grep.patch 602 @@ -72,10 +69,10 @@ EBUILD iptables-1.3.7.ebuild 5753 RMD160 c780316245020b5fa7937f5ea8543ce5edae5f9 MD5 ad6ebb1dec2e024b6c751690596308b6 iptables-1.3.7.ebuild 5753 RMD160 c780316245020b5fa7937f5ea8543ce5edae5f9e iptables-1.3.7.ebuild 5753 SHA256 5140c1164cf1a06d6ef195124fd38f8e37b9b0126dc5fd879fdcb86c5f93254a iptables-1.3.7.ebuild 5753 -MISC ChangeLog 26729 RMD160 cd5b42eba24d1dceec97c499f060b48b6b0eb02d SHA1 a86b7ee70336fb92d1726cae867ea9fee0e6b9ea SHA256 72d82077ceb54d1059352a39c1187d5bcf4f6d67df6e07435a73b645528235a2 -MD5 2d6bab40a9f5a2c7b8786ffd07c6c01a ChangeLog 26729 -RMD160 cd5b42eba24d1dceec97c499f060b48b6b0eb02d ChangeLog 26729 -SHA256 72d82077ceb54d1059352a39c1187d5bcf4f6d67df6e07435a73b645528235a2 ChangeLog 26729 +MISC ChangeLog 26875 RMD160 b2fe0314bf6531755eddb5f098171b927ab32ccf SHA1 0c90a302feae4c029001aa1ccac8e12a3f5f9ea4 SHA256 afc08cf82686af9801f98b7bc7c20c5b21b4e89bb3a95ea4a997c9a4e125f7ee +MD5 258fb68ce08254db6a45d54a51d66ad9 ChangeLog 26875 +RMD160 b2fe0314bf6531755eddb5f098171b927ab32ccf ChangeLog 26875 +SHA256 afc08cf82686af9801f98b7bc7c20c5b21b4e89bb3a95ea4a997c9a4e125f7ee ChangeLog 26875 MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92 MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 metadata.xml 164 @@ -92,10 +89,3 @@ SHA256 b6cdf0da6f3681548aea7cd05500b00660b64d95f4d6d6196267c2535dc190d0 files/di MD5 1f40726055a119edf736bd7c7b5620e7 files/digest-iptables-1.3.7 759 RMD160 ee6a5537941ce5689ee0ef7e302b990a0222142c files/digest-iptables-1.3.7 759 SHA256 7d47914b31c063817423c4f38b8f047f2f9094f749991b37e12b3987f644d990 files/digest-iptables-1.3.7 759 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6-ecc01.6 (GNU/Linux) - -iD8DBQFF8FTqKRy60XGEcJIRApP5AJ0Vq4N4RoAmhpto79YvQ0UDV12b7QCfU4bs -Nfocb3tzR42IctpIPsRecmo= -=Uq0K ------END PGP SIGNATURE----- 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 $? }