Commit c868aa10 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.19.1

parent 27d13bd7
...@@ -73,8 +73,8 @@ check_tty() ...@@ -73,8 +73,8 @@ check_tty()
check_core_commands check_core_commands
# egrep from busybox may not --color # grep -E from busybox may not --color
# egrep from MacOS print help to stderr # grep -E from MacOS print help to stderr
if grep -E --help 2>&1 | grep -q -- "--color" ; then if grep -E --help 2>&1 | grep -q -- "--color" ; then
export EGREPCOLOR="--color" export EGREPCOLOR="--color"
fi fi
...@@ -1996,6 +1996,10 @@ get_virt() ...@@ -1996,6 +1996,10 @@ get_virt()
echo "xen" && return echo "xen" && return
fi fi
if lscpu | grep "Hypervisor vendor:" | grep -q "KVM" ; then
echo "kvm" && return
fi
echo "(unknown)" echo "(unknown)"
# TODO: check for openvz # TODO: check for openvz
} }
...@@ -2580,19 +2584,25 @@ has_space() ...@@ -2580,19 +2584,25 @@ has_space()
list() list()
{ {
local i local i
set -f
for i in $@ ; do for i in $@ ; do
echo "$i" echo "$i"
done done
set +f
} }
count() count()
{ {
set -f
list $@ | wc -l list $@ | wc -l
set +f
} }
union() union()
{ {
set -f
strip_spaces $(list $@ | sort -u) strip_spaces $(list $@ | sort -u)
set +f
} }
intersection() intersection()
...@@ -2624,7 +2634,7 @@ match() ...@@ -2624,7 +2634,7 @@ match()
{ {
local wd="$1" local wd="$1"
shift shift
echo "$*" | egrep -q -- "$wd" echo "$*" | grep -E -q -- "$wd"
} }
...@@ -2633,9 +2643,11 @@ reg_remove() ...@@ -2633,9 +2643,11 @@ reg_remove()
{ {
local i local i
local RES= local RES=
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q "^$1$" || RES="$RES $i" echo "$i" | grep -q "^$1$" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2644,9 +2656,11 @@ reg_wordremove() ...@@ -2644,9 +2656,11 @@ reg_wordremove()
{ {
local i local i
local RES="" local RES=""
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" || RES="$RES $i" echo "$i" | grep -q -w "$1" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2667,9 +2681,11 @@ exclude() ...@@ -2667,9 +2681,11 @@ exclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES="$(reg_rqremove "$i" "$RES")" RES="$(reg_rqremove "$i" "$RES")"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2678,9 +2694,11 @@ reg_exclude() ...@@ -2678,9 +2694,11 @@ reg_exclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES="$(reg_remove "$i" "$RES")" RES="$(reg_remove "$i" "$RES")"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2689,18 +2707,22 @@ reg_wordexclude() ...@@ -2689,18 +2707,22 @@ reg_wordexclude()
{ {
local i local i
local RES="$2" local RES="$2"
set -f
for i in $1 ; do for i in $1 ; do
RES=$(reg_wordremove "$i" "$RES") RES=$(reg_wordremove "$i" "$RES")
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
if_contain() if_contain()
{ {
local i local i
set -f
for i in $2 ; do for i in $2 ; do
[ "$i" = "$1" ] && return [ "$i" = "$1" ] && return
done done
set +f
return 1 return 1
} }
...@@ -2708,12 +2730,14 @@ difference() ...@@ -2708,12 +2730,14 @@ difference()
{ {
local RES="" local RES=""
local i local i
set -f
for i in $1 ; do for i in $1 ; do
if_contain $i "$2" || RES="$RES $i" if_contain $i "$2" || RES="$RES $i"
done done
for i in $2 ; do for i in $2 ; do
if_contain $i "$1" || RES="$RES $i" if_contain $i "$1" || RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -2724,9 +2748,11 @@ reg_include() ...@@ -2724,9 +2748,11 @@ reg_include()
{ {
local i local i
local RES="" local RES=""
set -f
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" && RES="$RES $i" echo "$i" | grep -q -w "$1" && RES="$RES $i"
done done
set +f
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -3137,7 +3163,7 @@ print_version() ...@@ -3137,7 +3163,7 @@ print_version()
local on_text="(host system)" local on_text="(host system)"
local virt="$($DISTRVENDOR -i)" local virt="$($DISTRVENDOR -i)"
[ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)" [ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version 3.18.6 https://wiki.etersoft.ru/Epm" echo "Service manager version 3.19.1 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE" echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2021" echo "Copyright (c) Etersoft 2012-2021"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment