X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Ffunctions;h=009bcc189a154ed06570cad2dc618ad3a0fcb213;hb=801953169db5fad8cb70fe3d5860d5b4f25799cf;hp=6b89210e593666768de0bd0b208c60fb9b2b2b6a;hpb=dad68012ef154a21f92d032ca514a8ea54d51740;p=util-vserver.git diff --git a/util-vserver/scripts/functions b/util-vserver/scripts/functions index 6b89210..009bcc1 100644 --- a/util-vserver/scripts/functions +++ b/util-vserver/scripts/functions @@ -21,6 +21,7 @@ _VS_ERRFILE= _VS_NEWLINE=' ' declare -r _VS_NEWLINE=${_VS_NEWLINE:0-1} +declare -r VS_ALLVSERVERS_ARGS=all,marked,unmarked,stopped,running function findObject { @@ -66,6 +67,18 @@ function findAndCopy $_CP -af "$tmp" "$dst" } +## Usage: isRegularFile [] +function isRegularFile +{ + test ${2:--f} "$1" || return 1 + + case $1 in + (*.rpmsave|*.rpmnew|*.rpmorig|*.cfsaved*|*.~*~) return 1;; + esac + + return 0 +} + function getPhysicalDir { ( set -P && cd "$1" && pwd ) @@ -127,6 +140,22 @@ function isNumber return 0 } +## Usage: hasSubstring + +function hasSubstring +{ + local pat=$1 + local i + + shift + + for i; do + test x"${pat/*$i*/$i}" = x"$i" || continue + return 0 + done + + return 1 +} + ## Usage: colorize