From aef27fccf1233db3093360db9415bab037b29b4e Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 2 Mar 2011 12:21:03 +0000 Subject: [PATCH] Allow searching for guests not with a specific mark. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2938 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- scripts/functions | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/functions b/scripts/functions index 7f2a92a..7d6278b 100644 --- a/scripts/functions +++ b/scripts/functions @@ -546,18 +546,18 @@ function getAllVservers (STOPPED) ! $_VSERVER "$_ga_i" running &>/dev/null || _ga_doadd=;; (RUNNING) $_VSERVER "$_ga_i" running &>/dev/null || _ga_doadd=;; (ALL) ;; - (MARK) if test -s "$_ga_markfile"; then - if ! grep -qx "$3" "$_ga_markfile"; then - local _ga_j - local _ga_f=false - for _ga_j in "${_ga_marks[@]}"; do - grep -qx "$_ga_j" "$_ga_markfile" && _ga_f=true || : - done - "$_ga_f" || _ga_doadd= - fi - else + (MARK) local _ga_j + local _ga_mark + local _ga_f=false + local _ga_invert=false + for _ga_j in "${_ga_marks[@]}"; do + _ga_mark="$(echo "$_ga_j" | $_SED 's/^[!~]//')" + test "$_ga_j" = "$_ga_mark" || _ga_invert=true + test -s "$_ga_markfile" && $_GREP -qx "$_ga_mark" "$_ga_markfile" && \ + _ga_f=true || : + done + test $_ga_f = $_ga_invert && \ _ga_doadd= - fi ;; (*) panic $"Unknown vserver tagging '$2'";; esac -- 1.8.1.5