vm-start/network_control.sh
2024-03-25 00:42:23 +00:00

66 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
# Script which control the network. Make the bridge, veth, dummy, brx alone without any help.
version="0.0.2"
usage="USAGE
$(basename $0) [PARAMETTER] [COMMAND NAME]
DESCRIPTION
Setup the bridge interfaces for a vm.
Take it's config files from:
- \$XDG_CONFIG_HOME/vm_start/conf
In case \$XDG_CONFIG_HOME doesn't exists
- ~/.config/vm_start/conf
PARAMETTER
-h, --help Print this help message and quit
-V, --version Print the installed version of $(basename $0) and quit
-v, --verbose Print more output for all actions.
-c <path/to/conf>, --configdir </path/to/conf>
Override the default conf dir by this this one. Must be an absolute path.
NAME
Is the name of the vm to open
COMMAND
-a, --active Active the internet network of the vm
-d, --desactive desactive the internet network of the vm
-dA, --desactive-all desactive all vms previously loaded
-l, --list list all vms accessibles.
"
print_usage() {
echo "${usage}"
}
print_version() {
echo "$(basename $0) v.${version}"
}
set_verbose() {
verbose=1
}
# first, test if there is help, version, or verbose args.
for i in "$@"; do
case "$i" in
"-h" | "--help")
print_usage
exit 0
;;
"-V" | "--version")
print_version
exit 0
;;
"-v" | "--verbose")
set_verbose
;;
esac
done
(( verbose )) && echo "verbose is set"