diff --git a/bin/pct-create b/bin/pct-create index 5a63858..491dd34 100755 --- a/bin/pct-create +++ b/bin/pct-create @@ -20,19 +20,19 @@ function usage { function parse_options { while [[ $# -gt 0 ]]; do 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 shift 1 # Move to the next argument @@ -77,7 +77,7 @@ function create_container { local vol_in_gb=$(convert_human_size_to_gigabyte $STORAGE_SIZE) local mem_in_mb=$(convert_human_size_to_megabyte $MEMORY) local swp_in_mb=$(convert_human_size_to_megabyte $SWAP) - + pct create \ $new_id \ $template_file \ @@ -92,15 +92,15 @@ function create_container { --onboot true \ $(optional_public_keys) \ --unprivileged true \ - --features nesting=1 \ - + --features nesting=1 + [[ -n $TAG_NAME ]] && pct set $new_id --tags $TAG_NAME echo "container: $CONTAINER_NAME succesfully created with vmid=$new_id!" } function existing_container { local vmid=$($BASEDIR/pct-lookup "$CONTAINER_NAME" 2>/dev/null) - if [[ -z $vmid ]]; then + if [[ -z $vmid ]]; then false else echo "container $CONTAINER_NAME already exists with vmid=$vmid!" @@ -111,9 +111,6 @@ function existing_container { # MAIN set -Eue -parse_options $* +parse_options "$@" source "$CONFIG_FILE" existing_container && false || create_container - - - diff --git a/result b/result deleted file mode 100644 index 64f8934..0000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -State: RUNNING diff --git a/tools/miaou-create b/tools/miaou-create index 009ecf0..d1770bf 100755 --- a/tools/miaou-create +++ b/tools/miaou-create @@ -42,9 +42,20 @@ function before_start { function after_start { # hot changes - pct exec "$CONTAINER_ID" -- apt-get purge -y postfix - pct exec "$CONTAINER_ID" -- apt-get update - pct exec "$CONTAINER_ID" -- apt-get install -y file git bc vim jq sudo bash-completion + pct push $CONTAINER_ID <( + cat <<'EOF' +en_US.UTF-8 UTF-8 +EOF + ) /etc/locale.gen + pct exec "$CONTAINER_ID" -- locale-gen >/dev/null + pct exec "$CONTAINER_ID" -- bash </dev/null + echo DONE + + apt-get purge -y postfix + apt-get install -y file git bc vim jq sudo bash-completion +EOF if [[ -v MIAOU_BASH_DIR ]]; then pct exec "$CONTAINER_ID" -- /opt/miaou-bash/init.sh fi