runtime: Add Path for kata-deploy

When installing with kata-deploy,
usually `/opt/kata/bin` is not in the PATH.
Therefore, it will fail to execute.
so add it to the PATH.

Fixes: #11122

Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
Co-authored-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
Shunsuke Kimura
2025-04-08 06:05:23 +09:00
parent 89685c0cd0
commit ddccbd4764

View File

@@ -5,18 +5,22 @@
# SPDX-License-Identifier: Apache-2.0
#
# kata-deploy installs binaries in /opt/kata/bin by default, which is not in the PATH.
# We need to add it to PATH to ensure commands like kata-monitor and kata-runtime.
SCRIPT_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
typeset -r script_name=${0##*/}
typeset -r runtime_name="@RUNTIME_NAME@"
typeset -r runtime_path=$(command -v "$runtime_name" 2>/dev/null)
typeset -r runtime_path=$(PATH="$SCRIPT_DIR:$PATH" command -v "$runtime_name" 2>/dev/null)
typeset -r runtime_snap_name="kata-containers.runtime"
typeset -r runtime_snap_path=$(command -v "$runtime_snap_name" 2>/dev/null)
typeset -r runtime=${runtime_path:-"$runtime_snap_path"}
typeset -r containerd_shim_v2_name="containerd-shim-kata-v2"
typeset -r containerd_shim_v2=$(command -v "$containerd_shim_v2_name" 2>/dev/null)
typeset -r containerd_shim_v2=$(PATH="$SCRIPT_DIR:$PATH" command -v "$containerd_shim_v2_name" 2>/dev/null)
typeset -r kata_monitor_name="kata-monitor"
typeset -r kata_monitor=$(command -v "$kata_monitor_name" 2>/dev/null)
typeset -r kata_monitor=$(PATH="$SCRIPT_DIR:$PATH" command -v "$kata_monitor_name" 2>/dev/null)
typeset -r issue_url="@PROJECT_BUG_URL@"
typeset -r script_version="@VERSION@ (commit @COMMIT@)"