]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Replace 'which' with 'command -v' in tests too 4021/head
authorDiederik de Haas <didi.debian@cknow.org>
Thu, 28 Oct 2021 16:25:37 +0000 (18:25 +0200)
committerDiederik de Haas <didi.debian@cknow.org>
Thu, 28 Oct 2021 16:25:37 +0000 (18:25 +0200)
Forgot to modify and include the tests in previous PR, so do that now.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
src/tests/lxc-test-apparmor-generated
src/tests/lxc-test-apparmor-mount
src/tests/lxc-test-unpriv
src/tests/lxc-test-usernic.in

index 25057e0c8caccfa03c931898dc60000fa72b8c0e..df20a10684003cfdfbf92bd19ee112452cb5aa87 100755 (executable)
@@ -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
index 2ae3a2e6f4b0336245b150c1bc8b72cabab36d77..f31b08a3fb97e66506dcd95801d4983da6505477 100755 (executable)
@@ -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 $$
index 3108a8605a2e8b81fc56eb9223acff8f4a7f1668..e00fb44675167b506c6d29fe7bc04b94a45d03c2 100755 (executable)
@@ -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 $$
index 47fa62db566a32c24b225109ec6228a96bd76295..848ff561cd5ffbec813f114cb9fb9c58616d5380 100755 (executable)
@@ -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 $$