From 27607276527af5bbee1c07fd1967a5de8069b12d Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 10 Dec 2007 14:23:41 -0800 Subject: fix for bug 2527: add wrappers for boot-messages commands. --- scripts/vyatta-show-dmesg | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 scripts/vyatta-show-dmesg (limited to 'scripts') diff --git a/scripts/vyatta-show-dmesg b/scripts/vyatta-show-dmesg new file mode 100755 index 0000000..8a53a94 --- /dev/null +++ b/scripts/vyatta-show-dmesg @@ -0,0 +1,4 @@ +#!/bin/bash + +cat /var/log/dmes? /dev/null + -- cgit v1.2.3 From 688433f5c3da09c9de19fec8d6217764bb5a036c Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 10 Dec 2007 18:56:21 -0800 Subject: add wrappers/symlinks for pipe commands (wrappers are needed for command matching in restricted modes). --- Makefile.am | 4 ++++ debian/vyatta-op.postinst.in | 4 ++++ debian/vyatta-op.postrm.in | 4 ++++ etc/bash_completion.d/10vyatta-op | 2 -- scripts/count | 4 ++++ scripts/match | 4 ++++ scripts/no-match | 4 ++++ scripts/no-more | 4 ++++ 8 files changed, 28 insertions(+), 2 deletions(-) create mode 100755 scripts/count create mode 100755 scripts/match create mode 100755 scripts/no-match create mode 100755 scripts/no-more (limited to 'scripts') diff --git a/Makefile.am b/Makefile.am index c9849cb..82d2a53 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,6 +13,10 @@ allowed_DATA = functions/allowed/hosts bin_SCRIPTS = scripts/vyatta-show-interfaces bin_SCRIPTS += scripts/vyatta-show-version +bin_SCRIPTS += scripts/count +bin_SCRIPTS += scripts/match +bin_SCRIPTS += scripts/no-match +bin_SCRIPTS += scripts/no-more bin_sudo_users_SCRIPTS = scripts/vyatta-show-log bin_sudo_users_SCRIPTS += scripts/vyatta-show-log-all diff --git a/debian/vyatta-op.postinst.in b/debian/vyatta-op.postinst.in index 4f0b3b4..626ace2 100644 --- a/debian/vyatta-op.postinst.in +++ b/debian/vyatta-op.postinst.in @@ -8,4 +8,8 @@ bindir=@bindir@ ln -sf /usr/sbin/ethtool ${bindir}/sudo-users/ethtool ln -sf /usr/sbin/dmidecode ${bindir}/sudo-users/dmidecode ln -sf /sbin/iptables ${bindir}/sudo-users/iptables +ln -sf ${bindir}/count /usr/bin/ +ln -sf ${bindir}/match /usr/bin/ +ln -sf ${bindir}/no-match /usr/bin/ +ln -sf ${bindir}/no-more /usr/bin/ diff --git a/debian/vyatta-op.postrm.in b/debian/vyatta-op.postrm.in index f86a7ba..34f21ed 100644 --- a/debian/vyatta-op.postrm.in +++ b/debian/vyatta-op.postrm.in @@ -9,5 +9,9 @@ if [ "$1" = "purge" ]; then rm -f ${bindir}/sudo-users/ethtool rm -f ${bindir}/sudo-users/dmidecode rm -f ${bindir}/sudo-users/iptables + rm -f /usr/bin/count + rm -f /usr/bin/match + rm -f /usr/bin/no-match + rm -f /usr/bin/no-more fi diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/10vyatta-op index 5a672c3..52be05a 100644 --- a/etc/bash_completion.d/10vyatta-op +++ b/etc/bash_completion.d/10vyatta-op @@ -304,8 +304,6 @@ done eval $nullglob_save unset nullglob_save -alias no-more=cat - _vyatta_op_init $@ ### Local Variables: diff --git a/scripts/count b/scripts/count new file mode 100755 index 0000000..1ab3796 --- /dev/null +++ b/scripts/count @@ -0,0 +1,4 @@ +#!/bin/bash + +wc -l "$@" + diff --git a/scripts/match b/scripts/match new file mode 100755 index 0000000..c452824 --- /dev/null +++ b/scripts/match @@ -0,0 +1,4 @@ +#!/bin/bash + +grep -E -e "$@" + diff --git a/scripts/no-match b/scripts/no-match new file mode 100755 index 0000000..528d80c --- /dev/null +++ b/scripts/no-match @@ -0,0 +1,4 @@ +#!/bin/bash + +grep -E -v -e "$@" + diff --git a/scripts/no-more b/scripts/no-more new file mode 100755 index 0000000..59f51e8 --- /dev/null +++ b/scripts/no-more @@ -0,0 +1,4 @@ +#!/bin/bash + +cat "$@" + -- cgit v1.2.3 From 4a26e01aedbbee2092a0d3c547cb2061d2305a6d Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Tue, 11 Dec 2007 10:24:56 -0800 Subject: implement "pipe" commands as functions --- Makefile.am | 4 ---- debian/vyatta-op.postinst.in | 4 ---- debian/vyatta-op.postrm.in | 4 ---- etc/bash_completion.d/10vyatta-op | 21 +++++++++++++++++++++ scripts/count | 4 ---- scripts/match | 4 ---- scripts/no-match | 4 ---- scripts/no-more | 4 ---- 8 files changed, 21 insertions(+), 28 deletions(-) delete mode 100755 scripts/count delete mode 100755 scripts/match delete mode 100755 scripts/no-match delete mode 100755 scripts/no-more (limited to 'scripts') diff --git a/Makefile.am b/Makefile.am index 82d2a53..c9849cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,10 +13,6 @@ allowed_DATA = functions/allowed/hosts bin_SCRIPTS = scripts/vyatta-show-interfaces bin_SCRIPTS += scripts/vyatta-show-version -bin_SCRIPTS += scripts/count -bin_SCRIPTS += scripts/match -bin_SCRIPTS += scripts/no-match -bin_SCRIPTS += scripts/no-more bin_sudo_users_SCRIPTS = scripts/vyatta-show-log bin_sudo_users_SCRIPTS += scripts/vyatta-show-log-all diff --git a/debian/vyatta-op.postinst.in b/debian/vyatta-op.postinst.in index 626ace2..4f0b3b4 100644 --- a/debian/vyatta-op.postinst.in +++ b/debian/vyatta-op.postinst.in @@ -8,8 +8,4 @@ bindir=@bindir@ ln -sf /usr/sbin/ethtool ${bindir}/sudo-users/ethtool ln -sf /usr/sbin/dmidecode ${bindir}/sudo-users/dmidecode ln -sf /sbin/iptables ${bindir}/sudo-users/iptables -ln -sf ${bindir}/count /usr/bin/ -ln -sf ${bindir}/match /usr/bin/ -ln -sf ${bindir}/no-match /usr/bin/ -ln -sf ${bindir}/no-more /usr/bin/ diff --git a/debian/vyatta-op.postrm.in b/debian/vyatta-op.postrm.in index 34f21ed..f86a7ba 100644 --- a/debian/vyatta-op.postrm.in +++ b/debian/vyatta-op.postrm.in @@ -9,9 +9,5 @@ if [ "$1" = "purge" ]; then rm -f ${bindir}/sudo-users/ethtool rm -f ${bindir}/sudo-users/dmidecode rm -f ${bindir}/sudo-users/iptables - rm -f /usr/bin/count - rm -f /usr/bin/match - rm -f /usr/bin/no-match - rm -f /usr/bin/no-more fi diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/10vyatta-op index 52be05a..d5ea362 100644 --- a/etc/bash_completion.d/10vyatta-op +++ b/etc/bash_completion.d/10vyatta-op @@ -291,6 +291,27 @@ _vyatta_op_run () return $ret } +# "pipe" functions +count () +{ + wc -l "$@" +} + +match () +{ + grep -E -e "$@" +} + +no-match () +{ + grep -E -v -e "$@" +} + +no-more () +{ + cat "$@" +} + # don't initialize if we are in configure mode if [ "$_OFR_CONFIGURE" == "ok" ]; then return 0 diff --git a/scripts/count b/scripts/count deleted file mode 100755 index 1ab3796..0000000 --- a/scripts/count +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -wc -l "$@" - diff --git a/scripts/match b/scripts/match deleted file mode 100755 index c452824..0000000 --- a/scripts/match +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -grep -E -e "$@" - diff --git a/scripts/no-match b/scripts/no-match deleted file mode 100755 index 528d80c..0000000 --- a/scripts/no-match +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -grep -E -v -e "$@" - diff --git a/scripts/no-more b/scripts/no-more deleted file mode 100755 index 59f51e8..0000000 --- a/scripts/no-more +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -cat "$@" - -- cgit v1.2.3