vm-start/network_control.sh

58 lines
1.2 KiB
Bash
Raw Normal View History

#!/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.
NAME
Is the name of the vm to open
COMMAND
active Active the internet network of the vm
desactive desactive the internet network of the vm
desactive-all desactive all vms previously loaded
"
print_usage() {
echo "${usage}"
}
print_version() {
echo "$(basename $0) v.${version}"
}
# 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