Removed unnecessary "--" from printf

This commit is contained in:
Héctor Molinero Fernández 2021-10-31 18:11:57 +01:00
parent 2ccc1af63a
commit 14e5c6dc2d
2 changed files with 8 additions and 8 deletions

View File

@ -236,13 +236,13 @@ binfmt-register:

.PHONY: version
version:
@if printf -- '%s' '$(IMAGE_VERSION)' | grep -q '^v[0-9]\{1,\}$$'; then \
@if printf '%s' '$(IMAGE_VERSION)' | grep -q '^v[0-9]\{1,\}$$'; then \
NEW_IMAGE_VERSION=$$(awk -v 'v=$(IMAGE_VERSION)' 'BEGIN {printf "v%.0f", substr(v,2)+1}'); \
printf -- '%s\n' "$${NEW_IMAGE_VERSION:?}" > '$(VERSION_FILE)'; \
printf '%s\n' "$${NEW_IMAGE_VERSION:?}" > '$(VERSION_FILE)'; \
'$(GIT)' add '$(VERSION_FILE)'; '$(GIT)' commit -m "$${NEW_IMAGE_VERSION:?}"; \
'$(GIT)' tag -a "$${NEW_IMAGE_VERSION:?}" -m "$${NEW_IMAGE_VERSION:?}"; \
else \
>&2 printf -- 'Malformed version string: %s\n' '$(IMAGE_VERSION)'; \
>&2 printf 'Malformed version string: %s\n' '$(IMAGE_VERSION)'; \
exit 1; \
fi


10
run.sh
View File

@ -17,21 +17,21 @@ containerExists() { "${DOCKER:?}" ps -af name="${1:?}" --format '{{.Names}}' | g
containerIsRunning() { "${DOCKER:?}" ps -f name="${1:?}" --format '{{.Names}}' | grep -Fxq "${1:?}"; }

if ! imageExists "${IMAGE_NAME:?}" && ! imageExists "${IMAGE_NAME#docker.io/}"; then
>&2 printf -- '%s\n' "\"${IMAGE_NAME:?}\" image doesn't exist!"
>&2 printf '%s\n' "\"${IMAGE_NAME:?}\" image doesn't exist!"
exit 1
fi

if containerIsRunning "${CONTAINER_NAME:?}"; then
printf -- '%s\n' "Stopping \"${CONTAINER_NAME:?}\" container..."
printf '%s\n' "Stopping \"${CONTAINER_NAME:?}\" container..."
"${DOCKER:?}" stop "${CONTAINER_NAME:?}" >/dev/null
fi

if containerExists "${CONTAINER_NAME:?}"; then
printf -- '%s\n' "Removing \"${CONTAINER_NAME:?}\" container..."
printf '%s\n' "Removing \"${CONTAINER_NAME:?}\" container..."
"${DOCKER:?}" rm "${CONTAINER_NAME:?}" >/dev/null
fi

printf -- '%s\n' "Creating \"${CONTAINER_NAME:?}\" container..."
printf '%s\n' "Creating \"${CONTAINER_NAME:?}\" container..."
"${DOCKER:?}" run --detach \
--name "${CONTAINER_NAME:?}" \
--hostname "${CONTAINER_NAME:?}" \
@ -42,5 +42,5 @@ printf -- '%s\n' "Creating \"${CONTAINER_NAME:?}\" container..."
--env VM_KVM=true --device /dev/kvm \
"${IMAGE_NAME:?}" "$@" >/dev/null

printf -- '%s\n\n' 'Done!'
printf '%s\n\n' 'Done!'
exec "${DOCKER:?}" logs -f "${CONTAINER_NAME:?}"