kata-deploy: Fix unbound VERSION_ID

VERSION_ID is not guaranteed to be specified in os-release, this
makes kaka-deploy breaks in rolling distros like arch linux and void
linux.

Note that operating system vendors may choose not to provide
version information, for example to accommodate for rolling releases.
In this case, VERSION and VERSION_ID may be unset.
Applications should not rely on these fields to be set.

Signed-off-by: vac <dot.fun@protonmail.com>
This commit is contained in:
vac (Brendan)
2024-05-20 19:12:40 +08:00
committed by vac
parent 5b257685d9
commit d812007b99

View File

@@ -250,6 +250,7 @@ function install_artifacts() {
fi fi
if grep -q "tdx" <<< "$shim"; then if grep -q "tdx" <<< "$shim"; then
VERSION_ID=version_unset # VERSION_ID may be unset, see https://www.freedesktop.org/software/systemd/man/latest/os-release.html#Notes
source /host/etc/os-release || source /host/usr/lib/os-release source /host/etc/os-release || source /host/usr/lib/os-release
case ${ID} in case ${ID} in
ubuntu) ubuntu)