Commit 18cd75a1 authored by Vitaly Lipatov's avatar Vitaly Lipatov

- evz: rewrite engines detection

- evz: add EVZCTL env. to force engine
parent 0d058ca3
......@@ -35,18 +35,23 @@ load_helper evz-functions
check_tty
SUPPORTED_ENGINES="vzctl docker qm pct vboxmanage"
MCTL=""
[ -z "$MCTL" ] && which vzctl 2>/dev/null >/dev/null && MCTL="openvz"
[ -z "$MCTL" ] && which docker 2>/dev/null >/dev/null && MCTL="docker"
[ -z "$MCTL" ] && which qm 2>/dev/null >/dev/null && MCTL="qm"
[ -z "$MCTL" ] && which pct 2>/dev/null >/dev/null && MCTL="pct"
EVZCTL_supported=""
for i in $SUPPORTED_ENGINES ; do
which $i 2>/dev/null >/dev/null || continue
MCTL="$i"
[ "$EVZCTL" = "$i" ] && EVZCTL_supported="$EVZCTL" && break
done
[ -n "$EVZCTL_supported" ] && MCTL="$EVZCTL_supported"
[ -n "$MCTL" ] || warning "Can't detect supported virtualization tool"
# FIXME: override get_help
# print options description from HELPCMD/HELPOPT lines in the code
get_help()
{
[ -z "$MCTL" ] && warning "Can't detect supported virtualization tool" && return
grep -v -h -- "^#" $0 $SHAREDIR/evz-$MCTL | grep -- "# $1" | while read n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g")
......@@ -72,7 +77,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Etersoft vzctl & docker wrapper version @VERSION@"
echo "Etersoft virtualization wrapper version @VERSION@"
echo "Copyright (c) Etersoft 2017, 2020"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -80,7 +85,7 @@ print_version()
progname="${0##*/}"
Usage="Usage: $progname [options] [<command>] [params]..."
Descr="evz - vzctl & docker wrapper"
Descr="evz - virtualization wrapper (supported engines: $SUPPORTED_ENGINES)"
progname="${0##*/}"
......
......@@ -36,6 +36,9 @@ Quiet mode
# evz destroy 5 10 - stop containers 5, 10 and destroy it
# evz restart 10 20 - restart containers 10 20
.SH ENV
You can override autodetected virtualization engine with EVZCTL environment variable.
.SH BUGS
Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS
......
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