Skip to content

Commit

Permalink
hostapp-update-hooks: Soft include balena-config-defaults
Browse files Browse the repository at this point in the history
a203bcd introduced a dependency
on /usr/sbin/balena-config-defaults to hostapp-update-hooks, however
during HUP the script is not only executed in the "new" OS container
but directly in the context of the "old" OS as well, so
/usr/sbin/balena-config-defaults needs to exist there.
The file was introduced in balenaOS v2.99.28, so trying to HUP
from anything before that will fail.

This patch changes this to a soft dependency so even if the file
is missing HUP will continue.

Change-type: patch
Signed-off-by: Michal Toman <michalt@balena.io>
  • Loading branch information
mtoman committed Mar 5, 2024
1 parent 6accf97 commit a6cd568
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Expand Up @@ -5,7 +5,7 @@ set -o errexit
# shellcheck disable=SC1091
. /usr/libexec/os-helpers-logging
# shellcheck disable=SC1091
. /usr/sbin/balena-config-defaults
[ -f "/usr/sbin/balena-config-defaults" ] && . /usr/sbin/balena-config-defaults

old_os_before_hooks=0
old_os_after_hooks=0
Expand Down Expand Up @@ -42,7 +42,10 @@ Options:
EOF
}

DEBUG=$(jq -r '.debug // empty' "${CONFIG_PATH}")
DEBUG="0"
if [ -n "${CONFIG_PATH}" ]; then
DEBUG=$(jq -r '.debug // empty' "${CONFIG_PATH}")
fi
run_hook () {
if [ "${DEBUG}" = "1" ]; then
/bin/sh -x "$1"
Expand Down
Expand Up @@ -21,5 +21,9 @@
[ -f "/usr/libexec/os-helpers-efi" ] && . /usr/libexec/os-helpers-efi

is_secured() {
if ! command -v user_mode_enabled; then
return 1
fi

user_mode_enabled
}

0 comments on commit a6cd568

Please sign in to comment.