|
|
@ -20,19 +20,19 @@ function usage { |
|
|
function parse_options { |
|
|
function parse_options { |
|
|
while [[ $# -gt 0 ]]; do |
|
|
while [[ $# -gt 0 ]]; do |
|
|
case "$1" in |
|
|
case "$1" in |
|
|
--help | -h) |
|
|
|
|
|
usage && exit 0 |
|
|
|
|
|
;; |
|
|
|
|
|
--no-start) |
|
|
|
|
|
START=false |
|
|
|
|
|
;; |
|
|
|
|
|
*) |
|
|
|
|
|
if [[ -z $CONTAINER_NAME ]]; then |
|
|
|
|
|
CONTAINER_NAME=$1 |
|
|
|
|
|
else |
|
|
|
|
|
echo >&2 "Unknown option: $1" && usage && exit 2 |
|
|
|
|
|
fi |
|
|
|
|
|
;; |
|
|
|
|
|
|
|
|
--help | -h) |
|
|
|
|
|
usage && exit 0 |
|
|
|
|
|
;; |
|
|
|
|
|
--no-start) |
|
|
|
|
|
START=false |
|
|
|
|
|
;; |
|
|
|
|
|
*) |
|
|
|
|
|
if [[ -z $CONTAINER_NAME ]]; then |
|
|
|
|
|
CONTAINER_NAME=$1 |
|
|
|
|
|
else |
|
|
|
|
|
echo >&2 "Unknown option: $1" && usage && exit 2 |
|
|
|
|
|
fi |
|
|
|
|
|
;; |
|
|
esac |
|
|
esac |
|
|
|
|
|
|
|
|
shift 1 # Move to the next argument |
|
|
shift 1 # Move to the next argument |
|
|
@ -92,7 +92,7 @@ function create_container { |
|
|
--onboot true \ |
|
|
--onboot true \ |
|
|
$(optional_public_keys) \ |
|
|
$(optional_public_keys) \ |
|
|
--unprivileged true \ |
|
|
--unprivileged true \ |
|
|
--features nesting=1 \ |
|
|
|
|
|
|
|
|
--features nesting=1 |
|
|
|
|
|
|
|
|
[[ -n $TAG_NAME ]] && pct set $new_id --tags $TAG_NAME |
|
|
[[ -n $TAG_NAME ]] && pct set $new_id --tags $TAG_NAME |
|
|
echo "container: $CONTAINER_NAME succesfully created with vmid=$new_id!" |
|
|
echo "container: $CONTAINER_NAME succesfully created with vmid=$new_id!" |
|
|
@ -111,9 +111,6 @@ function existing_container { |
|
|
# MAIN |
|
|
# MAIN |
|
|
|
|
|
|
|
|
set -Eue |
|
|
set -Eue |
|
|
parse_options $* |
|
|
|
|
|
|
|
|
parse_options "$@" |
|
|
source "$CONFIG_FILE" |
|
|
source "$CONFIG_FILE" |
|
|
existing_container && false || create_container |
|
|
existing_container && false || create_container |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|