mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-04-26 18:43:06 +00:00
tools: Fix shellcheck issues in rootfs_lib.sh
Address shellcheck warnings including proper variable quoting, use of [[ ]] over [ ], declaring and assigning variables separately, and adding appropriate shellcheck disable directives where needed. Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com> Made-with: Cursor
This commit is contained in:
@@ -9,7 +9,7 @@ build_rootfs()
|
||||
# Mandatory
|
||||
local ROOTFS_DIR="$1"
|
||||
|
||||
[ -z "$ROOTFS_DIR" ] && die "need rootfs"
|
||||
[[ -z "${ROOTFS_DIR}" ]] && die "need rootfs"
|
||||
|
||||
# In case of support EXTRA packages, use it to allow
|
||||
# users add more packages to the base rootfs
|
||||
@@ -19,10 +19,12 @@ build_rootfs()
|
||||
mkdir -p "${ROOTFS_DIR}"
|
||||
PKG_MANAGER="tdnf"
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
DNF="${PKG_MANAGER} -y --installroot=${ROOTFS_DIR} --noplugins --releasever=${OS_VERSION}"
|
||||
|
||||
info "install packages for rootfs"
|
||||
$DNF install ${EXTRA_PKGS} ${PACKAGES}
|
||||
# shellcheck disable=SC2154,SC2086
|
||||
${DNF} install ${EXTRA_PKGS} ${PACKAGES}
|
||||
|
||||
rm -rf ${ROOTFS_DIR}/usr/share/{bash-completion,cracklib,doc,info,locale,man,misc,pixmaps,terminfo,zoneinfo,zsh}
|
||||
rm -rf "${ROOTFS_DIR}"/usr/share/{bash-completion,cracklib,doc,info,locale,man,misc,pixmaps,terminfo,zoneinfo,zsh}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user