From e4892d472068d354fc40472cf168d9933c660c5e Mon Sep 17 00:00:00 2001 From: Mar Alegre Date: Mon, 1 Feb 2021 21:17:46 -0500 Subject: [PATCH] bugfixes to pdm scripts --- .install/bin/pdm-build | 4 ++++ .install/bin/pdm-launch | 7 ++++--- .install/bin/pdm-shell | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.install/bin/pdm-build b/.install/bin/pdm-build index 24cfa5b..5be974c 100755 --- a/.install/bin/pdm-build +++ b/.install/bin/pdm-build @@ -51,6 +51,7 @@ while getopts ':sdt:h' arg; do ?) badarg "Invalid option '-$OPTARG'";; esac done +shift $((OPTIND -1)) # Handle non-option arguments if [[ $# -gt 2 ]]; then @@ -110,6 +111,9 @@ else podman rmi tmp-$epoch fi +# tag image as latest +podman tag "$name:$today" "$name:latest" + # assign any extra tags for tag in "${opt_tags[@]}"; do podman tag "$name:$today" "$name:$tag" diff --git a/.install/bin/pdm-launch b/.install/bin/pdm-launch index 407f604..e2e2da3 100755 --- a/.install/bin/pdm-launch +++ b/.install/bin/pdm-launch @@ -40,6 +40,7 @@ while getopts ':fcl:e:h' arg; do ?) badarg "Invalid option '-$OPTARG'";; esac done +shift $((OPTIND -1)) # Handle non-option arguments if [[ $# -lt 1 ]]; then @@ -52,7 +53,7 @@ if [[ $# -gt 2 ]]; then badarg "Too many arguments" fi -if [[ -n $2 ]]; then +if [[ $# -eq 2 ]]; then container="$2" else container="$image" @@ -62,14 +63,14 @@ fi if [[ $opt_config -eq 1 ]]; then echo "Getting deploy options from image metadata label '$opt_label' ..." deployconf=$(podman image inspect -f "{{ .Config.Labels.${opt_label} }}" "$image") - if [[ $config == "" ]]; then + if [[ $deployconf == "" ]]; then echo "Error: could not find image metadata label '$opt_label'" exit 1 fi else deployconf="" fi -deployconf="$deployconf $opts_extras" +deployconf="$deployconf $opt_extras" if [[ $opt_force -eq 1 ]]; then podman rm -i -f "$container" diff --git a/.install/bin/pdm-shell b/.install/bin/pdm-shell index 2a5ed08..54f7664 100755 --- a/.install/bin/pdm-shell +++ b/.install/bin/pdm-shell @@ -28,6 +28,7 @@ while getopts ':h' arg; do ?) badarg "Invalid option '-$OPTARG'";; esac done +shift $((OPTIND -1)) # Handle non-option arguments if [[ $# -lt 1 ]]; then