From e51621aa7fa99d5bc6d5fe43282ec162a1456427 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 19 Jul 2023 13:12:20 +0200 Subject: [PATCH] Handle empty root in config If the config.toml has an empty root specified, this could be passed to the NVIDIA Container CLI through the --root flag which causes argument parsing to fail. This change only adds the --root flag if the config option is specified and is non-empty. Signed-off-by: Evan Lezar --- cmd/nvidia-container-runtime-hook/main.go | 2 +- scripts/release-packages.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd/nvidia-container-runtime-hook/main.go b/cmd/nvidia-container-runtime-hook/main.go index 2db60247..b0d88ee1 100644 --- a/cmd/nvidia-container-runtime-hook/main.go +++ b/cmd/nvidia-container-runtime-hook/main.go @@ -92,7 +92,7 @@ func doPrestart() { rootfs := getRootfsPath(container) args := []string{getCLIPath(cli)} - if cli.Root != nil { + if cli.Root != nil && *cli.Root != "" { args = append(args, fmt.Sprintf("--root=%s", *cli.Root)) } if cli.LoadKmods { diff --git a/scripts/release-packages.sh b/scripts/release-packages.sh index 1d777d70..10f7fbf8 100755 --- a/scripts/release-packages.sh +++ b/scripts/release-packages.sh @@ -102,9 +102,20 @@ function sync() { ubuntu*) pkg_type=deb ;; *) echo "ERROR: unexpected distribution ${src_dist}" + exit 1 ;; esac + if [[ $# -ge 4 && $4 == "package_type" ]] ; then + if [[ "${src_dist}" != "ubuntu18.04" && "${src_dist}" != "centos7" ]]; then + echo "Package type repos require ubuntu18.04 or centos7 as the source" + echo "skipping" + return + fi + dst_dist=$pkg_type + fi + + local arch=${target##*-} local dst_arch=${arch} case ${src_dist} in @@ -174,11 +185,13 @@ git -C ${PACKAGE_REPO_ROOT} clean -fdx ${REPO} for target in ${targets[@]}; do sync ${target} ${PACKAGE_CACHE}/packages ${PACKAGE_REPO_ROOT}/${REPO} + # We also create a `package_type` repo; internally we skip this for non-ubuntu18.04 or centos7 distributions + sync ${target} ${PACKAGE_CACHE}/packages ${PACKAGE_REPO_ROOT}/${REPO} "package_type" done git -C ${PACKAGE_REPO_ROOT} add ${REPO} -if [[ ${REPO} == "stable" ]]; then +if [[ "${REPO}" == "stable" ]]; then # Stable release git -C ${PACKAGE_REPO_ROOT} commit -s -F- <