mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-10 16:21:51 +00:00
Replace 'which' with 'command -v'
The 'which' command is deprecated on Debian Sid as it is not POSIX compliant and it's behavior is therefor not consistent, so replace it with 'command -v' which is POSIX compliant. See https://stackoverflow.com/a/677212 for details. Also replaced a use of backticks (`) as that is deprecated as well. See https://github.com/koalaman/shellcheck/wiki/SC2006 for details. Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
This commit is contained in:
parent
8dff29c6c7
commit
7a7671655a
@ -31,7 +31,7 @@ use_nft() {
|
|||||||
[ -n "$NFT" ] && nft list ruleset > /dev/null 2>&1 && [ "$LXC_USE_NFT" = "true" ]
|
[ -n "$NFT" ] && nft list ruleset > /dev/null 2>&1 && [ "$LXC_USE_NFT" = "true" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
NFT="$(which nft)"
|
NFT="$(command -v nft)"
|
||||||
if ! use_nft; then
|
if ! use_nft; then
|
||||||
use_iptables_lock="-w"
|
use_iptables_lock="-w"
|
||||||
iptables -w -L -n > /dev/null 2>&1 || use_iptables_lock=""
|
iptables -w -L -n > /dev/null 2>&1 || use_iptables_lock=""
|
||||||
@ -144,7 +144,7 @@ start() {
|
|||||||
# can't write its pid into, so we restorecon it (to var_run_t)
|
# can't write its pid into, so we restorecon it (to var_run_t)
|
||||||
if [ ! -d "${varrun}" ]; then
|
if [ ! -d "${varrun}" ]; then
|
||||||
mkdir -p "${varrun}"
|
mkdir -p "${varrun}"
|
||||||
if which restorecon >/dev/null 2>&1; then
|
if command -v restorecon >/dev/null 2>&1; then
|
||||||
restorecon "${varrun}"
|
restorecon "${varrun}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -29,7 +29,7 @@ usage() {
|
|||||||
# Wrap the dhclient command with "aa-exec -p unconfined" if AppArmor is enabled.
|
# Wrap the dhclient command with "aa-exec -p unconfined" if AppArmor is enabled.
|
||||||
dhclient() {
|
dhclient() {
|
||||||
bin="/sbin/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}"
|
bin="aa-exec -p unconfined ${bin}"
|
||||||
fi
|
fi
|
||||||
echo $bin
|
echo $bin
|
||||||
|
@ -45,7 +45,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
|
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
|
echo "ERROR: Missing tool nvidia-container-cli, see https://github.com/NVIDIA/libnvidia-container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -128,16 +128,16 @@ echo
|
|||||||
echo -n "User namespace: " && is_enabled CONFIG_USER_NS
|
echo -n "User namespace: " && is_enabled CONFIG_USER_NS
|
||||||
echo
|
echo
|
||||||
if is_set CONFIG_USER_NS; then
|
if is_set CONFIG_USER_NS; then
|
||||||
if which newuidmap > /dev/null 2>&1; then
|
if command -v newuidmap >/dev/null 2>&1; then
|
||||||
f=`which newuidmap`
|
f=$(command -v newuidmap)
|
||||||
if [ ! -u "${f}" ]; then
|
if [ ! -u "${f}" ]; then
|
||||||
echo "Warning: newuidmap is not setuid-root"
|
echo "Warning: newuidmap is not setuid-root"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "newuidmap is not installed"
|
echo "newuidmap is not installed"
|
||||||
fi
|
fi
|
||||||
if which newgidmap > /dev/null 2>&1; then
|
if command -v newgidmap >/dev/null 2>&1; then
|
||||||
f=`which newgidmap`
|
f=$(command -v newgidmap)
|
||||||
if [ ! -u "${f}" ]; then
|
if [ ! -u "${f}" ]; then
|
||||||
echo "Warning: newgidmap is not setuid-root"
|
echo "Warning: newgidmap is not setuid-root"
|
||||||
fi
|
fi
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
LXC_MAPPED_UID=
|
LXC_MAPPED_UID=
|
||||||
LXC_MAPPED_GID=
|
LXC_MAPPED_GID=
|
||||||
|
|
||||||
BUSYBOX_EXE=`which busybox`
|
BUSYBOX_EXE=$(command -v busybox)
|
||||||
|
|
||||||
# Make sure the usual locations are in PATH
|
# Make sure the usual locations are in PATH
|
||||||
export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
|
export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
@ -27,7 +27,7 @@ export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
|
|||||||
|
|
||||||
# Check for required binaries
|
# Check for required binaries
|
||||||
for bin in skopeo umoci jq; do
|
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
|
echo "ERROR: Missing required tool: $bin" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -303,7 +303,7 @@ mkdir -p "${DOWNLOAD_BASE}"
|
|||||||
# Trap all exit signals
|
# Trap all exit signals
|
||||||
trap cleanup EXIT HUP INT TERM
|
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.$$"
|
DOWNLOAD_TEMP="${DOWNLOAD_BASE}/lxc-oci.$$"
|
||||||
mkdir -p "${DOWNLOAD_TEMP}"
|
mkdir -p "${DOWNLOAD_TEMP}"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user