[ -n "$NFT" ] && nft list ruleset > /dev/null 2>&1 && [ "$LXC_USE_NFT" = "true" ]
}
-NFT="$(which nft)"
+NFT="$(command -v nft)"
if ! use_nft; then
use_iptables_lock="-w"
iptables -w -L -n > /dev/null 2>&1 || use_iptables_lock=""
# can't write its pid into, so we restorecon it (to var_run_t)
if [ ! -d "${varrun}" ]; then
mkdir -p "${varrun}"
- if which restorecon >/dev/null 2>&1; then
+ if command -v restorecon >/dev/null 2>&1; then
restorecon "${varrun}"
fi
fi
# Wrap the dhclient command with "aa-exec -p unconfined" if AppArmor is enabled.
dhclient() {
bin="/sbin/dhclient"
- if [ -d "/sys/kernel/security/apparmor" ] && which aa-exec >/dev/null; then
+ if [ -d "/sys/kernel/security/apparmor" ] && command -v aa-exec >/dev/null; then
bin="aa-exec -p unconfined ${bin}"
fi
echo $bin
fi
export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
-if ! which nvidia-container-cli >/dev/null; then
+if ! command -v nvidia-container-cli >/dev/null; then
echo "ERROR: Missing tool nvidia-container-cli, see https://github.com/NVIDIA/libnvidia-container" >&2
exit 1
fi
echo -n "User namespace: " && is_enabled CONFIG_USER_NS
echo
if is_set CONFIG_USER_NS; then
- if which newuidmap > /dev/null 2>&1; then
- f=`which newuidmap`
+ if command -v newuidmap >/dev/null 2>&1; then
+ f=$(command -v newuidmap)
if [ ! -u "${f}" ]; then
echo "Warning: newuidmap is not setuid-root"
fi
else
echo "newuidmap is not installed"
fi
- if which newgidmap > /dev/null 2>&1; then
- f=`which newgidmap`
+ if command -v newgidmap >/dev/null 2>&1; then
+ f=$(command -v newgidmap)
if [ ! -u "${f}" ]; then
echo "Warning: newgidmap is not setuid-root"
fi
LXC_MAPPED_UID=
LXC_MAPPED_GID=
-BUSYBOX_EXE=`which busybox`
+BUSYBOX_EXE=$(command -v busybox)
# Make sure the usual locations are in PATH
export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
# Check for required binaries
for bin in skopeo umoci jq; do
- if ! which $bin >/dev/null 2>&1; then
+ if ! command -v $bin >/dev/null 2>&1; then
echo "ERROR: Missing required tool: $bin" 1>&2
exit 1
fi
# Trap all exit signals
trap cleanup EXIT HUP INT TERM
-if ! which mktemp >/dev/null 2>&1; then
+if ! command -v mktemp >/dev/null 2>&1; then
DOWNLOAD_TEMP="${DOWNLOAD_BASE}/lxc-oci.$$"
mkdir -p "${DOWNLOAD_TEMP}"
else