Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
evz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Тимофей Смирнов
evz
Commits
2447aa25
Commit
2447aa25
authored
Apr 07, 2022
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve pct support (fix lists and name to id conversion)
parent
54f1433d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
11 deletions
+46
-11
evz
bin/evz
+6
-1
evz-functions
bin/evz-functions
+30
-3
evz-pct
bin/evz-pct
+10
-7
No files found.
bin/evz
View file @
2447aa25
...
...
@@ -69,6 +69,11 @@ $(get_help HELPCMD)
Options:
$(
get_help HELPOPT
)
Params:
ALL - all (even stopped) machines
all - all running machines
ID - id of a machine
Examples:
# evz start ID ID ID
# evz list ALL
...
...
@@ -80,7 +85,7 @@ $(get_help HELPOPT)
print_version
()
{
echo
"Etersoft virtualization wrapper version @VERSION@"
echo
"Copyright (c) Etersoft 2017, 2020, 2021"
echo
"Copyright (c) Etersoft 2017, 2020, 2021
, 2022
"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
}
...
...
bin/evz-functions
View file @
2447aa25
...
...
@@ -41,15 +41,37 @@ get_list()
list_all
}
arg_is_id
()
is_existing_id
()
{
[
-n
"
$1
"
]
||
return
1
echo
"
$(
list_ALL
)
"
|
grep
-q
"
$1
"
&&
return
0
return
1
}
is_existing_name
()
{
like_id
"
$1
"
&&
return
1
echo
"
$(
list_ALL_names
)
"
|
grep
-q
"
$1
"
&&
return
0
return
1
}
arg_is_id
()
{
[
-n
"
$1
"
]
||
return
1
is_existing_id
"
$1
"
&&
return
0
is_existing_name
"
$1
"
&&
return
0
like_id
"
$1
"
&&
fatal
"ID
$1
is missed on the host. Check # evz list -a output"
return
1
}
get_id_by_name
()
{
list_id_names |
grep
"
$1
\$
"
|
sed
-e
"s| .*||"
}
arg_is_all
()
{
[
"
$1
"
=
"ALL"
]
&&
return
...
...
@@ -85,7 +107,12 @@ fill_args_list()
else
while
[
-n
"
$1
"
]
;
do
arg_is_id
"
$1
"
||
break
LIST
=
"
$LIST
$1
"
local id
=
"
$1
"
if
is_existing_name
"
$id
"
;
then
id
=
$(
get_id_by_name
"
$1
"
)
[
-n
"
$id
"
]
||
fatal
"something goes wrong with
$1
"
fi
LIST
=
"
$LIST
$id
"
shift
done
fi
...
...
bin/evz-pct
View file @
2447aa25
...
...
@@ -25,8 +25,7 @@ list_all()
return
fi
# TODO
#a= pct list | grep "[0-9]\+" | sed -e "s| *\([0-9]\+\) .*|\1|" | line_filter
a
=
pct list |
grep
"running"
|
grep
"[0-9]
\+
"
|
sed
-e
"s| *
\(
[0-9]
\+\)
.*|
\1
|"
| line_filter
}
# list all containers (or by arg list)
...
...
@@ -37,14 +36,17 @@ list_ALL()
return
fi
# TODO
#a= pct list | grep "[0-9]\+" | sed -e "s| *\([0-9]\+\) .*|\1|" | line_filter
a
=
pct list |
grep
"[0-9]
\+
"
|
sed
-e
"s| *
\(
[0-9]
\+\)
.*|
\1
|"
| line_filter
}
list_ALL_names
()
{
# TODO
return
a
=
pct list |
grep
"[0-9]
\+
"
|
sed
-e
"s| *
$|
|"
|
sed
-e
"s|.* ||"
| line_filter
}
list_id_names
()
{
a
=
pct list |
grep
"[0-9]
\+
"
|
sed
-e
"s| *
$|
|"
-e
"s| *
\(
[0-9]
\+\)
*
\(
.*
\)
\+\(
.*
\)
$|
\1
\3
|"
}
like_id
()
...
...
@@ -175,7 +177,8 @@ case $CMD in
done
;;
enter
)
# HELPCMD: enter in a container with ID
docmd pct enter
"
$1
"
fill_args_list
"
$1
"
docmd pct enter
$LIST
#a= docker exec -ti $SETLANG "$1" bash
;;
log|logs
)
# HELPCMD: print container log
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment