2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 21:07:18 +00:00

Replace 'which' with 'command -v' in tests too

Forgot to modify and include the tests in previous PR, so do that now.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
This commit is contained in:
Diederik de Haas
2021-10-28 18:25:37 +02:00
parent 4449c5b25c
commit 4c69af0c37
4 changed files with 7 additions and 7 deletions

View File

@@ -18,7 +18,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
if ! which apparmor_parser >/dev/null 2>&1; then
if ! command -v apparmor_parser >/dev/null 2>&1; then
echo 'SKIP: test for generated apparmor profiles: apparmor_parser missing'
fi
exit 0

View File

@@ -91,7 +91,7 @@ chmod 0666 "$logfile"
# of an empty directory over the securityfs 'mount' directory
# be removed, we need to do this as non-root.
which newuidmap >/dev/null 2>&1 || { echo "'newuidmap' command is missing" >&2; exit 1; }
command -v newuidmap >/dev/null 2>&1 || { echo "'newuidmap' command is missing" >&2; exit 1; }
# create a test user
TUSER=lxcunpriv
HDIR=/home/$TUSER
@@ -119,7 +119,7 @@ chown -R $TUSER: /run/user/$(id -u $TUSER)
cd $HDIR
if which cgm >/dev/null 2>&1; then
if command -v cgm >/dev/null 2>&1; then
cgm create all $TUSER
cgm chown all $TUSER $(id -u $TUSER) $(id -g $TUSER)
cgm movepid all $TUSER $$

View File

@@ -62,7 +62,7 @@ if modprobe -q overlayfs; then
fi
fi
which newuidmap >/dev/null 2>&1 || { echo "'newuidmap' command is missing" >&2; exit 1; }
command -v newuidmap >/dev/null 2>&1 || { echo "'newuidmap' command is missing" >&2; exit 1; }
DONE=0
UNPRIV_LOG=$(mktemp --dry-run)
@@ -130,7 +130,7 @@ chown -R $TUSER: /run/user/$(id -u $TUSER)
cd $HDIR
if which cgm >/dev/null 2>&1; then
if command -v cgm >/dev/null 2>&1; then
cgm create all $TUSER
cgm chown all $TUSER $(id -u $TUSER) $(id -g $TUSER)
cgm movepid all $TUSER $$
@@ -181,7 +181,7 @@ p1=$(run_cmd lxc-info -n c2 -p -H -l trace -o "${UNPRIV_LOG}")
run_cmd lxc-stop -n c2 -k -l trace -o "${UNPRIV_LOG}"
if which cgm >/dev/null 2>&1; then
if command -v cgm >/dev/null 2>&1; then
echo "Testing containers under different cgroups per subsystem"
run_cmd cgm create freezer x1/x2
cgm movepid freezer x1 $$

View File

@@ -80,7 +80,7 @@ lxc.idmap = u 0 910000 10000
lxc.idmap = g 0 910000 10000
EOF
if which cgm >/dev/null 2>&1; then
if command -v cgm >/dev/null 2>&1; then
cgm create all usernic-user
cgm chown all usernic-user $(id -u usernic-user) $(id -g usernic-user)
cgm movepid all usernic-user $$