Browse Source

new: [gogocarto] don't fail on improper source code directory

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
new-mailhog-charms
Valentin Lab 3 years ago
parent
commit
7d24153945
  1. 14
      gogocarto/lib/common

14
gogocarto/lib/common

@ -8,13 +8,13 @@ GOGOCARTO_URL=https://docker.0k.io/downloads/gogocarto-"${GOGOCARTO_RELEASE}".ta
gogocarto:init() { gogocarto:init() {
current_version="" current_version=""
if [ -d "${GOGOCARTO_CODE}" ]; then
current_version=$(cat "${GOGOCARTO_CODE}"/.version) || {
err "Couldn't find ${GOGOCARTO_CODE}/.version file."
echo " Your config dir is in a broken state." >&2
return 1
}
else
if [ -e "${GOGOCARTO_CODE}/.version" ]; then
current_version="$(cat "${GOGOCARTO_CODE}/.version")" || return 1
fi
## Note: previous content will be removed, if not in `.git` and no
## version matching current one
if ! [ -d "${GOGOCARTO_CODE}/.git" ]; then
mkdir -p "${GOGOCARTO_CODE}" && mkdir -p "${GOGOCARTO_CODE}" &&
cd "${GOGOCARTO_CODE}" && cd "${GOGOCARTO_CODE}" &&
git init . && git init . &&

Loading…
Cancel
Save