kata-deploy: add INSTALLATION_PREFIX validation

INSTALLATION_PREFIX must begin with a "/"
because it is being concatenated with /host.

If there is no /, displays a message and makes an error.

Fixes: #11096

Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
This commit is contained in:
Shunsuke Kimura 2025-03-28 17:14:14 +09:00
parent a49b6f8634
commit a05f5f1827

View File

@ -66,6 +66,9 @@ INSTALLATION_PREFIX="${INSTALLATION_PREFIX:-}"
default_dest_dir="/opt/kata"
dest_dir="${default_dest_dir}"
if [ -n "${INSTALLATION_PREFIX}" ]; then
if [[ "${INSTALLATION_PREFIX:0:1}" != "/" ]]; then
die 'INSTALLATION_PREFIX must begin with a "/"(ex. /hoge/fuga)'
fi
# There's no `/` in between ${INSTALLATION_PREFIX} and ${default_dest_dir}
# as, otherwise, we'd have it doubled there, as: `/foo/bar//opt/kata`
dest_dir="${INSTALLATION_PREFIX}${default_dest_dir}"