More beautification of the generated script

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4779 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-11-01 16:32:18 +00:00
parent 5015d66dec
commit 4d6cf619fe
2 changed files with 19 additions and 11 deletions

View File

@ -967,12 +967,12 @@ delete_tc()
indent >&3 << __EOF__
ip link list | while read inx interface details; do
case \$inx in
[0-9]*)
qt tc qdisc del dev \${interface%:} root
qt tc qdisc del dev \${interface%:} ingress
;;
*)
;;
[0-9]*)
qt tc qdisc del dev \${interface%:} root
qt tc qdisc del dev \${interface%:} ingress
;;
*)
;;
esac
done
__EOF__
@ -4907,12 +4907,20 @@ __EOF__
}
#
# Post-process generated script
# Post-process generated script to:
#
# - Suppress redundant blank lines
# - Replace leading spaces with tabs
#
mycat()
{
if [ -n "$(mywhich awk)" ]; then
awk 'BEGIN {blnk=0;}; /^\s*$/ {blnk=1; next; }; { if (blnk == 1 ) { print ""; blnk=0; }; print; }' $*
local awk=$(mywhich awk)
if [ -n "$awk" ]; then
$awk 'BEGIN {blnk=0;}; \
/^\s*$/ {blnk=1; next; }; \
{ while (/^\t* /) sub(/ /, "\t" ); }; \
{ if (blnk == 1 ) { print ""; blnk=0; }; print; }' $*
else
cat $*
fi

View File

@ -55,8 +55,8 @@ ip route show table $duplicate | while read net route; do
*)
case \$(find_device \$route) in
`echo $copy\) | sed 's/ /|/g'`
run_ip route add table $number \$net \$route
;;
run_ip route add table $number \$net \$route
;;
esac
;;
esac