summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am5
-rw-r--r--etc/bash_completion.d/10vyatta-op14
-rwxr-xr-xscripts/vyatta-show-dmesg4
-rwxr-xr-xscripts/vyatta-show-dmesg-all9
-rwxr-xr-xscripts/vyatta-show-log4
-rwxr-xr-xscripts/vyatta-show-log-all9
-rwxr-xr-xscripts/vyatta-show-log-file13
-rw-r--r--templates/show/log/all/node.def2
-rw-r--r--templates/show/log/file/node.tag/node.def4
-rw-r--r--templates/show/log/node.def2
-rw-r--r--templates/show/system/boot-messages/all/node.def2
-rw-r--r--templates/show/system/boot-messages/node.def2
12 files changed, 15 insertions, 55 deletions
diff --git a/Makefile.am b/Makefile.am
index 5d973f9..a09f4d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,11 +15,6 @@ bin_SCRIPTS = scripts/vyatta-show-interfaces
bin_SCRIPTS += scripts/vyatta-show-interfaces.pl
bin_SCRIPTS += scripts/vyatta-show-version
bin_SCRIPTS += scripts/vyatta-show-dhclient.pl
-bin_SCRIPTS += scripts/vyatta-show-log
-bin_SCRIPTS += scripts/vyatta-show-log-all
-bin_SCRIPTS += scripts/vyatta-show-log-file
-bin_SCRIPTS += scripts/vyatta-show-dmesg
-bin_SCRIPTS += scripts/vyatta-show-dmesg-all
bin_SCRIPTS += scripts/vyatta-show-dmi
bin_sudo_users_SCRIPTS = scripts/vyatta-identify-interface.pl
diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/10vyatta-op
index ebff99f..b0d5dc9 100644
--- a/etc/bash_completion.d/10vyatta-op
+++ b/etc/bash_completion.d/10vyatta-op
@@ -19,17 +19,20 @@
#
# **** End License ****
-test -z "$_vyatta_default_pager" && \
- declare -r _vyatta_default_pager="less\
+test -z "$_vyatta_less_options" && \
+ declare -r _vyatta_less_options="\
--QUIT-AT-EOF\
--quit-if-one-screen\
--LONG-PROMPT\
--RAW-CONTROL-CHARS\
--squeeze-blank-lines\
+ --no-init"
+test -z "$_vyatta_default_pager" && \
+ declare -r _vyatta_default_pager="less
--buffers=64\
--auto-buffers\
- --no-init\
- --no-lessopen"
+ --no-lessopen\
+ $_vyatta_less_options"
declare -x VYATTA_PAGER=$_vyatta_default_pager
_vyatta_op_do_key_bindings ()
@@ -318,7 +321,8 @@ _vyatta_op_run ()
local run_cmd=$(_vyatta_op_get_node_def_field $tpath/node.def run)
local ret=0
if [ -n "$run_cmd" ]; then
- if [[ -t 1 && "$1" == "show" ]] ; then
+ if [[ -t 1 && "$1" == "show" && \
+ ! $run_cmd =~ ^\(less\|more\|most\|pager\|tail\).* ]] ; then
eval "($run_cmd) | ${VYATTA_PAGER:-cat}"
else
eval "$run_cmd"
diff --git a/scripts/vyatta-show-dmesg b/scripts/vyatta-show-dmesg
deleted file mode 100755
index 8a53a94..0000000
--- a/scripts/vyatta-show-dmesg
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-cat /var/log/dmes? /dev/null
-
diff --git a/scripts/vyatta-show-dmesg-all b/scripts/vyatta-show-dmesg-all
deleted file mode 100755
index d511ea0..0000000
--- a/scripts/vyatta-show-dmesg-all
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-shopt -s extglob nullglob
-
-declare -a zipped_files=($( printf "%s\n" /var/log/dmesg*.gz | sort -r ))
-declare -a plain_files=($( printf "%s\n" /var/log/dmesg!(*.gz) | sort -r ))
-
-[ ${#zipped_files[@]} -gt 0 ] && gunzip --stdout ${zipped_files[@]}
-[ ${#plain_files[@]} -gt 0 ] && cat ${plain_files[@]}
diff --git a/scripts/vyatta-show-log b/scripts/vyatta-show-log
deleted file mode 100755
index 10e46e5..0000000
--- a/scripts/vyatta-show-log
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-cat /var/log/messages
-
diff --git a/scripts/vyatta-show-log-all b/scripts/vyatta-show-log-all
deleted file mode 100755
index 126b7fc..0000000
--- a/scripts/vyatta-show-log-all
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-shopt -s extglob nullglob
-
-declare -a zipped_files=($( printf "%s\n" /var/log/messages*.gz | sort -r ))
-declare -a plain_files=($( printf "%s\n" /var/log/messages!(*.gz) | sort -r ))
-
-[ ${#zipped_files[@]} -gt 0 ] && gunzip --stdout ${zipped_files[@]}
-[ ${#plain_files[@]} -gt 0 ] && cat ${plain_files[@]}
diff --git a/scripts/vyatta-show-log-file b/scripts/vyatta-show-log-file
deleted file mode 100755
index caf8ac9..0000000
--- a/scripts/vyatta-show-log-file
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-if [[ "$1" == */* ]]; then
- echo "Invalid log file name"
- exit 1
-fi
-
-if [ -f "/var/log/user/$1" ]; then
- cat /var/log/user/$1
-else
- echo "No such log file"
-fi
-
diff --git a/templates/show/log/all/node.def b/templates/show/log/all/node.def
index 87e959b..8df54f5 100644
--- a/templates/show/log/all/node.def
+++ b/templates/show/log/all/node.def
@@ -1,2 +1,2 @@
help: Show contents of all master log files
-run: ${vyatta_bindir}/vyatta-show-log-all
+run: less $_vyatta_less_options -- `printf "%s\n" /var/log/messages* | sort -nr`
diff --git a/templates/show/log/file/node.tag/node.def b/templates/show/log/file/node.tag/node.def
index a5a1c9d..5b80669 100644
--- a/templates/show/log/file/node.tag/node.def
+++ b/templates/show/log/file/node.tag/node.def
@@ -1,5 +1,5 @@
help: Show contents of user-defined log file
allowed: local -a array ;
array=( /var/log/user/* ) ;
- echo -n ${array[@]##*/}
-run: ${vyatta_bindir}/vyatta-show-log-file "$4"
+ [ ${#array[@]} -gt 0 ] && echo -n ${array[@]##*/} || echo -n none
+run: less $_vyatta_less_options -- /var/log/user/$4
diff --git a/templates/show/log/node.def b/templates/show/log/node.def
index 5f61e1d..13fad84 100644
--- a/templates/show/log/node.def
+++ b/templates/show/log/node.def
@@ -1,2 +1,2 @@
help: Show contents of current master log file
-run: ${vyatta_bindir}/vyatta-show-log
+run: less $_vyatta_less_options /var/log/messages
diff --git a/templates/show/system/boot-messages/all/node.def b/templates/show/system/boot-messages/all/node.def
index b151fc2..d472c33 100644
--- a/templates/show/system/boot-messages/all/node.def
+++ b/templates/show/system/boot-messages/all/node.def
@@ -1,2 +1,2 @@
help: Show all kernel boot messages
-run: ${vyatta_bindir}/vyatta-show-dmesg-all
+run: less $_vyatta_less_options -- `printf "%s\n" /var/log/dmesg* | sort -nr`
diff --git a/templates/show/system/boot-messages/node.def b/templates/show/system/boot-messages/node.def
index 7cfe5d3..ee5ae38 100644
--- a/templates/show/system/boot-messages/node.def
+++ b/templates/show/system/boot-messages/node.def
@@ -1,2 +1,2 @@
help: Show most recent kernel boot messages
-run: ${vyatta_bindir}/vyatta-show-dmesg
+run: less $_vyatta_less_options /var/log/dmesg