More PAGER fixes

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-03-02 08:58:26 -08:00
parent 90d254f0c3
commit 90bc894200
2 changed files with 74 additions and 32 deletions

View File

@ -980,6 +980,63 @@ show_nat() {
$g_tool -t nat -L $g_ipt_options | $output_filter $g_tool -t nat -L $g_ipt_options | $output_filter
} }
show_raw() {
echo "$g_product $SHOREWALL_VERSION RAW Table at $g_hostname - $(date)"
echo
show_reset
$g_tool -t raw -L $g_ipt_options | $output_filter
}
show_rawpost() {
echo "$g_product $SHOREWALL_VERSION RAWPOST Table at $g_hostname - $(date)"
echo
show_reset
$g_tool -t rawpost -L $g_ipt_options | $output_filter
}
show_mangle() {
echo "$g_product $SHOREWALL_VERSION Mangle Table at $g_hostname - $(date)"
echo
show_reset
$g_tool -t mangle -L $g_ipt_options | $output_filter
}
show_classifiers_wrapper() {
echo "$g_product $SHOREWALL_VERSION Classifiers at $g_hostname - $(date)"
echo
show_classifiers
}
show_ip_addresses() {
echo "$g_product $SHOREWALL_VERSION IP at $g_hostname - $(date)"
echo
ip -$g_family addr list
}
show_routing_wrapper() {
echo "$g_product $SHOREWALL_VERSION Routing at $g_hostname - $(date)"
echo
show_routing
}
show_policies() {
echo "$g_product $SHOREWALL_VERSION Policies at $g_hostname - $(date)"
echo
[ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies
}
show_ipa() {
echo "$g_product $SHOREWALL_VERSION per-IP Accounting at $g_hostname - $(date)"
echo
perip_accounting
}
show_arptables() {
echo "$g_product $SHOREWALL_VERSION arptables at $g_hostname - $(date)"
echo
$arptables -L -n -v
}
show_macros() { show_macros() {
for directory in $(split $CONFIG_PATH); do for directory in $(split $CONFIG_PATH); do
temp= temp=
@ -1161,24 +1218,15 @@ show_command() {
;; ;;
raw) raw)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
eval { echo "$g_product $SHOREWALL_VERSION RAW Table at $g_hostname - $(date)" eval show_raw $g_pager
echo
show_reset
$g_tool -t raw -L $g_ipt_options | $output_filter } $g_pager
;; ;;
rawpost) rawpost)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
eval { echo "$g_product $SHOREWALL_VERSION RAWPOST Table at $g_hostname - $(date)" eval show_rawpost $g_pager
echo
show_reset
$g_tool -t rawpost -L $g_ipt_options | $output_filter } $g_pager
;; ;;
tos|mangle) tos|mangle)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
eval { echo "$g_product $SHOREWALL_VERSION Mangle Table at $g_hostname - $(date)" eval show_mangle $g_pager
echo
show_reset
$g_tool -t mangle -L $g_ipt_options | $output_filter } $g_pager
;; ;;
log) log)
[ $# -gt 2 ] && usage 1 [ $# -gt 2 ] && usage 1
@ -1202,9 +1250,7 @@ show_command() {
;; ;;
classifiers|filters) classifiers|filters)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
eval { echo "$g_product $SHOREWALL_VERSION Classifiers at $g_hostname - $(date)" eval show_classifiers_wrapper $g_pager
echo
show_classifiers } $g_pager
;; ;;
zones) zones)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
@ -1241,15 +1287,11 @@ show_command() {
;; ;;
ip) ip)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
eval { echo "$g_product $SHOREWALL_VERSION IP at $g_hostname - $(date)" eval show_ip_addresses $g_pager
echo
ip -$g_family addr list } $g_pager
;; ;;
routing) routing)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
eval { echo "$g_product $SHOREWALL_VERSION Routing at $g_hostname - $(date)" eval show_routing_wrapper $g_pager
echo
show_routing } $g_pager
;; ;;
config) config)
. ${g_sharedir}/configpath . ${g_sharedir}/configpath
@ -1278,16 +1320,12 @@ show_command() {
;; ;;
policies) policies)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
eval { echo "$g_product $SHOREWALL_VERSION Policies at $g_hostname - $(date)" eval show_policies $g_wrapper
echo
[ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies } $g_pager
;; ;;
ipa) ipa)
[ $g_family -eq 4 ] || usage 1 [ $g_family -eq 4 ] || usage 1
eval { echo "$g_product $SHOREWALL_VERSION per-IP Accounting at $g_hostname - $(date)"
echo
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
perip_accounting } $g_pager eval show_ipa $g_pager
;; ;;
marks) marks)
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
@ -1305,9 +1343,7 @@ show_command() {
[ $# -gt 1 ] && usage 1 [ $# -gt 1 ] && usage 1
resolve_arptables resolve_arptables
if [ -n "$arptables" -a -x $arptables ]; then if [ -n "$arptables" -a -x $arptables ]; then
eval { echo "$g_product $SHOREWALL_VERSION arptables at $g_hostname - $(date)" eval show_arptables $g_pager
echo
$arptables -L -n -v } $g_pager
else else
error_message "Cannot locate the arptables executable" error_message "Cannot locate the arptables executable"
fi fi
@ -3739,6 +3775,10 @@ get_config() {
[ -n "$g_pager" ] || fatal_error "PAGER=$PAGER does not exist" [ -n "$g_pager" ] || fatal_error "PAGER=$PAGER does not exist"
;; ;;
esac esac
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
g_pager="| $g_pager"
fi fi
lib=$(find_file lib.cli-user) lib=$(find_file lib.cli-user)

View File

@ -329,6 +329,8 @@ get_config() {
esac esac
[ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable" [ -x "$g_pager" ] || fatal_error "PAGER $g_pager is not executable"
g_pager="| $g_pager"
fi fi
lib=$(find_file lib.cli-user) lib=$(find_file lib.cli-user)