bash: Fix shellcheck warnings

Signed-off-by: a1346054 <36859588+a1346054@users.noreply.github.com>
This commit is contained in:
a1346054
2021-08-19 14:04:20 +00:00
committed by Alexander Larsson
parent f2a2dbbeb9
commit d69d21b036
6 changed files with 23 additions and 23 deletions

View File

@@ -1,10 +1,10 @@
#!/bin/sh
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=$(dirname "$0")
test -n "$srcdir" || srcdir=.
olddir=`pwd`
cd $srcdir
olddir=$(pwd)
cd "$srcdir"
if ! (autoreconf --version >/dev/null 2>&1); then
echo "*** No autoreconf found, please install it ***"
@@ -15,5 +15,5 @@ mkdir -p m4
autoreconf --force --install --verbose
cd $olddir
cd "$olddir"
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"

View File

@@ -5,7 +5,7 @@
set -eux
set -o pipefail
usage () {
usage() {
if [ "${1-2}" -ne 0 ]; then
exec >&2
fi

View File

@@ -42,11 +42,11 @@ PATH="$PATH:/usr/sbin:/sbin"
tempdir=$(mktemp -d /var/tmp/tap-test.XXXXXX)
touch "${tempdir}/.testtmp"
function cleanup () {
cleanup() {
if test -n "${TEST_SKIP_CLEANUP:-}"; then
echo "Skipping cleanup of ${tempdir}"
elif test -f "${tempdir}/.testtmp"; then
rm "${tempdir}" -rf
rm -rf "${tempdir}"
fi
}
trap cleanup EXIT

View File

@@ -17,7 +17,7 @@ echo "ok - Help works"
for ALT in "" "--unshare-user-try" "--unshare-pid" "--unshare-user-try --unshare-pid"; do
# Test fuse fs as bind source
if [ x$FUSE_DIR != x ]; then
if [ "x$FUSE_DIR" != "x" ]; then
$RUN $ALT --proc /proc --dev /dev --bind $FUSE_DIR /tmp/foo true
echo "ok - can bind-mount a FUSE directory with $ALT"
else
@@ -44,9 +44,9 @@ for ALT in "" "--unshare-user-try" "--unshare-pid" "--unshare-user-try --unshar
fi
echo "ok - cannot read /etc/shadow with $ALT"
# Unreadable dir
if [ x$UNREADABLE != x ]; then
if [ "x$UNREADABLE" != "x" ]; then
echo -n "expect EPERM: " >&2
if $RUN $ALT --unshare-net --proc /proc --dev /dev --bind $UNREADABLE /tmp/foo cat /tmp/foo ; then
if $RUN $ALT --unshare-net --proc /proc --dev /dev --bind $UNREADABLE /tmp/foo cat /tmp/foo; then
assert_not_reached Could read $UNREADABLE
fi
echo "ok - cannot read $UNREADABLE with $ALT"