]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
scripts: use 4 space indentation
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Apr 2019 12:10:42 +0000 (14:10 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Apr 2019 06:30:31 +0000 (08:30 +0200)
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)

Also remove the few vim config lines that were left. We should either have them
on all files, or none.

Also remove some strange stuff like '#!/bin/env bash', yikes.

88 files changed:
.dir-locals.el
.editorconfig
.vimrc
coccinelle/run-coccinelle.sh
man/50-xdg-data-dirs.sh
semaphoreci/gcc-compilation.sh
semaphoreci/setup.sh
src/basic/generate-af-list.sh
src/basic/generate-arphrd-list.sh
src/basic/generate-cap-list.sh
src/basic/generate-errno-list.sh
src/boot/efi/no-undefined-symbols.sh
src/journal/generate-audit_type-list.sh
src/shared/generate-ip-protocol-list.sh
src/udev/generate-keyboard-keys-gperf.sh
src/udev/generate-keyboard-keys-list.sh
test/TEST-01-BASIC/test.sh
test/TEST-02-CRYPTSETUP/test.sh
test/TEST-03-JOBS/test.sh
test/TEST-04-JOURNAL/test-journal.sh
test/TEST-04-JOURNAL/test.sh
test/TEST-05-RLIMITS/test-rlimits.sh
test/TEST-05-RLIMITS/test.sh
test/TEST-06-SELINUX/test-selinux-checks.sh
test/TEST-06-SELINUX/test.sh
test/TEST-07-ISSUE-1981/test-segfault.sh
test/TEST-07-ISSUE-1981/test.sh
test/TEST-08-ISSUE-2730/test.sh
test/TEST-09-ISSUE-2691/test.sh
test/TEST-10-ISSUE-2467/test.sh
test/TEST-11-ISSUE-3166/test.sh
test/TEST-12-ISSUE-3171/test.sh
test/TEST-13-NSPAWN-SMOKE/test.sh
test/TEST-14-MACHINE-ID/test.sh
test/TEST-15-DROPIN/test-dropin.sh
test/TEST-15-DROPIN/test.sh
test/TEST-16-EXTEND-TIMEOUT/test.sh
test/TEST-17-UDEV-WANTS/test.sh
test/TEST-17-UDEV-WANTS/testsuite.sh
test/TEST-18-FAILUREACTION/test.sh
test/TEST-18-FAILUREACTION/testsuite.sh
test/TEST-19-DELEGATE/test.sh
test/TEST-19-DELEGATE/testsuite.sh
test/TEST-20-MAINPIDGAMES/test.sh
test/TEST-20-MAINPIDGAMES/testsuite.sh
test/TEST-21-SYSUSERS/test.sh
test/TEST-22-TMPFILES/test.sh
test/TEST-23-TYPE-EXEC/test.sh
test/TEST-23-TYPE-EXEC/testsuite.sh
test/TEST-24-UNIT-TESTS/test.sh
test/TEST-24-UNIT-TESTS/testsuite.sh
test/TEST-25-IMPORT/test.sh
test/TEST-25-IMPORT/testsuite.sh
test/TEST-26-SETENV/test.sh
test/TEST-26-SETENV/testsuite.sh
test/TEST-27-STDOUTFILE/test.sh
test/TEST-27-STDOUTFILE/testsuite.sh
test/TEST-28-PERCENTJ-WANTEDBY/test.sh
test/TEST-29-UDEV-ID_RENAMING/test.sh
test/TEST-29-UDEV-ID_RENAMING/testsuite.sh
test/TEST-30-ONCLOCKCHANGE/test.sh
test/TEST-30-ONCLOCKCHANGE/testsuite.sh
test/TEST-31-DEVICE-ENUMERATION/test.sh
test/TEST-31-DEVICE-ENUMERATION/testsuite.sh
test/run-integration-tests.sh
test/test-efi-create-disk.sh
test/test-functions
tools/add-git-hook.sh
tools/check-directives.sh
tools/choose-default-locale.sh
tools/coverity.sh
tools/find-build-dir.sh
tools/find-double-newline.sh
tools/find-tabs.sh
tools/meson-apply-m4.sh
tools/meson-check-api-docs.sh
tools/meson-check-help.sh
tools/meson-git-contrib.sh
tools/meson-hwdb-update.sh
tools/meson-make-symlink.sh
tools/meson-vcs-tag.sh
tools/oss-fuzz.sh
travis-ci/managers/travis_wait.bash
travis-ci/managers/xenial.sh
travis-ci/scripts/build-docker-image.sh
travis-ci/tools/get-coverity.sh
units/meson-add-wants.sh
xorg/50-systemd-user.sh

index 815afe172a1e23c7464d12596c173825a0b3177a..fde58d65bdded070e091451d8cac4b2a6be38386 100644 (file)
@@ -20,8 +20,8 @@
  (nxml-mode . ((nxml-child-indent . 2)
                (fill-column . 109)))
  (meson-mode . ((meson-indent-basic . 8)))
- (sh-mode . ((sh-basic-offset . 8)
-             (sh-indentation . 8)))
+ (sh-mode . ((sh-basic-offset . 4)
+             (sh-indentation . 4)))
  (awk-mode . ((c-basic-offset . 8)))
  (nil . ((indent-tabs-mode . nil)
          (tab-width . 8)
index 67d848b68d1a96849e36d5ce40aea31a9f1b795e..63b1d749cb12653d63b5f735c361bddc5a289488 100644 (file)
@@ -19,6 +19,10 @@ charset = utf-8
 indent_style = space
 indent_size = 8
 
+[*.sh]
+indent_style = space
+indent_size = 4
+
 [meson.build]
 indent_style = space
 indent_size = 8
diff --git a/.vimrc b/.vimrc
index a62546d8e2aa8a834ba2f3ecdab2069b8c5958cb..d40b57a665ffde86a093240282dcf098a61f84d1 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -17,4 +17,5 @@ set expandtab
 set makeprg=GCC_COLORS=\ make
 set tw=79
 au BufRead,BufNewFile *.xml set tw=109 shiftwidth=2 smarttab
+au FileType sh set tw=80 shiftwidth=4 smarttab
 au FileType c set tw=109
index 22ab66d3dd593c18d0caea47b1709d7854a229fa..520de0ac4215f012f644cefc78687133621d4b2e 100755 (executable)
@@ -5,23 +5,23 @@ files="$(git ls-files ':/*.[ch]')"
 args=
 
 case "$1" in
-        -i)
-                args="$args --in-place"
-                shift
-                ;;
+    -i)
+        args="$args --in-place"
+        shift
+        ;;
 esac
 
 if ! parallel -h >/dev/null; then
-        echo 'Please install GNU parallel (package "parallel")'
-        exit 1
+    echo 'Please install GNU parallel (package "parallel")'
+    exit 1
 fi
 
 for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do
-        echo "--x-- Processing $SCRIPT --x--"
-        TMPFILE=`mktemp`
-        echo "+ spatch --sp-file $SCRIPT $args ..."
-        parallel --halt now,fail=1 --keep-order --noswap --max-args=20 \
-                 spatch --sp-file $SCRIPT $args ::: $files \
-                 2>"$TMPFILE" || cat "$TMPFILE"
-        echo -e "--x-- Processed $SCRIPT --x--\n"
+    echo "--x-- Processing $SCRIPT --x--"
+    TMPFILE=`mktemp`
+    echo "+ spatch --sp-file $SCRIPT $args ..."
+    parallel --halt now,fail=1 --keep-order --noswap --max-args=20 \
+             spatch --sp-file $SCRIPT $args ::: $files \
+             2>"$TMPFILE" || cat "$TMPFILE"
+    echo -e "--x-- Processed $SCRIPT --x--\n"
 done
index 073174cb401f0df4af5223267994c44369f2dcb9..89e9fbb599b3e86961a5a974d98af5b1f927531b 100755 (executable)
@@ -5,7 +5,7 @@ XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share/:/usr/share}"
 
 # add a directory if it exists
 if [[ -d /opt/foo/share ]]; then
-   XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS}
+    XDG_DATA_DIRS=/opt/foo/share:${XDG_DATA_DIRS}
 fi
 
 # write our output
index 8755b850b60b0a25350d492e67ffbaf7ad892724..ef499b8a3564398bea24322672180942ba2db0ec 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -ex
 
 # keep this in sync with setup.sh
@@ -40,4 +39,9 @@ dpkg-buildpackage -S -I -I$(basename "$SEMAPHORE_CACHE_DIR") -d -us -uc -nc
 # now build the package and run the tests
 rm -rf "$ARTIFACTS_DIR"
 # autopkgtest exits with 2 for "some tests skipped", accept that
-$AUTOPKGTESTDIR/runner/autopkgtest --apt-upgrade --env DEB_BUILD_OPTIONS=noudeb --env TEST_UPSTREAM=1 ../systemd_*.dsc -o "$ARTIFACTS_DIR" -- lxc -s $CONTAINER || [ $? -eq 2 ]
+$AUTOPKGTESTDIR/runner/autopkgtest --apt-upgrade \
+                                   --env DEB_BUILD_OPTIONS=noudeb \
+                                   --env TEST_UPSTREAM=1 ../systemd_*.dsc \
+                                   -o "$ARTIFACTS_DIR" \
+                                   -- lxc -s $CONTAINER \
+    || [ $? -eq 2 ]
index c904a300a15154d2fb99f250d312c8c623724485..c39238a4e99f1e88b4db60fdd611bc2ae0b233c3 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -ex
 
 # default to Debian testing
index 5bf244c49d1f58dc04fbae2012c6bb77f806ec74..6987877ebfd2b80e456c169c7f399238936ab550 100755 (executable)
@@ -2,5 +2,5 @@
 set -eu
 
 $1 -E -dM -include sys/socket.h -include "$2" -include "$3" - </dev/null | \
-        grep -Ev 'AF_UNSPEC|AF_MAX' | \
-        awk '/^#define[ \t]+AF_[^ \t]+[ \t]+[AP]F_[^ \t]/ { print $2; }'
+    grep -Ev 'AF_UNSPEC|AF_MAX' | \
+    awk '/^#define[ \t]+AF_[^ \t]+[ \t]+[AP]F_[^ \t]/ { print $2; }'
index 6db931c52b533a6283300783785fd59c631d5271..93cef47aa15c4cf6c85e420b77f0e5d8fb6c7de3 100755 (executable)
@@ -2,5 +2,5 @@
 set -eu
 
 $1 -dM -include linux/if_arp.h -include "$2" - </dev/null | \
-        awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
-        sed -e 's/ARPHRD_//'
+    awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+    sed -e 's/ARPHRD_//'
index 0628d2425fc91fe56f9b94443c39f8e604ba32fb..b814fa859352cccd0104e8f23667611a7b3529d6 100755 (executable)
@@ -2,5 +2,5 @@
 set -eu
 
 $1 -dM -include linux/capability.h -include "$2" -include "$3" - </dev/null | \
-        awk '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $2; }' | \
-        grep -v CAP_LAST_CAP
+    awk '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $2; }' | \
+    grep -v CAP_LAST_CAP
index 953d5e37b8180c874e70be56f241c762e04bd35d..a4bb4d285dddd08e6d679cbfd0b96feee8764bf3 100755 (executable)
@@ -2,4 +2,4 @@
 set -eu
 
 $1 -dM -include errno.h - </dev/null | \
-        awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'
+    awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'
index 8572ceedfac5c0823df23b66b44cdb039e423972..84cbd5b42bbe32a2b4c15815aff4013c72015c49 100755 (executable)
@@ -2,6 +2,6 @@
 set -eu
 
 if nm -D -u "$1" | grep ' U '; then
-        echo "Undefined symbols detected!"
-        exit 1
+    echo "Undefined symbols detected!"
+    exit 1
 fi
index 2445a02668367f5428e328de663a503dc71165be..912d0c9905a5501f530c20c387177dd788d95eaf 100755 (executable)
@@ -6,10 +6,10 @@ shift
 
 includes=""
 for i in "$@"; do
-        includes="$includes -include $i"
+    includes="$includes -include $i"
 done
 
 $cpp -dM $includes - </dev/null | \
-        grep -vE 'AUDIT_.*(FIRST|LAST)_' | \
-        sed -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | \
-        sort -k2
+    grep -vE 'AUDIT_.*(FIRST|LAST)_' | \
+    sed -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | \
+    sort -k2
index a9b1e0fb57545c7e22249a3a6ddca82d4a3adf0b..3f9197949f6c40a545168c6184607b1f00301f7b 100755 (executable)
@@ -2,5 +2,5 @@
 set -eu
 
 $1 -dM -include netinet/in.h - </dev/null | \
-        awk '/^#define[ \t]+IPPROTO_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
-        sed -e 's/IPPROTO_//'
+    awk '/^#define[ \t]+IPPROTO_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
+    sed -e 's/IPPROTO_//'
index efb0da2a843457b0daf8df1c1047253de192f564..c78652a8e9e9373aa0bcb90862462ef104c7da75 100755 (executable)
@@ -1,16 +1,18 @@
 #!/bin/sh
 set -eu
-awk '   BEGIN {
-                print "%{\n\
+
+awk '
+    BEGIN {
+        print "%{\n\
 #if __GNUC__ >= 7\n\
 _Pragma(\"GCC diagnostic ignored \\\"-Wimplicit-fallthrough\\\"\")\n\
 #endif\n\
 %}"
-                print "struct key_name { const char* name; unsigned short id; };"
-                print "%null-strings"
-                print "%%"
-        }
+        print "struct key_name { const char* name; unsigned short id; };"
+        print "%null-strings"
+        print "%%"
+    }
 
-        /^KEY_/ { print tolower(substr($1 ,5)) ", " $1 }
-                { print tolower($1) ", " $1 }
+    /^KEY_/ { print tolower(substr($1 ,5)) ", " $1 }
+    { print tolower($1) ", " $1 }
 ' < "$1"
index c055f7c7567f8ea13135a808147221e24235de13..aa00c15c1676d4820b343ea37e4cc368569a2645 100755 (executable)
@@ -2,6 +2,6 @@
 set -eu
 
 $1 -dM -include linux/input.h - </dev/null | awk '
-        /\<(KEY_(MAX|MIN_INTERESTING))|(BTN_(MISC|MOUSE|JOYSTICK|GAMEPAD|DIGI|WHEEL|TRIGGER_HAPPY))\>/  { next }
-        /^#define[ \t]+(KEY|BTN)_[^ ]+[ \t]+[0-9BK]/                                                    { print $2 }
+    /\<(KEY_(MAX|MIN_INTERESTING))|(BTN_(MISC|MOUSE|JOYSTICK|GAMEPAD|DIGI|WHEEL|TRIGGER_HAPPY))\>/  { next }
+    /^#define[ \t]+(KEY|BTN)_[^ ]+[ \t]+[0-9BK]/                                                    { print $2 }
 '
index 1c64017aaa0e8af9d56fc91bb0cee66e341f6f24..2314ec37ce5e1e91873c19688feac50a4821e1a8 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Basic systemd setup"
 RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
index 97eb2f409e813aa4462e1396c898c713da81ce06..aed1c591069b203f242ba7085b731173a03b99f0 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="cryptsetup systemd setup"
 TEST_NO_NSPAWN=1
index 93a387df5967070a67f008b5233bc09d8496c755..89125109d894554b0c17caca30ac686a6d00f0e1 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Job-related tests"
 TEST_NO_QEMU=1
index e198cb6ede0df720b7790ce97012e0329d375b8c..4e539aa151d8bc5ca50cfbf62b0f4a097f746a7b 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -x
 set -e
 set -o pipefail
index 33bfcbf681a4320ae5071dc17bcd17a9fca8b8d3..f24a8f6be7a3dc94d8f5165100458a8e20768c7d 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Journal-related tests"
 
index ba665c59689eca47fc6bfc3421320403e0220f70..b4d79c9655c4d0d1ca4742cba034e889c485833e 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -x
 set -e
 set -o pipefail
index 3eb21657968496110bdff0046cafdbcccefc7524..3c29b2ee3fe0f6e17b3cdb46d566740c1f2f90e6 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Resource limits-related tests"
 
index 153fab3aacb0a2ecd8c1dc4a9dfc1e23227cfdee..dae48cd4b2f7076b877e8c72007b72cd39c538bc 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -x
 set -e
 set -o pipefail
index 0c924ecbbdd7d498a69812013094b76a553bcd2a..2b49b3d5ae3551cba2c0871df54486da2341003a 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="SELinux tests"
 TEST_NO_NSPAWN=1
index 48f05d89fbb263af57ac544f8f2c76b5f42614d9..82339c23cda0fe83104f2a6560dfbff88518ad37 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -x
 set -e
 
index 499a36038c621600546384f44acf588386af63ee..93ddb6f5fbb28d2b5af371999f6ae8632e36110e 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/1981"
 TEST_NO_QEMU=1
index b01df3656b716efd1b57db0727185e81f0cc6527..ef2aba0e17e501c1a4f91b0d09c9f6d86e4c74b5 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2730"
 TEST_NO_NSPAWN=1
index 01eb4dbac89621747c22c672647316879a898c6f..8e7402fcd46c20238ea785f43429180157f2bba6 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2691"
 TEST_NO_NSPAWN=1
index c85433d7d33a6ee39517136c83c4215d9750fb48..dc7a9acaa102078589ddce1ac0e15abecd141c3a 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467"
 
index 38c725fa7045b13700cf09de0775a68dae62f2f9..3419b78fe797e2469856fefdcbf6467828847372 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/3166"
 TEST_NO_NSPAWN=1
index 0c267e11a6c79f483c3e72e65e08f5aea71cff9a..31cf1b471ae20d2a57b04e35b022b99e15568907 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/3171"
 TEST_NO_QEMU=1
index 774b7cbed5d8c7d790dccdc37d6b91d707677e11..bd85b92caa5cca76a7698619548b43984b87fe08 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="systemd-nspawn smoke test"
 TEST_NO_NSPAWN=1
index 94358342047cad33790903470cf521e241b0a68b..33e311a1e7ea17ac491286c20e25f11abc5717d9 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="/etc/machine-id testing"
 TEST_NO_NSPAWN=1
index ab0a58caeacaecbe82c5899f13c9d1439533d26b..02962a8a070cf11f8403be9a28cfc8372afed625 100755 (executable)
 #! /bin/bash
-
 set -e
 set -x
 
 _clear_service () {
-        systemctl stop $1.service 2>/dev/null || :
-        rm -f  /{etc,run,usr/lib}/systemd/system/$1.service
-        rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d
-        rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires}
+    systemctl stop $1.service 2>/dev/null || :
+    rm -f  /{etc,run,usr/lib}/systemd/system/$1.service
+    rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d
+    rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires}
 }
 
 clear_services () {
-        for u in $*; do
-                _clear_service $u
-        done
-        systemctl daemon-reload
+    for u in $*; do
+        _clear_service $u
+    done
+    systemctl daemon-reload
 }
 
 create_service () {
-        clear_services $1
+    clear_services $1
 
-        cat >/etc/systemd/system/$1.service<<EOF
+    cat >/etc/systemd/system/$1.service<<EOF
 [Unit]
 Description=$1 unit
 
 [Service]
 ExecStart=/bin/sleep 100000
 EOF
-        mkdir -p /{etc,run,usr/lib}/systemd/system/$1.service.d
-        mkdir -p /etc/systemd/system/$1.service.{wants,requires}
-        mkdir -p /run/systemd/system/$1.service.{wants,requires}
-        mkdir -p /usr/lib/systemd/system/$1.service.{wants,requires}
+    mkdir -p /{etc,run,usr/lib}/systemd/system/$1.service.d
+    mkdir -p /etc/systemd/system/$1.service.{wants,requires}
+    mkdir -p /run/systemd/system/$1.service.{wants,requires}
+    mkdir -p /usr/lib/systemd/system/$1.service.{wants,requires}
 }
 
 create_services () {
-        for u in $*; do
-                create_service $u
-        done
+    for u in $*; do
+        create_service $u
+    done
 }
 
 check_ok () {
-        [ $# -eq 3 ] || return
+    [ $# -eq 3 ] || return
 
-        x="$(systemctl show --value -p $2 $1)"
-        case "$x" in
-        *$3*)      return 0 ;;
-        *)         return 1
-        esac
+    x="$(systemctl show --value -p $2 $1)"
+    case "$x" in
+        *$3*) return 0 ;;
+        *)    return 1 ;;
+    esac
 }
 
 check_ko () {
-        ! check_ok "$@"
+    ! check_ok "$@"
 }
 
 test_basic_dropins () {
-        echo "Testing basic dropins..."
-
-        echo "*** test a wants b wants c"
-        create_services a b c
-        ln -s ../b.service /etc/systemd/system/a.service.wants/
-        ln -s ../c.service /etc/systemd/system/b.service.wants/
-        check_ok a Wants b.service
-        check_ok b Wants c.service
-
-        echo "*** test a wants,requires b"
-        create_services a b c
-        ln -s ../b.service /etc/systemd/system/a.service.wants/
-        ln -s ../b.service /etc/systemd/system/a.service.requires/
-        check_ok a Wants b.service
-        check_ok a Requires b.service
-
-        echo "*** test a wants nonexistent"
-        create_service a
-        ln -s ../nonexistent.service /etc/systemd/system/a.service.wants/
-        check_ok a Wants nonexistent.service
-        systemctl start a
-        systemctl stop  a
-
-        echo "*** test a requires nonexistent"
-        ln -sf ../nonexistent.service /etc/systemd/system/a.service.requires/
-        systemctl daemon-reload
-        check_ok a Requires nonexistent.service
-
-        # 'b' is already loaded when 'c' pulls it in via a dropin.
-        echo "*** test a,c require b"
-        create_services a b c
-        ln -sf ../b.service /etc/systemd/system/a.service.requires/
-        ln -sf ../b.service /etc/systemd/system/c.service.requires/
-        systemctl start a
-        check_ok c Requires b.service
-        systemctl stop a b
-
-        # 'b'  is already loaded when 'c' pulls it in via an alias dropin.
-        echo "*** test a wants alias"
-        create_services a b c
-        ln -sf c.service /etc/systemd/system/c1.service
-        ln -sf ../c.service  /etc/systemd/system/a.service.wants/
-        ln -sf ../c1.service /etc/systemd/system/b.service.wants/
-        systemctl start a
-        check_ok a Wants c.service
-        check_ok b Wants c.service
-        systemctl stop a c
-
-        clear_services a b c
+    echo "Testing basic dropins..."
+
+    echo "*** test a wants b wants c"
+    create_services a b c
+    ln -s ../b.service /etc/systemd/system/a.service.wants/
+    ln -s ../c.service /etc/systemd/system/b.service.wants/
+    check_ok a Wants b.service
+    check_ok b Wants c.service
+
+    echo "*** test a wants,requires b"
+    create_services a b c
+    ln -s ../b.service /etc/systemd/system/a.service.wants/
+    ln -s ../b.service /etc/systemd/system/a.service.requires/
+    check_ok a Wants b.service
+    check_ok a Requires b.service
+
+    echo "*** test a wants nonexistent"
+    create_service a
+    ln -s ../nonexistent.service /etc/systemd/system/a.service.wants/
+    check_ok a Wants nonexistent.service
+    systemctl start a
+    systemctl stop  a
+
+    echo "*** test a requires nonexistent"
+    ln -sf ../nonexistent.service /etc/systemd/system/a.service.requires/
+    systemctl daemon-reload
+    check_ok a Requires nonexistent.service
+
+    # 'b' is already loaded when 'c' pulls it in via a dropin.
+    echo "*** test a,c require b"
+    create_services a b c
+    ln -sf ../b.service /etc/systemd/system/a.service.requires/
+    ln -sf ../b.service /etc/systemd/system/c.service.requires/
+    systemctl start a
+    check_ok c Requires b.service
+    systemctl stop a b
+
+    # 'b'  is already loaded when 'c' pulls it in via an alias dropin.
+    echo "*** test a wants alias"
+    create_services a b c
+    ln -sf c.service /etc/systemd/system/c1.service
+    ln -sf ../c.service  /etc/systemd/system/a.service.wants/
+    ln -sf ../c1.service /etc/systemd/system/b.service.wants/
+    systemctl start a
+    check_ok a Wants c.service
+    check_ok b Wants c.service
+    systemctl stop a c
+
+    clear_services a b c
 }
 
 test_template_dropins () {
-        echo "Testing template dropins..."
+    echo "Testing template dropins..."
 
-        create_services foo bar@ yup@
+    create_services foo bar@ yup@
 
-        ln -s /etc/systemd/system/bar@.service /etc/systemd/system/foo.service.wants/bar@1.service
-        check_ok foo Wants bar@1.service
+    ln -s /etc/systemd/system/bar@.service /etc/systemd/system/foo.service.wants/bar@1.service
+    check_ok foo Wants bar@1.service
 
-        clear_services foo bar@ yup@
+    clear_services foo bar@ yup@
 }
 
 test_alias_dropins () {
-        echo "Testing alias dropins..."
-
-        echo "*** test a wants b1 alias of b"
-        create_services a b
-        ln -sf b.service /etc/systemd/system/b1.service
-        ln -sf ../b1.service /etc/systemd/system/a.service.wants/
-        check_ok a Wants b.service
-        systemctl start a
-        systemctl --quiet is-active b
-        systemctl stop a b
-        rm /etc/systemd/system/b1.service
-        clear_services a b
-
-        # A weird behavior: the dependencies for 'a' may vary. It can be
-        # changed by loading an alias...
-        #
-        # [1] 'a1' is loaded and then "renamed" into 'a'. 'a1' is therefore
-        # part of the names set so all its specific dropins are loaded.
-        #
-        # [2] 'a' is already loaded. 'a1' is simply only merged into 'a' so
-        # none of its dropins are loaded ('y' is missing from the deps).
-        echo "*** test 2"
-        create_services a x y
-        mkdir -p /etc/systemd/system/a1.service.wants/
-        ln -sf a.service /etc/systemd/system/a1.service
-        ln -sf ../x.service /etc/systemd/system/a.service.wants/
-        ln -sf ../y.service /etc/systemd/system/a1.service.wants/
-        check_ok a1 Wants x.service # see [1]
-        check_ok a1 Wants y.service
-        systemctl start a
-        check_ok a1 Wants x.service # see [2]
-        check_ko a1 Wants y.service
-        systemctl stop a x y
-        rm /etc/systemd/system/a1.service
-
-        clear_services a x y
+    echo "Testing alias dropins..."
+
+    echo "*** test a wants b1 alias of b"
+    create_services a b
+    ln -sf b.service /etc/systemd/system/b1.service
+    ln -sf ../b1.service /etc/systemd/system/a.service.wants/
+    check_ok a Wants b.service
+    systemctl start a
+    systemctl --quiet is-active b
+    systemctl stop a b
+    rm /etc/systemd/system/b1.service
+    clear_services a b
+
+    # A weird behavior: the dependencies for 'a' may vary. It can be
+    # changed by loading an alias...
+    #
+    # [1] 'a1' is loaded and then "renamed" into 'a'. 'a1' is therefore
+    # part of the names set so all its specific dropins are loaded.
+    #
+    # [2] 'a' is already loaded. 'a1' is simply only merged into 'a' so
+    # none of its dropins are loaded ('y' is missing from the deps).
+    echo "*** test 2"
+    create_services a x y
+    mkdir -p /etc/systemd/system/a1.service.wants/
+    ln -sf a.service /etc/systemd/system/a1.service
+    ln -sf ../x.service /etc/systemd/system/a.service.wants/
+    ln -sf ../y.service /etc/systemd/system/a1.service.wants/
+    check_ok a1 Wants x.service # see [1]
+    check_ok a1 Wants y.service
+    systemctl start a
+    check_ok a1 Wants x.service # see [2]
+    check_ko a1 Wants y.service
+    systemctl stop a x y
+    rm /etc/systemd/system/a1.service
+
+    clear_services a x y
 }
 
 test_masked_dropins () {
-        echo "Testing masked dropins..."
-
-        create_services a b
-
-        # 'b' is masked for both deps
-        echo "*** test a wants,requires b is masked"
-        ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
-        ln -sf /dev/null /etc/systemd/system/a.service.requires/b.service
-        check_ko a Wants b.service
-        check_ko a Requires b.service
-
-        # 'a' wants 'b' and 'b' is masked at a lower level
-        echo "*** test a wants b, mask override"
-        ln -sf ../b.service /etc/systemd/system/a.service.wants/b.service
-        ln -sf /dev/null /usr/lib/systemd/system/a.service.wants/b.service
-        check_ok a Wants b.service
-
-        # 'a' wants 'b' and 'b' is masked at a higher level
-        echo "*** test a wants b, mask"
-        ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
-        ln -sf ../b.service /usr/lib/systemd/system/a.service.wants/b.service
-        check_ko a Wants b.service
-
-        # 'a' is masked but has an override config file
-        echo "*** test a is masked but has an override"
-        create_services a b
-        ln -sf /dev/null /etc/systemd/system/a.service
-        cat >/usr/lib/systemd/system/a.service.d/override.conf <<EOF
+    echo "Testing masked dropins..."
+
+    create_services a b
+
+    # 'b' is masked for both deps
+    echo "*** test a wants,requires b is masked"
+    ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
+    ln -sf /dev/null /etc/systemd/system/a.service.requires/b.service
+    check_ko a Wants b.service
+    check_ko a Requires b.service
+
+    # 'a' wants 'b' and 'b' is masked at a lower level
+    echo "*** test a wants b, mask override"
+    ln -sf ../b.service /etc/systemd/system/a.service.wants/b.service
+    ln -sf /dev/null /usr/lib/systemd/system/a.service.wants/b.service
+    check_ok a Wants b.service
+
+    # 'a' wants 'b' and 'b' is masked at a higher level
+    echo "*** test a wants b, mask"
+    ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
+    ln -sf ../b.service /usr/lib/systemd/system/a.service.wants/b.service
+    check_ko a Wants b.service
+
+    # 'a' is masked but has an override config file
+    echo "*** test a is masked but has an override"
+    create_services a b
+    ln -sf /dev/null /etc/systemd/system/a.service
+    cat >/usr/lib/systemd/system/a.service.d/override.conf <<EOF
 [Unit]
 After=b.service
 EOF
-        check_ok a UnitFileState masked
-
-        # 'b1' is an alias for 'b': masking 'b' dep should not influence 'b1' dep
-        echo "*** test a wants b, b1, and one is masked"
-        create_services a b
-        ln -sf b.service /etc/systemd/system/b1.service
-        ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
-        ln -sf ../b1.service /usr/lib/systemd/system/a.service.wants/b1.service
-        systemctl cat a
-        systemctl show -p Wants,Requires a
-        systemctl cat b1
-        systemctl show -p Wants,Requires b1
-        check_ok a Wants b.service
-        check_ko a Wants b1.service # the alias does not show up in the list of units
-        rm /etc/systemd/system/b1.service
-
-        # 'b1' is an alias for 'b': masking 'b1' should not influence 'b' dep
-        echo "*** test a wants b, alias dep is masked"
-        create_services a b
-        ln -sf b.service /etc/systemd/system/b1.service
-        ln -sf /dev/null /etc/systemd/system/a.service.wants/b1.service
-        ln -sf ../b.service /usr/lib/systemd/system/a.service.wants/b.service
-        check_ok a Wants b.service
-        check_ko a Wants b1.service # the alias does not show up in the list of units
-        rm /etc/systemd/system/b1.service
-
-        # 'a' has Wants=b.service but also has a masking
-        # dropin 'b': 'b' should still be pulled in.
-        echo "*** test a wants b both ways"
-        create_services a b
-        ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
-        cat >/usr/lib/systemd/system/a.service.d/wants-b.conf<<EOF
+    check_ok a UnitFileState masked
+
+    # 'b1' is an alias for 'b': masking 'b' dep should not influence 'b1' dep
+    echo "*** test a wants b, b1, and one is masked"
+    create_services a b
+    ln -sf b.service /etc/systemd/system/b1.service
+    ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
+    ln -sf ../b1.service /usr/lib/systemd/system/a.service.wants/b1.service
+    systemctl cat a
+    systemctl show -p Wants,Requires a
+    systemctl cat b1
+    systemctl show -p Wants,Requires b1
+    check_ok a Wants b.service
+    check_ko a Wants b1.service # the alias does not show up in the list of units
+    rm /etc/systemd/system/b1.service
+
+    # 'b1' is an alias for 'b': masking 'b1' should not influence 'b' dep
+    echo "*** test a wants b, alias dep is masked"
+    create_services a b
+    ln -sf b.service /etc/systemd/system/b1.service
+    ln -sf /dev/null /etc/systemd/system/a.service.wants/b1.service
+    ln -sf ../b.service /usr/lib/systemd/system/a.service.wants/b.service
+    check_ok a Wants b.service
+    check_ko a Wants b1.service # the alias does not show up in the list of units
+    rm /etc/systemd/system/b1.service
+
+    # 'a' has Wants=b.service but also has a masking
+    # dropin 'b': 'b' should still be pulled in.
+    echo "*** test a wants b both ways"
+    create_services a b
+    ln -sf /dev/null /etc/systemd/system/a.service.wants/b.service
+    cat >/usr/lib/systemd/system/a.service.d/wants-b.conf<<EOF
 [Unit]
 Wants=b.service
 EOF
-        check_ok a Wants b.service
-
-        # mask a dropin that points to an nonexistent unit.
-        echo "*** test a wants nonexistent is masked"
-        create_services a
-        ln -sf /dev/null /etc/systemd/system/a.service.requires/nonexistent.service
-        ln -sf ../nonexistent.service /usr/lib/systemd/system/a.service.requires/
-        check_ko a Requires nonexistent.service
-
-        # 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
-        # masked at a higher level.
-        echo "*** test a wants b is masked"
-        create_services a b c
-        ln -sf ../b.service /etc/systemd/system/a.service.requires/
-        ln -sf ../b.service /run/systemd/system/c.service.requires/
-        ln -sf /dev/null /etc/systemd/system/c.service.requires/b.service
-        systemctl start a
-        check_ko c Requires b.service
-        systemctl stop a b
-
-        # 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
-        # masked at a lower level.
-        echo "*** test a requires b is masked"
-        create_services a b c
-        ln -sf ../b.service /etc/systemd/system/a.service.requires/
-        ln -sf ../b.service /etc/systemd/system/c.service.requires/
-        ln -sf /dev/null /run/systemd/system/c.service.requires/b.service
-        systemctl start a
-        check_ok c Requires b.service
-        systemctl stop a b
-
-        # 'a' requires 2 aliases of 'b' and one of them is a mask.
-        echo "*** test a requires alias of b, other alias masked"
-        create_services a b
-        ln -sf b.service /etc/systemd/system/b1.service
-        ln -sf b.service /etc/systemd/system/b2.service
-        ln -sf /dev/null /etc/systemd/system/a.service.requires/b1.service
-        ln -sf ../b1.service /run/systemd/system/a.service.requires/
-        ln -sf ../b2.service /usr/lib/systemd/system/a.service.requires/
-        check_ok a Requires b
-
-        # Same as above but now 'b' is masked.
-        echo "*** test a requires alias of b, b dep masked"
-        create_services a b
-        ln -sf b.service /etc/systemd/system/b1.service
-        ln -sf b.service /etc/systemd/system/b2.service
-        ln -sf ../b1.service /run/systemd/system/a.service.requires/
-        ln -sf ../b2.service /usr/lib/systemd/system/a.service.requires/
-        ln -sf /dev/null /etc/systemd/system/a.service.requires/b.service
-        check_ok a Requires b
-
-        clear_services a b
+    check_ok a Wants b.service
+
+    # mask a dropin that points to an nonexistent unit.
+    echo "*** test a wants nonexistent is masked"
+    create_services a
+    ln -sf /dev/null /etc/systemd/system/a.service.requires/nonexistent.service
+    ln -sf ../nonexistent.service /usr/lib/systemd/system/a.service.requires/
+    check_ko a Requires nonexistent.service
+
+    # 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
+    # masked at a higher level.
+    echo "*** test a wants b is masked"
+    create_services a b c
+    ln -sf ../b.service /etc/systemd/system/a.service.requires/
+    ln -sf ../b.service /run/systemd/system/c.service.requires/
+    ln -sf /dev/null /etc/systemd/system/c.service.requires/b.service
+    systemctl start a
+    check_ko c Requires b.service
+    systemctl stop a b
+
+    # 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
+    # masked at a lower level.
+    echo "*** test a requires b is masked"
+    create_services a b c
+    ln -sf ../b.service /etc/systemd/system/a.service.requires/
+    ln -sf ../b.service /etc/systemd/system/c.service.requires/
+    ln -sf /dev/null /run/systemd/system/c.service.requires/b.service
+    systemctl start a
+    check_ok c Requires b.service
+    systemctl stop a b
+
+    # 'a' requires 2 aliases of 'b' and one of them is a mask.
+    echo "*** test a requires alias of b, other alias masked"
+    create_services a b
+    ln -sf b.service /etc/systemd/system/b1.service
+    ln -sf b.service /etc/systemd/system/b2.service
+    ln -sf /dev/null /etc/systemd/system/a.service.requires/b1.service
+    ln -sf ../b1.service /run/systemd/system/a.service.requires/
+    ln -sf ../b2.service /usr/lib/systemd/system/a.service.requires/
+    check_ok a Requires b
+
+    # Same as above but now 'b' is masked.
+    echo "*** test a requires alias of b, b dep masked"
+    create_services a b
+    ln -sf b.service /etc/systemd/system/b1.service
+    ln -sf b.service /etc/systemd/system/b2.service
+    ln -sf ../b1.service /run/systemd/system/a.service.requires/
+    ln -sf ../b2.service /usr/lib/systemd/system/a.service.requires/
+    ln -sf /dev/null /etc/systemd/system/a.service.requires/b.service
+    check_ok a Requires b
+
+    clear_services a b
 }
 
 test_basic_dropins
index cc0d56da8a38ffbbff494f602dba69d2023fd492..fab127362a3d80c2e143740c78f6824d05aaa271 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Dropin tests"
 TEST_NO_QEMU=1
@@ -8,27 +6,27 @@ TEST_NO_QEMU=1
 . $TEST_BASE_DIR/test-functions
 
 test_setup() {
-        # create the basic filesystem layout
-        setup_basic_environment
+    # create the basic filesystem layout
+    setup_basic_environment
 
-        # mask some services that we do not want to run in these tests
-        ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
-        ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
-        ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service
-        ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
-        ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service
+    # mask some services that we do not want to run in these tests
+    ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
+    ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
+    ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service
+    ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
+    ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service
 
-        # import the test scripts in the rootfs and plug them in systemd
-        cp testsuite.service $initdir/etc/systemd/system/
-        cp test-dropin.sh    $initdir/
-        setup_testsuite
+    # import the test scripts in the rootfs and plug them in systemd
+    cp testsuite.service $initdir/etc/systemd/system/
+    cp test-dropin.sh    $initdir/
+    setup_testsuite
 
-        # create dedicated rootfs for nspawn (located in $TESTDIR/nspawn-root)
-        setup_nspawn_root
+    # create dedicated rootfs for nspawn (located in $TESTDIR/nspawn-root)
+    setup_nspawn_root
 }
 
 test_cleanup() {
-        return 0
+    return 0
 }
 
 do_test "$@"
index e7bb5430c0d4dd48364c5b290b5f3346aa1d7035..6613e32fc9072b349a26feaeca5cf5d13a7b563d 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="EXTEND_TIMEOUT_USEC=usec start/runtime/stop tests"
 SKIP_INITRD=yes
index 074771ab75da1464865def37d998483500e3af91..9bd6e98644adab7a634509425f211b32bf2f75b0 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="UDEV SYSTEMD_WANTS property"
 TEST_NO_NSPAWN=1
index 5f97084cee20e3b838edc82b8836924eba9fcd13..ceac3697b5f7fd701b743493800537db45e5a430 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index 783b3aac6e7fa6d79c539dd3e5e6bb3a5f26842f..277cc2c798968f7462feba3237c1c576e696281b 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="FailureAction= operation"
 
index 1867cc3c47b54f0e0153213e1333986c242f01f9..bf9c0257667a1e2f19e7471fc0fa3d91abc00bfb 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index bb0c5057b21796700383025fbe9435cfae5075d6..3ed6a1b928a0eb589bfca80cd355dd77a1dd960b 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test cgroup delegation in the unified hierarchy"
 TEST_NO_NSPAWN=1
index fdfab950b125ee1889e19a4621eb5078e3213ca2..a2cb2b875fe08d66c6c71e3ab9c8fb3cc0ef6f3f 100755 (executable)
@@ -1,39 +1,37 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
 if grep -q cgroup2 /proc/filesystems ; then
-        systemd-run --wait --unit=test0.service -p "DynamicUser=1" -p "Delegate=" \
-                    test -w /sys/fs/cgroup/system.slice/test0.service/ -a \
-                    -w /sys/fs/cgroup/system.slice/test0.service/cgroup.procs -a \
-                    -w /sys/fs/cgroup/system.slice/test0.service/cgroup.subtree_control
+    systemd-run --wait --unit=test0.service -p "DynamicUser=1" -p "Delegate=" \
+                test -w /sys/fs/cgroup/system.slice/test0.service/ -a \
+                -w /sys/fs/cgroup/system.slice/test0.service/cgroup.procs -a \
+                -w /sys/fs/cgroup/system.slice/test0.service/cgroup.subtree_control
 
-        systemd-run --wait --unit=test1.service -p "DynamicUser=1" -p "Delegate=memory pids" \
-                    grep -q memory /sys/fs/cgroup/system.slice/test1.service/cgroup.controllers
+    systemd-run --wait --unit=test1.service -p "DynamicUser=1" -p "Delegate=memory pids" \
+                grep -q memory /sys/fs/cgroup/system.slice/test1.service/cgroup.controllers
 
-        systemd-run --wait --unit=test2.service -p "DynamicUser=1" -p "Delegate=memory pids" \
-                    grep -q pids /sys/fs/cgroup/system.slice/test2.service/cgroup.controllers
+    systemd-run --wait --unit=test2.service -p "DynamicUser=1" -p "Delegate=memory pids" \
+                grep -q pids /sys/fs/cgroup/system.slice/test2.service/cgroup.controllers
 
-        # "io" is not among the controllers enabled by default for all units, verify that
-        grep -qv io /sys/fs/cgroup/system.slice/cgroup.controllers
+    # "io" is not among the controllers enabled by default for all units, verify that
+    grep -qv io /sys/fs/cgroup/system.slice/cgroup.controllers
 
-        # Run a service with "io" enabled, and verify it works
-        systemd-run --wait --unit=test3.service -p "IOAccounting=yes" -p "Slice=system-foo-bar-baz.slice"  \
-                    grep -q io /sys/fs/cgroup/system.slice/system-foo.slice/system-foo-bar.slice/system-foo-bar-baz.slice/test3.service/cgroup.controllers
+    # Run a service with "io" enabled, and verify it works
+    systemd-run --wait --unit=test3.service -p "IOAccounting=yes" -p "Slice=system-foo-bar-baz.slice"  \
+                grep -q io /sys/fs/cgroup/system.slice/system-foo.slice/system-foo-bar.slice/system-foo-bar-baz.slice/test3.service/cgroup.controllers
 
-        # We want to check if "io" is removed again from the controllers
-        # list. However, PID 1 (rightfully) does this asynchronously. In order
-        # to force synchronization on this, let's start a short-lived service
-        # which requires PID 1 to refresh the cgroup tree, so that we can
-        # verify that this all works.
-        systemd-run --wait --unit=test4.service true
+    # We want to check if "io" is removed again from the controllers
+    # list. However, PID 1 (rightfully) does this asynchronously. In order
+    # to force synchronization on this, let's start a short-lived service
+    # which requires PID 1 to refresh the cgroup tree, so that we can
+    # verify that this all works.
+    systemd-run --wait --unit=test4.service true
 
-        # And now check again, "io" should have vanished
-        grep -qv io /sys/fs/cgroup/system.slice/cgroup.controllers
+    # And now check again, "io" should have vanished
+    grep -qv io /sys/fs/cgroup/system.slice/cgroup.controllers
 else
-        echo "Skipping TEST-19-DELEGATE, as the kernel doesn't actually support cgroup v2" >&2
+    echo "Skipping TEST-19-DELEGATE, as the kernel doesn't actually support cgroup v2" >&2
 fi
 
 echo OK > /testok
index 4ec808147806e98e5224e13f835e4a293e63a82c..bf80e8b5844f95ca447c0d97de30e3d552f67c62 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test changing main PID"
 
index b183ec9a6b05803344a015af112140d36a12087e..9471a5d7342811939f65570cf7b05d298c70bc39 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index b1049e720d2d0cabe0a441b7119bd9b0cff78331..9f64e030b573a335c13245dfde595ea493b7437c 100755 (executable)
@@ -1,21 +1,19 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Sysuser-related tests"
 
 . $TEST_BASE_DIR/test-functions
 
 test_setup() {
-        mkdir -p $TESTDIR/etc/sysusers.d $TESTDIR/usr/lib/sysusers.d $TESTDIR/tmp
+    mkdir -p $TESTDIR/etc/sysusers.d $TESTDIR/usr/lib/sysusers.d $TESTDIR/tmp
 }
 
 prepare_testdir() {
-        rm -f $TESTDIR/etc/*{passwd,group,shadow}
-        for i in $1.initial-{passwd,group,shadow}; do
-                test -f $i && cp $i $TESTDIR/etc/${i#*.initial-}
-        done
-        return 0
+    rm -f $TESTDIR/etc/*{passwd,group,shadow}
+    for i in $1.initial-{passwd,group,shadow}; do
+        test -f $i && cp $i $TESTDIR/etc/${i#*.initial-}
+    done
+    return 0
 }
 
 preprocess() {
@@ -30,92 +28,92 @@ preprocess() {
 
 compare() {
     if ! diff -u $TESTDIR/etc/passwd <(preprocess ${1%.*}.expected-passwd); then
-            echo "**** Unexpected output for $f"
-            exit 1
+        echo "**** Unexpected output for $f"
+        exit 1
     fi
 
     if ! diff -u $TESTDIR/etc/group <(preprocess ${1%.*}.expected-group); then
-            echo "**** Unexpected output for $f $2"
-            exit 1
+        echo "**** Unexpected output for $f $2"
+        exit 1
     fi
 }
 
 test_run() {
-        # ensure our build of systemd-sysusers is run
-        PATH=${BUILD_DIR}:$PATH
-
-        rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/*
-
-        # happy tests
-        for f in test-*.input; do
-                echo "*** Running $f"
-                prepare_testdir ${f%.input}
-                cp $f $TESTDIR/usr/lib/sysusers.d/test.conf
-                systemd-sysusers --root=$TESTDIR
-
-                compare $f ""
-        done
-
-        for f in test-*.input; do
-                echo "*** Running $f on stdin"
-                prepare_testdir ${f%.input}
-                touch $TESTDIR/etc/sysusers.d/test.conf
-                cat $f | systemd-sysusers --root=$TESTDIR -
-
-                compare $f "on stdin"
-        done
-
-        for f in test-*.input; do
-                echo "*** Running $f on stdin with --replace"
-                prepare_testdir ${f%.input}
-                touch $TESTDIR/etc/sysusers.d/test.conf
-                # this overrides test.conf which is masked on disk
-                cat $f | systemd-sysusers --root=$TESTDIR --replace=/etc/sysusers.d/test.conf -
-                # this should be ignored
-                cat test-1.input | systemd-sysusers --root=$TESTDIR --replace=/usr/lib/sysusers.d/test.conf -
-
-                compare $f "on stdin with --replace"
-        done
-
-        # test --inline
-        echo "*** Testing --inline"
-        prepare_testdir
-        # copy a random file to make sure it is ignored
-        cp $f $TESTDIR/etc/sysusers.d/confuse.conf
-        systemd-sysusers --root=$TESTDIR --inline \
-                         "u     u1   222 -     - /bin/zsh" \
-                         "g     g1   111"
-
-        compare inline "(--inline)"
-
-        # test --replace
-        echo "*** Testing --inline with --replace"
-        prepare_testdir
-        # copy a random file to make sure it is ignored
-        cp $f $TESTDIR/etc/sysusers.d/confuse.conf
-        systemd-sysusers --root=$TESTDIR \
-                         --inline \
-                         --replace=/etc/sysusers.d/confuse.conf \
-                         "u     u1   222 -     - /bin/zsh" \
-                         "g     g1   111"
-
-        compare inline "(--inline --replace=…)"
-
-        rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/*
-
-        # tests for error conditions
-        for f in unhappy-*.input; do
-                echo "*** Running test $f"
-                prepare_testdir ${f%.input}
-                cp $f $TESTDIR/usr/lib/sysusers.d/test.conf
-                systemd-sysusers --root=$TESTDIR 2> /dev/null
-                journalctl -t systemd-sysusers -o cat | tail -n1 > $TESTDIR/tmp/err
-                if ! diff -u $TESTDIR/tmp/err  ${f%.*}.expected-err; then
-                        echo "**** Unexpected error output for $f"
-                        cat $TESTDIR/tmp/err
-                        exit 1
-                fi
-        done
+    # ensure our build of systemd-sysusers is run
+    PATH=${BUILD_DIR}:$PATH
+
+    rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/*
+
+    # happy tests
+    for f in test-*.input; do
+        echo "*** Running $f"
+        prepare_testdir ${f%.input}
+        cp $f $TESTDIR/usr/lib/sysusers.d/test.conf
+        systemd-sysusers --root=$TESTDIR
+
+        compare $f ""
+    done
+
+    for f in test-*.input; do
+        echo "*** Running $f on stdin"
+        prepare_testdir ${f%.input}
+        touch $TESTDIR/etc/sysusers.d/test.conf
+        cat $f | systemd-sysusers --root=$TESTDIR -
+
+        compare $f "on stdin"
+    done
+
+    for f in test-*.input; do
+        echo "*** Running $f on stdin with --replace"
+        prepare_testdir ${f%.input}
+        touch $TESTDIR/etc/sysusers.d/test.conf
+        # this overrides test.conf which is masked on disk
+        cat $f | systemd-sysusers --root=$TESTDIR --replace=/etc/sysusers.d/test.conf -
+        # this should be ignored
+        cat test-1.input | systemd-sysusers --root=$TESTDIR --replace=/usr/lib/sysusers.d/test.conf -
+
+        compare $f "on stdin with --replace"
+    done
+
+    # test --inline
+    echo "*** Testing --inline"
+    prepare_testdir
+    # copy a random file to make sure it is ignored
+    cp $f $TESTDIR/etc/sysusers.d/confuse.conf
+    systemd-sysusers --root=$TESTDIR --inline \
+                     "u     u1   222 -     - /bin/zsh" \
+                     "g     g1   111"
+
+    compare inline "(--inline)"
+
+    # test --replace
+    echo "*** Testing --inline with --replace"
+    prepare_testdir
+    # copy a random file to make sure it is ignored
+    cp $f $TESTDIR/etc/sysusers.d/confuse.conf
+    systemd-sysusers --root=$TESTDIR \
+                     --inline \
+                     --replace=/etc/sysusers.d/confuse.conf \
+                     "u     u1   222 -     - /bin/zsh" \
+                     "g     g1   111"
+
+    compare inline "(--inline --replace=…)"
+
+    rm -f $TESTDIR/etc/sysusers.d/* $TESTDIR/usr/lib/sysusers.d/*
+
+    # tests for error conditions
+    for f in unhappy-*.input; do
+        echo "*** Running test $f"
+        prepare_testdir ${f%.input}
+        cp $f $TESTDIR/usr/lib/sysusers.d/test.conf
+        systemd-sysusers --root=$TESTDIR 2> /dev/null
+        journalctl -t systemd-sysusers -o cat | tail -n1 > $TESTDIR/tmp/err
+        if ! diff -u $TESTDIR/tmp/err  ${f%.*}.expected-err; then
+            echo "**** Unexpected error output for $f"
+            cat $TESTDIR/tmp/err
+            exit 1
+        fi
+    done
 }
 
 do_test "$@"
index 13e191bd92a3fd1585f0da881c2ed57c56a16463..5c509f63fb8adb9ec3d349f264585df70ddfa044 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Tmpfiles related tests"
 TEST_NO_QEMU=1
index 2e76451f5b28dccd8eb7a426ef1a7d159f5ce03d..6ed22be366431de0769fcf857a0dd390f53ac8d4 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test Type=exec"
 
index 4f7cc44310f4237a5faa1a2e6f9f9997a20ce917..b161d97a7c5018c7cda33cc29155bc673fb59a10 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index fc8c89fe0aeb0642be616c01d2aef2ab8b3fe79e..038303edf8fe993bf46cf584ec40b03fa87435c7 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Run unit tests under containers"
 RUN_IN_UNPRIVILEGED_CONTAINER=yes
index 7c7a068556235e17d25e9eecf1a1eacd0c866201..e33d04d043b27cc2b74686957b0a420c37c96d3f 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 #set -ex
 #set -o pipefail
 
index 188e7233bbf90387b8aef9caf1f3c7a82e1f0188..7fe367c3be6d3f7e962f29ed0a597baa676d2b03 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test importd"
 
index 2bb96f137df6208976c10afab26d10dda0e506f7..380ba3d82defb4504f469b99a9c9e9e0fe1410e5 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index fb9c18926fa1c5b388eb726a6636df64f35f888d..9a2913d330c0ba32194fb7c53f5407f20a8832d3 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test setenv"
 
index 2d93cb49c981b2407cebc759a2b4bb807ffbba0e..0abbf95326553a00d2f593d2f4e95b03c3230322 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index 724dbef23198f1ad1a273b4f037784056aab41ff..fb35f80ec1a592c540c02e69acb4ac59c9f5e2b5 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test StandardOutput=file:"
 
index 6975b7966f234fa1a038c0ecd12e6bcd92744f7d..2c813da720e3afdeab9420689980be7638d9a4b0 100755 (executable)
@@ -1,13 +1,15 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
 systemd-analyze log-level debug
 systemd-analyze log-target console
 
-systemd-run --wait --unit=one -p StandardOutput=file:/tmp/stdout -p StandardError=file:/tmp/stderr -p Type=exec sh -c 'echo x ; echo y >&2'
+systemd-run --wait --unit=one \
+            -p StandardOutput=file:/tmp/stdout \
+            -p StandardError=file:/tmp/stderr \
+            -p Type=exec \
+            sh -c 'echo x ; echo y >&2'
 cmp /tmp/stdout <<EOF
 x
 EOF
@@ -15,7 +17,11 @@ cmp /tmp/stderr <<EOF
 y
 EOF
 
-systemd-run --wait --unit=two -p StandardOutput=file:/tmp/stdout -p StandardError=file:/tmp/stderr -p Type=exec sh -c 'echo z ; echo a >&2'
+systemd-run --wait --unit=two \
+            -p StandardOutput=file:/tmp/stdout \
+            -p StandardError=file:/tmp/stderr \
+            -p Type=exec \
+            sh -c 'echo z ; echo a >&2'
 cmp /tmp/stdout <<EOF
 z
 EOF
@@ -23,7 +29,11 @@ cmp /tmp/stderr <<EOF
 a
 EOF
 
-systemd-run --wait --unit=three -p StandardOutput=append:/tmp/stdout -p StandardError=append:/tmp/stderr -p Type=exec sh -c 'echo b ; echo c >&2'
+systemd-run --wait --unit=three \
+            -p StandardOutput=append:/tmp/stdout \
+            -p StandardError=append:/tmp/stderr \
+            -p Type=exec \
+            sh -c 'echo b ; echo c >&2'
 cmp /tmp/stdout <<EOF
 z
 b
index 68935d0da0c20ff720d8e31c8c689255315259b5..67be1d51ccc474c6e396ed9051fd832221971f6a 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="Ensure %j Wants directives work"
 RUN_IN_UNPRIVILEGED_CONTAINER=yes
index 74362c052a3f1d1b243c26e046818c8f1fd4189a..26ad2f902d1e4a094c9279c3bdead2f78ed6126f 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="UDEV ID_RENAMING property"
 TEST_NO_NSPAWN=1
index 9452c3a27bd5e6ca73a3a928a02dbbfd28b261d8..eb9b2ffb89ee51aa55651979d1ec0fd9f64173c9 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index a9b3d78d6e49fea75146f355bba0f3daf454aeec..40e6ff25cd5b9dc6cd9020b22bec47cfa45788bd 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test OnClockChange= + OnTimezoneChange="
 TEST_NO_NSPAWN=1
index 3f7c264000540ab3cca5a8f2855986240f117708..7b24922e62843fed09aaa7ee988fff13b490911e 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index d7cea733613cad77c16ed555dfd8c843f2ab7d03..7156528873dba5b187ba1846c0c4bf8d23e1dbef 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="plugged -> dead -> plugged issue #11997"
 TEST_NO_NSPAWN=1
index cb12b51bd2df7ca6550690d7247f831b83aca679..aa94d59bd3ccefd40396e8e75826cdc2da02f8cd 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index 0d2377128eb3948ca9a9a91b8dedb4aa15e99f20..74fd64d24a7183b8c13c020eb2158f7a56509814 100755 (executable)
@@ -2,9 +2,9 @@
 
 BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
 if [ $# -gt 0 ]; then
-        args="$@"
+    args="$@"
 else
-        args="clean setup run clean-again"
+    args="clean setup run clean-again"
 fi
 
 ninja -C "$BUILD_DIR"
@@ -16,35 +16,35 @@ FAILURES=0
 
 cd "$(dirname "$0")"
 for TEST in TEST-??-* ; do
-        COUNT=$(($COUNT+1))
+    COUNT=$(($COUNT+1))
 
-        echo -e "\n--x-- Running $TEST --x--"
-        set +e
-        ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args )
-        RESULT=$?
-        set -e
-        echo "--x-- Result of $TEST: $RESULT --x--"
+    echo -e "\n--x-- Running $TEST --x--"
+    set +e
+    ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args )
+    RESULT=$?
+    set -e
+    echo "--x-- Result of $TEST: $RESULT --x--"
 
-        results["$TEST"]="$RESULT"
+    results["$TEST"]="$RESULT"
 
-        [ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1))
+    [ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1))
 done
 
 echo ""
 
 for TEST in ${!results[@]}; do
-        RESULT="${results[$TEST]}"
-        if [ "$RESULT" -eq "0" ] ; then
-                echo "$TEST: SUCCESS"
-        else
-                echo "$TEST: FAIL"
-        fi
+    RESULT="${results[$TEST]}"
+    if [ "$RESULT" -eq "0" ] ; then
+        echo "$TEST: SUCCESS"
+    else
+        echo "$TEST: FAIL"
+    fi
 done | sort
 
 if [ "$FAILURES" -eq 0 ] ; then
-        echo -e "\nALL $COUNT TESTS PASSED"
+    echo -e "\nALL $COUNT TESTS PASSED"
 else
-        echo -e "\nTOTAL FAILURES: $FAILURES OF $COUNT"
+    echo -e "\nTOTAL FAILURES: $FAILURES OF $COUNT"
 fi
 
 exit "$FAILURES"
index 0216c83c12d844d794e68cd7a34f6f234a095181..592b20afcf0886b3a05bd55a056f884a7b4bff12 100755 (executable)
@@ -5,7 +5,7 @@ systemd_efi="$2"
 boot_stub="$3"
 splash_bmp="$4"
 if [ -z "$out" -o -z "$systemd_efi" -o -z "$boot_stub" -o -z "$splash_bmp" ]; then
-        exit 1
+    exit 1
 fi
 
 # create GPT table with EFI System Partition
@@ -27,12 +27,12 @@ cp "$systemd_efi" mnt/EFI/BOOT/BOOTX64.efi
 mkdir mnt/EFI/Linux
 echo -n "foo=yes bar=no root=/dev/fakeroot debug rd.break=initqueue" >mnt/cmdline.txt
 objcopy \
-        --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
-        --add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \
-        --add-section .splash="$splash_bmp" --change-section-vma .splash=0x40000 \
-        --add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \
-        --add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \
-        "$boot_stub" mnt/EFI/Linux/linux-test.efi
+    --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
+    --add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \
+    --add-section .splash="$splash_bmp" --change-section-vma .splash=0x40000 \
+    --add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \
+    --add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \
+    "$boot_stub" mnt/EFI/Linux/linux-test.efi
 
 # install entries
 mkdir -p mnt/loader/entries
index 6016fd21ace53b8d99fc727cf102cc2655f9a2b5..50c6e9690251a6c2b5c2a347ec4e0ce5a99c7799 100644 (file)
@@ -159,15 +159,15 @@ run_qemu() {
         exit 1
     fi
 
-if [[ "$LOOKS_LIKE_SUSE" ]]; then
-    PARAMS+="rd.hostonly=0"
-elif [[ "$LOOKS_LIKE_ARCH" ]]; then
-    PARAMS+="rw"
-else
-    PARAMS+="ro"
-fi
+    if [[ "$LOOKS_LIKE_SUSE" ]]; then
+        PARAMS+="rd.hostonly=0"
+    elif [[ "$LOOKS_LIKE_ARCH" ]]; then
+        PARAMS+="rw"
+    else
+        PARAMS+="ro"
+    fi
 
-KERNEL_APPEND="$PARAMS \
+    KERNEL_APPEND="$PARAMS \
 root=/dev/sda1 \
 raid=noautodetect \
 loglevel=2 \
@@ -1639,7 +1639,7 @@ do_test() {
         exit 0
     fi
 
-# Detect lib paths
+    # Detect lib paths
     [[ $libdir ]] || for libdir in /lib64 /lib; do
         [[ -d $libdir ]] && libdirs+=" $libdir" && break
     done
index c1db99b18af886a1b5e0ff392d50f19f029c5cad..5b1bf17219ebe752d1fd7d993873eb10564b66c5 100755 (executable)
@@ -4,7 +4,7 @@ set -eu
 cd "$MESON_SOURCE_ROOT"
 
 if [ ! -f .git/hooks/pre-commit.sample -o -f .git/hooks/pre-commit ]; then
-        exit 2 # not needed
+    exit 2 # not needed
 fi
 
 cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit
index 99f8f9d4519eabffebe36f903b9bbdca54632730..e8c6e600407ac5764f632ef24a582b0f32414790 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -e
 
 function generate_directives() {
@@ -12,18 +11,18 @@ function generate_directives() {
 
 ret=0
 if [[ $(generate_directives src/network/networkd-network-gperf.gperf | wc -l) -ne $(wc -l <test/fuzz/fuzz-network-parser/directives.network) ]]; then
-       echo "Looks like test/fuzz/fuzz-network-parser/directives.network hasn't been updated"
-        ret=1
+    echo "Looks like test/fuzz/fuzz-network-parser/directives.network hasn't been updated"
+    ret=1
 fi
 
 if [[ $(generate_directives src/network/netdev/netdev-gperf.gperf | wc -l) -ne $(wc -l <test/fuzz/fuzz-netdev-parser/directives.netdev) ]]; then
-       echo "Looks like test/fuzz/fuzz-netdev-parser/directives.netdev hasn't been updated"
-       ret=1
+    echo "Looks like test/fuzz/fuzz-netdev-parser/directives.netdev hasn't been updated"
+    ret=1
 fi
 
 if [[ $(generate_directives src/udev/net/link-config-gperf.gperf | wc -l) -ne $(wc -l <test/fuzz/fuzz-link-parser/directives.link) ]]; then
-       echo "Looks like test/fuzz/fuzz-link-parser/directives.link hasn't been updated"
-       ret=1
+    echo "Looks like test/fuzz/fuzz-link-parser/directives.link hasn't been updated"
+    ret=1
 fi
 
 exit $ret
index 3b3003835cebe3877ff0181cc2573441045c537f..da9768ad7c3ea87f932ba0f328744e68ff5943ae 100755 (executable)
@@ -1,12 +1,11 @@
 #!/bin/sh
-
 set -e
 
 # Fedora uses C.utf8 but Debian uses C.UTF-8
 if locale -a | grep -xq -E 'C\.(utf8|UTF-8)'; then
-        echo 'C.UTF-8'
+    echo 'C.UTF-8'
 elif locale -a | grep -xqF 'en_US.utf8'; then
-        echo 'en_US.UTF-8'
+    echo 'en_US.UTF-8'
 else
-        echo 'C'
+    echo 'C'
 fi
index af4c920cd2b353c91dc129e86679c22c7fc27801..5842eeb81f6e3ecbf33fae36a0be6e66d1064f2d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/env bash
+#!/bin/bash
 
 # The official unmodified version of the script can be found at
 # https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh
@@ -24,32 +24,32 @@ echo -e "\033[33;1mNote: COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN are
 
 # Do not run on pull requests
 if [ "${TRAVIS_PULL_REQUEST}" = "true" ]; then
-  echo -e "\033[33;1mINFO: Skipping Coverity Analysis: branch is a pull request.\033[0m"
-  exit 0
+    echo -e "\033[33;1mINFO: Skipping Coverity Analysis: branch is a pull request.\033[0m"
+    exit 0
 fi
 
 # Verify this branch should run
 if [[ "${TRAVIS_BRANCH^^}" =~ "${COVERITY_SCAN_BRANCH_PATTERN^^}" ]]; then
-  echo -e "\033[33;1mCoverity Scan configured to run on branch ${TRAVIS_BRANCH}\033[0m"
+    echo -e "\033[33;1mCoverity Scan configured to run on branch ${TRAVIS_BRANCH}\033[0m"
 else
-  echo -e "\033[33;1mCoverity Scan NOT configured to run on branch ${TRAVIS_BRANCH}\033[0m"
-  exit 1
+    echo -e "\033[33;1mCoverity Scan NOT configured to run on branch ${TRAVIS_BRANCH}\033[0m"
+    exit 1
 fi
 
 # Verify upload is permitted
 AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted`
 if [ "$AUTH_RES" = "Access denied" ]; then
-  echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m"
-  exit 1
-else
-  AUTH=`echo $AUTH_RES | python -c "import sys, json; print(json.load(sys.stdin)['upload_permitted'])"`
-  if [ "$AUTH" = "True" ]; then
-    echo -e "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m"
-  else
-    WHEN=`echo $AUTH_RES | python -c "import sys, json; print(json.load(sys.stdin)['next_upload_permitted_at'])"`
-    echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m"
+    echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m"
     exit 1
-  fi
+else
+    AUTH=`echo $AUTH_RES | python -c "import sys, json; print(json.load(sys.stdin)['upload_permitted'])"`
+    if [ "$AUTH" = "True" ]; then
+        echo -e "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m"
+    else
+        WHEN=`echo $AUTH_RES | python -c "import sys, json; print(json.load(sys.stdin)['next_upload_permitted_at'])"`
+        echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m"
+        exit 1
+    fi
 fi
 
 TOOL_DIR=`find $TOOL_BASE -type d -name 'cov-analysis*'`
@@ -62,8 +62,8 @@ export CCACHE_DISABLE=1
 # --------------------
 _help()
 {
-       # displays help and exits
-       cat <<-EOF
+    # displays help and exits
+    cat <<-EOF
                USAGE: $0 [CMD] [OPTIONS]
 
                CMD
@@ -87,98 +87,98 @@ _help()
                  -t, --tar ARCHIVE  Use custom .tgz archive instead of intermediate directory or pre-archived .tgz
                          (by default 'analysis-result.tgz'
        EOF
-       return;
+    return;
 }
 
 _pack()
 {
-       RESULTS_ARCHIVE=${RESULTS_ARCHIVE:-'analysis-results.tgz'}
+    RESULTS_ARCHIVE=${RESULTS_ARCHIVE:-'analysis-results.tgz'}
 
-       echo -e "\033[33;1mTarring Coverity Scan Analysis results...\033[0m"
-       tar czf $RESULTS_ARCHIVE $RESULTS_DIR
-       SHA=`git rev-parse --short HEAD`
+    echo -e "\033[33;1mTarring Coverity Scan Analysis results...\033[0m"
+    tar czf $RESULTS_ARCHIVE $RESULTS_DIR
+    SHA=`git rev-parse --short HEAD`
 
-       PACKED=true
+    PACKED=true
 }
 
 
 _build()
 {
-       echo -e "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m"
-       local _cov_build_options=""
-       #local _cov_build_options="--return-emit-failures 8 --parse-error-threshold 85"
-       eval "${COVERITY_SCAN_BUILD_COMMAND_PREPEND}"
-       COVERITY_UNSUPPORTED=1 cov-build --dir $RESULTS_DIR $_cov_build_options sh -c "$COVERITY_SCAN_BUILD_COMMAND"
-       cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt
-
-       if [ $? != 0 ]; then
-         echo -e "\033[33;1mCoverity Scan Build failed: $TEXT.\033[0m"
-               return 1
-       fi
-
-       [ -z $TAR ] || [ $TAR = false ] && return 0
-
-       if [ "$TAR" = true ]; then
-               _pack
-       fi
+    echo -e "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m"
+    local _cov_build_options=""
+    #local _cov_build_options="--return-emit-failures 8 --parse-error-threshold 85"
+    eval "${COVERITY_SCAN_BUILD_COMMAND_PREPEND}"
+    COVERITY_UNSUPPORTED=1 cov-build --dir $RESULTS_DIR $_cov_build_options sh -c "$COVERITY_SCAN_BUILD_COMMAND"
+    cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt
+
+    if [ $? != 0 ]; then
+       echo -e "\033[33;1mCoverity Scan Build failed: $TEXT.\033[0m"
+       return 1
+    fi
+
+    [ -z $TAR ] || [ $TAR = false ] && return 0
+
+    if [ "$TAR" = true ]; then
+       _pack
+    fi
 }
 
 
 _upload()
 {
-       # pack results
-       [ -z $PACKED ] || [ $PACKED = false ] && _pack
-
-       # Upload results
-       echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m"
-       response=$(curl \
-         --silent --write-out "\n%{http_code}\n" \
-         --form project=$COVERITY_SCAN_PROJECT_NAME \
-         --form token=$COVERITY_SCAN_TOKEN \
-         --form email=$COVERITY_SCAN_NOTIFICATION_EMAIL \
-         --form file=@$RESULTS_ARCHIVE \
-         --form version=$SHA \
-         --form description="Travis CI build" \
-         $UPLOAD_URL)
-       printf "\033[33;1mThe response is\033[0m\n%s\n" "$response"
-       status_code=$(echo "$response" | sed -n '$p')
-       # Coverity Scan used to respond with 201 on successfully receieving analysis results.
-       # Now for some reason it sends 200 and may change back in the foreseeable future.
-       # See https://github.com/pmem/pmdk/commit/7b103fd2dd54b2e5974f71fb65c81ab3713c12c5
-       if [ "$status_code" != "200" ]; then
-         TEXT=$(echo "$response" | sed '$d')
-         echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m"
-         exit 1
-       fi
-
-       echo -e "\n\033[33;1mCoverity Scan Analysis completed succesfully.\033[0m"
-       exit 0
+    # pack results
+    [ -z $PACKED ] || [ $PACKED = false ] && _pack
+
+    # Upload results
+    echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m"
+    response=$(curl \
+                  --silent --write-out "\n%{http_code}\n" \
+                  --form project=$COVERITY_SCAN_PROJECT_NAME \
+                  --form token=$COVERITY_SCAN_TOKEN \
+                  --form email=$COVERITY_SCAN_NOTIFICATION_EMAIL \
+                  --form file=@$RESULTS_ARCHIVE \
+                  --form version=$SHA \
+                  --form description="Travis CI build" \
+                  $UPLOAD_URL)
+    printf "\033[33;1mThe response is\033[0m\n%s\n" "$response"
+    status_code=$(echo "$response" | sed -n '$p')
+    # Coverity Scan used to respond with 201 on successfully receieving analysis results.
+    # Now for some reason it sends 200 and may change back in the foreseeable future.
+    # See https://github.com/pmem/pmdk/commit/7b103fd2dd54b2e5974f71fb65c81ab3713c12c5
+    if [ "$status_code" != "200" ]; then
+       TEXT=$(echo "$response" | sed '$d')
+       echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m"
+       exit 1
+    fi
+
+    echo -e "\n\033[33;1mCoverity Scan Analysis completed succesfully.\033[0m"
+    exit 0
 }
 
 # PARSE COMMAND LINE OPTIONS
 # --------------------------
 
 case $1 in
-       -h|--help)
-               _help
-               exit 0
-               ;;
-       build)
-               CMD='build'
-               TEMP=`getopt -o ho:t --long help,out-dir:,tar -n '$0' -- "$@"`
-               _ec=$?
-               [[ $_ec -gt 0 ]] && _help && exit $_ec
-               shift
-               ;;
-       upload)
-               CMD='upload'
-               TEMP=`getopt -o hd:t: --long help,result-dir:tar: -n '$0' -- "$@"`
-               _ec=$?
-               [[ $_ec -gt 0 ]] && _help && exit $_ec
-               shift
-               ;;
-       *)
-               _help && exit 1 ;;
+    -h|--help)
+       _help
+       exit 0
+       ;;
+    build)
+       CMD='build'
+       TEMP=`getopt -o ho:t --long help,out-dir:,tar -n '$0' -- "$@"`
+       _ec=$?
+       [[ $_ec -gt 0 ]] && _help && exit $_ec
+       shift
+       ;;
+    upload)
+       CMD='upload'
+       TEMP=`getopt -o hd:t: --long help,result-dir:tar: -n '$0' -- "$@"`
+       _ec=$?
+       [[ $_ec -gt 0 ]] && _help && exit $_ec
+       shift
+       ;;
+    *)
+       _help && exit 1 ;;
 esac
 
 RESULTS_DIR='cov-int'
@@ -188,46 +188,46 @@ if [ $? != 0 ] ; then exit 1 ; fi
 
 # extract options and their arguments into variables.
 if [[ $CMD == 'build' ]]; then
-       TAR=false
-       while true ; do
-                       case $1 in
-                               -h|--help)
-                                       _help
-                                       exit 0
-                                       ;;
-                               -o|--out-dir)
-                                       RESULTS_DIR="$2"
-                                       shift 2
-                                       ;;
-                               -t|--tar)
-                                       TAR=true
-                                       shift
-                                       ;;
-                       --) _build; shift ; break ;;
-                       *) echo "Internal error" ; _help && exit 6 ;;
-               esac
-       done
+    TAR=false
+    while true ; do
+       case $1 in
+           -h|--help)
+               _help
+               exit 0
+               ;;
+           -o|--out-dir)
+               RESULTS_DIR="$2"
+               shift 2
+               ;;
+           -t|--tar)
+               TAR=true
+               shift
+               ;;
+           --) _build; shift ; break ;;
+           *) echo "Internal error" ; _help && exit 6 ;;
+       esac
+    done
 
 elif [[ $CMD == 'upload' ]]; then
-       while true ; do
-                       case $1 in
-                               -h|--help)
-                                       _help
-                                       exit 0
-                                       ;;
-                               -d|--result-dir)
-                                       CHANGE_DEFAULT_DIR=true
-                                       RESULTS_DIR="$2"
-                                       shift 2
-                                       ;;
-                               -t|--tar)
-                                       RESULTS_ARCHIVE="$2"
-                                       [ -z $CHANGE_DEFAULT_DIR ] || [ $CHANGE_DEFAULT_DIR = false ] && PACKED=true
-                                       shift 2
-                                       ;;
-                       --) _upload; shift ; break ;;
-                       *) echo "Internal error" ; _help && exit 6 ;;
-               esac
-       done
+    while true ; do
+       case $1 in
+           -h|--help)
+               _help
+               exit 0
+               ;;
+           -d|--result-dir)
+               CHANGE_DEFAULT_DIR=true
+               RESULTS_DIR="$2"
+               shift 2
+               ;;
+           -t|--tar)
+               RESULTS_ARCHIVE="$2"
+               [ -z $CHANGE_DEFAULT_DIR ] || [ $CHANGE_DEFAULT_DIR = false ] && PACKED=true
+               shift 2
+               ;;
+           --) _upload; shift ; break ;;
+           *) echo "Internal error" ; _help && exit 6 ;;
+       esac
+    done
 
 fi
index 06b6297ea5d91efd2349b90c941f473d7073cb0e..fb8a1c17a371a150d0d50990d1c975a5f12e4ad7 100755 (executable)
@@ -5,28 +5,28 @@ set -e
 # we look for subdirectories of the parent directory that look like ninja build dirs.
 
 if [ -n "$BUILD_DIR" ]; then
-        echo "$(realpath "$BUILD_DIR")"
-        exit 0
+    echo "$(realpath "$BUILD_DIR")"
+    exit 0
 fi
 
 root="$(dirname "$(realpath "$0")")"
 
 found=
 for i in "$root"/../*/build.ninja; do
-        c="$(dirname $i)"
-        [ -d "$c" ] || continue
-        [ "$(basename "$c")" != mkosi.builddir ] || continue
+    c="$(dirname $i)"
+    [ -d "$c" ] || continue
+    [ "$(basename "$c")" != mkosi.builddir ] || continue
 
-        if [ -n "$found" ]; then
-                echo 'Found multiple candidates, specify build directory with $BUILD_DIR' >&2
-                exit 2
-        fi
-        found="$c"
+    if [ -n "$found" ]; then
+        echo 'Found multiple candidates, specify build directory with $BUILD_DIR' >&2
+        exit 2
+    fi
+    found="$c"
 done
 
 if [ -z "$found" ]; then
-        echo 'Specify build directory with $BUILD_DIR' >&2
-        exit 1
+    echo 'Specify build directory with $BUILD_DIR' >&2
+    exit 1
 fi
 
 echo "$(realpath $found)"
index 6a6790b4b2ab1eda8e53f47f450fbd711f959687..51204eb7c9052dc625362cb9476634dfaa7ce2ed 100755 (executable)
@@ -4,39 +4,38 @@
 TOP=`git rev-parse --show-toplevel`
 
 case "$1" in
-
-        recdiff)
-                if [ "$2" = "" ] ; then
-                        DIR="$TOP"
-                else
-                        DIR="$2"
-                fi
-
-                find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \;
-                ;;
-
-        recpatch)
-                if [ "$2" = "" ] ; then
-                        DIR="$TOP"
-                else
-                        DIR="$2"
-                fi
-
-                find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \;
-                ;;
-
-        diff)
-                T=`mktemp`
-                sed '/^$/N;/^\n$/D' < "$2" > "$T"
-                diff -u "$2" "$T"
-                rm -f "$T"
-                ;;
-
-        patch)
-                sed -i '/^$/N;/^\n$/D' "$2"
-                ;;
-
-        *)
-                echo "Expected recdiff|recpatch|diff|patch as verb." >&2
-                ;;
+    recdiff)
+        if [ "$2" = "" ] ; then
+            DIR="$TOP"
+        else
+            DIR="$2"
+        fi
+
+        find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \;
+        ;;
+
+    recpatch)
+        if [ "$2" = "" ] ; then
+            DIR="$TOP"
+        else
+            DIR="$2"
+        fi
+
+        find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \;
+        ;;
+
+    diff)
+        T=`mktemp`
+        sed '/^$/N;/^\n$/D' < "$2" > "$T"
+        diff -u "$2" "$T"
+        rm -f "$T"
+        ;;
+
+    patch)
+        sed -i '/^$/N;/^\n$/D' "$2"
+        ;;
+
+    *)
+        echo "Expected recdiff|recpatch|diff|patch as verb." >&2
+        ;;
 esac
index e32eac8f3297848bc3692ec26a01e02b2d1a6685..95249f9c9cdc760640dd2d0a6f5c57a1962fe11a 100755 (executable)
@@ -4,39 +4,38 @@
 TOP=`git rev-parse --show-toplevel`
 
 case "$1" in
-
-        recdiff)
-                if [ "$2" = "" ] ; then
-                        DIR="$TOP"
-                else
-                        DIR="$2"
-                fi
-
-                find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \;
-                ;;
-
-        recpatch)
-                if [ "$2" = "" ] ; then
-                        DIR="$TOP"
-                else
-                        DIR="$2"
-                fi
-
-                find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \;
-                ;;
-
-        diff)
-                T=`mktemp`
-                sed 's/\t/        /g' < "$2" > "$T"
-                diff -u "$2" "$T"
-                rm -f "$T"
-                ;;
-
-        patch)
-                sed -i 's/\t/        /g' "$2"
-                ;;
-
-        *)
-                echo "Expected recdiff|recpatch|diff|patch as verb." >&2
-                ;;
+    recdiff)
+        if [ "$2" = "" ] ; then
+            DIR="$TOP"
+        else
+            DIR="$2"
+        fi
+
+        find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \;
+        ;;
+
+    recpatch)
+        if [ "$2" = "" ] ; then
+            DIR="$TOP"
+        else
+            DIR="$2"
+        fi
+
+        find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \;
+        ;;
+
+    diff)
+        T=`mktemp`
+        sed 's/\t/        /g' < "$2" > "$T"
+        diff -u "$2" "$T"
+        rm -f "$T"
+        ;;
+
+    patch)
+        sed -i 's/\t/        /g' "$2"
+        ;;
+
+    *)
+        echo "Expected recdiff|recpatch|diff|patch as verb." >&2
+        ;;
 esac
index 6abe177ac51a8b21e34fcdd0f9259d6cd9d27a2d..5fad8cd94fc46a6377a0bb01ae227f00542ed987 100755 (executable)
@@ -5,18 +5,18 @@ CONFIG=$1
 TARGET=$2
 
 if [ $# -ne 2 ]; then
-        echo 'Invalid number of arguments.'
-        exit 1
+    echo 'Invalid number of arguments.'
+    exit 1
 fi
 
 if [ ! -f $CONFIG ]; then
-        echo "$CONFIG not found."
-        exit 2
+    echo "$CONFIG not found."
+    exit 2
 fi
 
 if [ ! -f $TARGET ]; then
-        echo "$TARGET not found."
-        exit 3
+    echo "$TARGET not found."
+    exit 3
 fi
 
 DEFINES=$(awk '$1 == "#define" && $3 == "1" { printf "-D%s ", $2 }' $CONFIG)
index a654368f9e497839082ed103074c322e689107c4..bd320562adc82c1c18d30ea45476c8a16f634bff 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/sh
-
 set -eu
 
 sd_good=0
@@ -8,27 +7,27 @@ udev_good=0
 udev_total=0
 
 for symbol in `nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | sort -u` ; do
-        if test -f ${MESON_BUILD_ROOT}/man/$symbol.3 ; then
-                echo "✓ Symbol $symbol() is documented."
-                good=1
-        else
-                printf "  \x1b[1;31mSymbol $symbol() lacks documentation.\x1b[0m\n"
-                good=0
-        fi
+    if test -f ${MESON_BUILD_ROOT}/man/$symbol.3 ; then
+        echo "✓ Symbol $symbol() is documented."
+        good=1
+    else
+        printf "  \x1b[1;31mSymbol $symbol() lacks documentation.\x1b[0m\n"
+        good=0
+    fi
 
-        case $symbol in
-                sd_*)
-                        ((sd_good+=good))
-                        ((sd_total+=1))
-                        ;;
-                udev_*)
-                        ((udev_good+=good))
-                        ((udev_total+=1))
-                        ;;
-                *)
-                        echo 'unknown symbol prefix'
-                        exit 1
-        esac
+    case $symbol in
+        sd_*)
+            ((sd_good+=good))
+            ((sd_total+=1))
+            ;;
+        udev_*)
+            ((udev_good+=good))
+            ((udev_total+=1))
+            ;;
+        *)
+            echo 'unknown symbol prefix'
+            exit 1
+    esac
 done
 
 echo "libsystemd: $sd_good/$sd_total libudev: $udev_good/$udev_total"
index 69157105f290af2d3e37afeba4ff428e10c6cc56..a0e304ca9c8de458fb1f9142db06873b818b97d5 100755 (executable)
@@ -5,19 +5,19 @@ export SYSTEMD_LOG_LEVEL=info
 
 # output width
 if "$1"  --help | grep -v 'default:' | grep -E -q '.{80}.'; then
-        echo "$(basename "$1") --help output is too wide:"
-        "$1"  --help | awk 'length > 80' | grep -E --color=yes '.{80}'
-        exit 1
+    echo "$(basename "$1") --help output is too wide:"
+    "$1"  --help | awk 'length > 80' | grep -E --color=yes '.{80}'
+    exit 1
 fi
 
 # no --help output to stdout
 if "$1" --help 2>&1 1>/dev/null | grep .; then
-        echo "$(basename "$1") --help prints to stderr"
-        exit 2
+    echo "$(basename "$1") --help prints to stderr"
+    exit 2
 fi
 
 # error output to stderr
 if ! "$1" --no-such-parameter 2>&1 1>/dev/null | grep -q .; then
-        echo "$(basename "$1") with an unknown parameter does not print to stderr"
-        exit 3
+    echo "$(basename "$1") with an unknown parameter does not print to stderr"
+    exit 3
 fi
index 514daa0949a709b26f6530392ea0d3f58f293427..b40e97ba624088b0535bd38e5af28a44b6f8f28e 100755 (executable)
@@ -2,8 +2,8 @@
 set -eu
 
 git shortlog -s `git describe --abbrev=0`.. | \
-        cut -c8- | \
-        sed 's/ / /g' | \
-        awk '{ print $$0 "," }' | \
-        sed -e 's/ / /g' | \
-        sort -u
+    cut -c8- | \
+    sed 's/ / /g' | \
+    awk '{ print $$0 "," }' | \
+    sed -e 's/ / /g' | \
+    sort -u
index 8bdc58ac7f637295506cd65cec8becfe9eb33fd4..39efd75192b2ebf6a068e3f8575411a79c75e025 100755 (executable)
@@ -5,23 +5,23 @@ cd "$1"
 
 unset permissive
 if [ "${2:-}" = "-p" ]; then
-        permissive=1
-        shift
+    permissive=1
+    shift
 else
-        permissive=0
+    permissive=0
 fi
 
 if [ "${2:-}" != "-n" ]; then (
-        [ -z "$permissive" ] || set +e
-        set -x
+    [ -z "$permissive" ] || set +e
+    set -x
 
-        curl -L -o usb.ids 'http://www.linux-usb.org/usb.ids'
-        curl -L -o pci.ids 'http://pci-ids.ucw.cz/v2.2/pci.ids'
-        curl -L -o ma-large.txt 'http://standards-oui.ieee.org/oui/oui.txt'
-        curl -L -o ma-medium.txt 'http://standards-oui.ieee.org/oui28/mam.txt'
-        curl -L -o ma-small.txt 'http://standards-oui.ieee.org/oui36/oui36.txt'
-        curl -L -o pnp_id_registry.html 'https://uefi.org/uefi-pnp-export'
-        curl -L -o acpi_id_registry.html 'https://uefi.org/uefi-acpi-export'
+    curl -L -o usb.ids 'http://www.linux-usb.org/usb.ids'
+    curl -L -o pci.ids 'http://pci-ids.ucw.cz/v2.2/pci.ids'
+    curl -L -o ma-large.txt 'http://standards-oui.ieee.org/oui/oui.txt'
+    curl -L -o ma-medium.txt 'http://standards-oui.ieee.org/oui28/mam.txt'
+    curl -L -o ma-small.txt 'http://standards-oui.ieee.org/oui36/oui36.txt'
+    curl -L -o pnp_id_registry.html 'https://uefi.org/uefi-pnp-export'
+    curl -L -o acpi_id_registry.html 'https://uefi.org/uefi-acpi-export'
 ) fi
 
 set -x
index 501cd43d47cb5b66ec8939c9c0b5b0377b18804b..da0d13a341fed819dae7c8bf17a6ccd40b58594c 100755 (executable)
@@ -6,7 +6,7 @@ set -eu
 
 mkdir -vp "$(dirname "${DESTDIR:-}$2")"
 if [ "$(dirname $1)" = . ]; then
-        ln -vfs -T "$1" "${DESTDIR:-}$2"
+    ln -vfs -T "$1" "${DESTDIR:-}$2"
 else
-        ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
+    ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
 fi
index c8033d00a172c28c9c4d5671bb4918c5ab3fe505..a8605b6bc94167b6ea2df7dc265be171da1c7e53 100755 (executable)
@@ -8,8 +8,8 @@ tag="$2"
 fallback="$3"
 
 if [ -n "$tag" ]; then
-        echo "$tag"
-        exit 0
+    echo "$tag"
+    exit 0
 fi
 
 # Apparently git describe has a bug where it always considers the work-tree
index 9a116be114243a7e1d4f14537de643438d8cc5d6..610bb9c2353cda83c8e0cf593a076f1dc95d7cd3 100755 (executable)
@@ -29,7 +29,7 @@ mkdir -p $build
 
 fuzzflag="oss-fuzz=true"
 if [ -z "$FUZZING_ENGINE" ]; then
-        fuzzflag="llvm-fuzz=true"
+    fuzzflag="llvm-fuzz=true"
 fi
 
 meson $build -D$fuzzflag -Db_lundef=false
@@ -38,7 +38,7 @@ ninja -C $build fuzzers
 # The seed corpus is a separate flat archive for each fuzzer,
 # with a fixed name ${fuzzer}_seed_corpus.zip.
 for d in "$(dirname "$0")/../test/fuzz/fuzz-"*; do
-        zip -jqr $OUT/$(basename "$d")_seed_corpus.zip "$d"
+    zip -jqr $OUT/$(basename "$d")_seed_corpus.zip "$d"
 done
 
 # get fuzz-dns-packet corpus
index acf6ad15e461bfeadaa11b66d87cfbdffc58b660..59de6638d6c2cff6fccfefbb22c9b1ad229328a3 100644 (file)
@@ -3,59 +3,59 @@
 # as soon as Travis CI has started to provide an easy way to export the functions to bash scripts.
 
 travis_jigger() {
-  local cmd_pid="${1}"
-  shift
-  local timeout="${1}"
-  shift
-  local count=0
-
-  echo -e "\\n"
-
-  while [[ "${count}" -lt "${timeout}" ]]; do
-    count="$((count + 1))"
-    echo -ne "Still running (${count} of ${timeout}): ${*}\\r"
-    sleep 60
-  done
-
-  echo -e "\\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"${*}\"${ANSI_RESET}\\n"
-  kill -9 "${cmd_pid}"
+    local cmd_pid="${1}"
+    shift
+    local timeout="${1}"
+    shift
+    local count=0
+
+    echo -e "\\n"
+
+    while [[ "${count}" -lt "${timeout}" ]]; do
+        count="$((count + 1))"
+        echo -ne "Still running (${count} of ${timeout}): ${*}\\r"
+        sleep 60
+    done
+
+    echo -e "\\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"${*}\"${ANSI_RESET}\\n"
+    kill -9 "${cmd_pid}"
 }
 
 travis_wait() {
-  local timeout="${1}"
-
-  if [[ "${timeout}" =~ ^[0-9]+$ ]]; then
-    shift
-  else
-    timeout=20
-  fi
-
-  local cmd=("${@}")
-  local log_file="travis_wait_${$}.log"
-
-  "${cmd[@]}" &>"${log_file}" &
-  local cmd_pid="${!}"
-
-  travis_jigger "${!}" "${timeout}" "${cmd[@]}" &
-  local jigger_pid="${!}"
-  local result
-
-  {
-    set +e
-    wait "${cmd_pid}" 2>/dev/null
-    result="${?}"
-    ps -p"${jigger_pid}" &>/dev/null && kill "${jigger_pid}"
-    set -e
-  }
-
-  if [[ "${result}" -eq 0 ]]; then
-    echo -e "\\n${ANSI_GREEN}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
-  else
-    echo -e "\\n${ANSI_RED}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
-  fi
-
-  echo -e "\\n${ANSI_GREEN}Log:${ANSI_RESET}\\n"
-  cat "${log_file}"
-
-  return "${result}"
+    local timeout="${1}"
+
+    if [[ "${timeout}" =~ ^[0-9]+$ ]]; then
+        shift
+    else
+        timeout=20
+    fi
+
+    local cmd=("${@}")
+    local log_file="travis_wait_${$}.log"
+
+    "${cmd[@]}" &>"${log_file}" &
+    local cmd_pid="${!}"
+
+    travis_jigger "${!}" "${timeout}" "${cmd[@]}" &
+    local jigger_pid="${!}"
+    local result
+
+    {
+        set +e
+        wait "${cmd_pid}" 2>/dev/null
+        result="${?}"
+        ps -p"${jigger_pid}" &>/dev/null && kill "${jigger_pid}"
+        set -e
+    }
+
+    if [[ "${result}" -eq 0 ]]; then
+        echo -e "\\n${ANSI_GREEN}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
+    else
+        echo -e "\\n${ANSI_RED}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
+    fi
+
+    echo -e "\\n${ANSI_GREEN}Log:${ANSI_RESET}\\n"
+    cat "${log_file}"
+
+    return "${result}"
 }
index af60114d34d91855e236a840fdf9582bb2260de0..4822bdd4b73b84c7ff12b44c37c3f4e490a332fa 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 set -e
 set -x
 
index a18bf5fa85801aa813270811d99f0c2d4ba294fc..69f9d69ce77e8819a71f36d89580675ffb8eda9a 100755 (executable)
@@ -7,7 +7,7 @@
 echo -e "\n\033[33;1mBuilding docker image: coverity-$TRAVIS_COMMIT.\033[0m"
 
 docker build \
---build-arg DOCKER_USER=$USER \
---build-arg DOCKER_USER_UID=`id -u` \
---build-arg DOCKER_USER_GID=`id -g` \
---force-rm -t coverity-${TRAVIS_COMMIT} --pull=true .
+       --build-arg DOCKER_USER=$USER \
+       --build-arg DOCKER_USER_UID=`id -u` \
+       --build-arg DOCKER_USER_GID=`id -g` \
+       --force-rm -t coverity-${TRAVIS_COMMIT} --pull=true .
index d364b541e27f36504af1d23b93e5b1acc804466f..3634e57ad604ebd5b0c6ce4fbb9422b12e5e40b7 100755 (executable)
@@ -18,18 +18,18 @@ sudo apt-get update && sudo apt-get -y install wget
 
 # Get coverity tool
 if [ ! -d $TOOL_BASE ]; then
-  # Download Coverity Scan Analysis Tool
-  if [ ! -e $TOOL_ARCHIVE ]; then
-         echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m"
-         wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN"
-  fi
-
-  # Extract Coverity Scan Analysis Tool
-  echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m"
-  mkdir -p $TOOL_BASE
-  pushd $TOOL_BASE
-  tar xzf $TOOL_ARCHIVE
-  popd
+    # Download Coverity Scan Analysis Tool
+    if [ ! -e $TOOL_ARCHIVE ]; then
+       echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m"
+       wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN"
+    fi
+
+    # Extract Coverity Scan Analysis Tool
+    echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m"
+    mkdir -p $TOOL_BASE
+    pushd $TOOL_BASE
+    tar xzf $TOOL_ARCHIVE
+    popd
 fi
 
 echo -e "\033[33;1mCoverity Scan Analysis Tool can be found at $TOOL_BASE ...\033[0m"
index e2b260398c5dde9937679d623e9b10304166b644..a483d75b86f36d0b81223cae62fa12043c64d015 100755 (executable)
@@ -6,23 +6,23 @@ target="$2"
 unit="$3"
 
 case "$target" in
-        */?*) # a path, but not just a slash at the end
-                dir="${DESTDIR:-}${target}"
-                ;;
-        *)
-                dir="${DESTDIR:-}${unitdir}/${target}"
-                ;;
+    */?*) # a path, but not just a slash at the end
+        dir="${DESTDIR:-}${target}"
+        ;;
+    *)
+        dir="${DESTDIR:-}${unitdir}/${target}"
+        ;;
 esac
 
 unitpath="${DESTDIR:-}${unitdir}/${unit}"
 
 case "$target" in
-        */)
-                mkdir -vp -m 0755 "$dir"
-                ;;
-        *)
-                mkdir -vp -m 0755 "$(dirname "$dir")"
-                ;;
+    */)
+        mkdir -vp -m 0755 "$dir"
+        ;;
+    *)
+        mkdir -vp -m 0755 "$(dirname "$dir")"
+        ;;
 esac
 
 ln -vfs --relative "$unitpath" "$dir"
index 5588185c50382ae3e4f376ffb5293ec73da4a489..bfee5f691c4665d3549dd99335bdf1ef2e29b74e 100755 (executable)
@@ -3,5 +3,5 @@
 systemctl --user import-environment DISPLAY XAUTHORITY
 
 if command -v dbus-update-activation-environment >/dev/null 2>&1; then
-        dbus-update-activation-environment DISPLAY XAUTHORITY
+    dbus-update-activation-environment DISPLAY XAUTHORITY
 fi