Avoid blank config.json

https://github.com/alexbelgium/hassio-addons/issues/1615
This commit is contained in:
Alexandre
2024-10-21 07:42:15 +02:00
committed by GitHub
parent 122c63d55e
commit 332fa98590

View File

@@ -273,7 +273,11 @@ for f in */; do
# Remove " and modify version
LASTVERSION=${LASTVERSION//\"/}
CURRENT=${CURRENT//\"/}
jq --arg variable "$LASTVERSION" '.version = $variable' /data/"${BASENAME}"/"${SLUG}"/config.json | sponge /data/"${BASENAME}"/"${SLUG}"/config.json # Replace version tag
if [ -f /data/"${BASENAME}"/"${SLUG}"/config.json ]; then
jq --arg variable "$LASTVERSION" '.version = $variable' /data/"${BASENAME}"/"${SLUG}"/config.json | sponge /data/"${BASENAME}"/"${SLUG}"/config.json # Replace version tag
elif [ -f /data/"${BASENAME}"/"${SLUG}"/config.yaml ]; then
sed -i "/version:/c\version: \"$LASTVERSION\"" /data/"${BASENAME}"/"${SLUG}"/config.yaml
fi
jq --arg variable "$LASTVERSION" '.upstream_version = $variable' /data/"${BASENAME}"/"${SLUG}"/updater.json | sponge /data/"${BASENAME}"/"${SLUG}"/updater.json # Replace upstream tag
jq --arg variable "$DATE" '.last_update = $variable' /data/"${BASENAME}"/"${SLUG}"/updater.json | sponge /data/"${BASENAME}"/"${SLUG}"/updater.json # Replace date tag