postinst: Do not override hassio.json data if already set
On upgrades, if $DATA_SHARE Is not provided we may end up overwriting the user configuration, especially in case the postinst script is triggered as part of dpkg configure because of previous failures (as it may happen in recent systemd-journal-remote failures). To prevent this, read the user value if set and re-use it unless a new one is provided.
This commit is contained in:
parent
9c6a021760
commit
fe8cb1896a
1 changed files with 6 additions and 1 deletions
|
@ -106,8 +106,13 @@ case ${ARCH} in
|
|||
esac
|
||||
PREFIX=${PREFIX:-/usr}
|
||||
SYSCONFDIR=${SYSCONFDIR:-/etc}
|
||||
DATA_SHARE=${DATA_SHARE:-$PREFIX/share/hassio}
|
||||
CONFIG="${SYSCONFDIR}/hassio.json"
|
||||
|
||||
if [ -z "$DATA_SHARE" ] && [ -e "$CONFIG" ]; then
|
||||
DATA_SHARE=$(jq -e -r '.data' "${CONFIG}" || true)
|
||||
fi
|
||||
|
||||
DATA_SHARE=${DATA_SHARE:-$PREFIX/share/hassio}
|
||||
cat > "${CONFIG}" <<- EOF
|
||||
{
|
||||
"supervisor": "${HASSIO_DOCKER}",
|
||||
|
|
Loading…
Reference in a new issue