diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2023-02-19 15:20:57 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2023-02-20 17:39:31 -0300 |
commit | 6648a1e9688b4cdd971d6c68b568f4fd8b43ce15 (patch) | |
tree | c02435fcd62e431d1ecda9662e1a117c05c021ed | |
parent | tests: Fix mixed space/tabs indentation (diff) | |
download | firejail-6648a1e9688b4cdd971d6c68b568f4fd8b43ce15.tar.gz firejail-6648a1e9688b4cdd971d6c68b568f4fd8b43ce15.tar.zst firejail-6648a1e9688b4cdd971d6c68b568f4fd8b43ce15.zip |
*.sh: use consistent indentation
Almost all of the shell scripts in the repository use tabs for
indentation (or have no indentation at all):
$ git grep -Il '^\t' -- '*.sh' | wc -l
19
$ git grep -Il '^ ' -- '*.sh' | wc -l
5
$ git grep -IL '^[ \t]' -- '*.sh' | wc -l
25
So do the same in the few shell scripts that currently use spaces for
indentation.
Except for the following file:
* platform/rpm/mkrpm.sh
Not sure if it's following a packaging-specific scheme, so just fix the
one indentation inconsistency in it and otherwise leave it as is for
now.
Command used to search for shell scripts using spaces for indentation:
$ git grep -In '^ ' -- '*.sh'
-rwxr-xr-x | contrib/gdb-firejail.sh | 8 | ||||
-rwxr-xr-x | contrib/syscalls.sh | 34 | ||||
-rwxr-xr-x | platform/rpm/mkrpm.sh | 2 |
3 files changed, 22 insertions, 22 deletions
diff --git a/contrib/gdb-firejail.sh b/contrib/gdb-firejail.sh index b00cc65bc..032b031f0 100755 --- a/contrib/gdb-firejail.sh +++ b/contrib/gdb-firejail.sh | |||
@@ -13,11 +13,11 @@ set -x | |||
13 | # setuid firejail process from the absolute beginning. | 13 | # setuid firejail process from the absolute beginning. |
14 | 14 | ||
15 | if [ -z "${1##*/firejail}" ]; then | 15 | if [ -z "${1##*/firejail}" ]; then |
16 | FIREJAIL=$1 | 16 | FIREJAIL=$1 |
17 | else | 17 | else |
18 | # First argument is not named firejail, then add default unless environment | 18 | # First argument is not named firejail, then add default unless environment |
19 | # variable already set. | 19 | # variable already set. |
20 | set -- ${FIREJAIL:=$(command -v firejail)} "$@" | 20 | set -- ${FIREJAIL:=$(command -v firejail)} "$@" |
21 | fi | 21 | fi |
22 | 22 | ||
23 | bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" & | 23 | bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" & |
diff --git a/contrib/syscalls.sh b/contrib/syscalls.sh index 2c5bdf5ec..aece84e72 100755 --- a/contrib/syscalls.sh +++ b/contrib/syscalls.sh | |||
@@ -8,22 +8,22 @@ SYSCALLS_OUTPUT_FILE="$(pwd)/syscalls.txt" | |||
8 | 8 | ||
9 | if [ $# -eq 0 ] | 9 | if [ $# -eq 0 ] |
10 | then | 10 | then |
11 | echo | 11 | echo |
12 | echo " *** No program specified!!! ***" | 12 | echo " *** No program specified!!! ***" |
13 | echo | 13 | echo |
14 | echo -e "Make this file executable and execute it as:\\n" | 14 | echo -e "Make this file executable and execute it as:\\n" |
15 | echo -e "\\e[96m syscalls.sh /full/path/to/program\\n" | 15 | echo -e "\\e[96m syscalls.sh /full/path/to/program\\n" |
16 | echo -e "\\e[39mif you saved this script in a directory in your PATH (e.g., in ${HOME}/bin), otherwise as:\\n" | 16 | echo -e "\\e[39mif you saved this script in a directory in your PATH (e.g., in ${HOME}/bin), otherwise as:\\n" |
17 | echo -e "\\e[96m ./syscalls.sh /full/path/to/program\\n" | 17 | echo -e "\\e[96m ./syscalls.sh /full/path/to/program\\n" |
18 | echo -e "\\e[39mUse the full path to the respective program to avoid executing it sandboxed with Firejail\\n(if a Firejail profile for it already exits and 'sudo firecfg' was executed earlier)\\nin order to determine the necessary system calls." | 18 | echo -e "\\e[39mUse the full path to the respective program to avoid executing it sandboxed with Firejail\\n(if a Firejail profile for it already exits and 'sudo firecfg' was executed earlier)\\nin order to determine the necessary system calls." |
19 | echo | 19 | echo |
20 | exit 0 | 20 | exit 0 |
21 | else | 21 | else |
22 | strace -cfo "$STRACE_OUTPUT_FILE" "$@" && awk '{print $NF}' "$STRACE_OUTPUT_FILE" | sed '/syscall\|-\|total/d' | sort -u | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/' > "$SYSCALLS_OUTPUT_FILE" | 22 | strace -cfo "$STRACE_OUTPUT_FILE" "$@" && awk '{print $NF}' "$STRACE_OUTPUT_FILE" | sed '/syscall\|-\|total/d' | sort -u | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/' > "$SYSCALLS_OUTPUT_FILE" |
23 | echo | 23 | echo |
24 | echo -e "\e[39mThese are the sorted syscalls:\n\e[93m" | 24 | echo -e "\e[39mThese are the sorted syscalls:\n\e[93m" |
25 | cat "$SYSCALLS_OUTPUT_FILE" | 25 | cat "$SYSCALLS_OUTPUT_FILE" |
26 | echo | 26 | echo |
27 | echo -e "\e[39mThe sorted syscalls were saved to:\n\e[96m$SYSCALLS_OUTPUT_FILE\n\e[39m" | 27 | echo -e "\e[39mThe sorted syscalls were saved to:\n\e[96m$SYSCALLS_OUTPUT_FILE\n\e[39m" |
28 | exit 0 | 28 | exit 0 |
29 | fi | 29 | fi |
diff --git a/platform/rpm/mkrpm.sh b/platform/rpm/mkrpm.sh index 34104c7b2..d32ccd360 100755 --- a/platform/rpm/mkrpm.sh +++ b/platform/rpm/mkrpm.sh | |||
@@ -31,7 +31,7 @@ fi | |||
31 | tmpdir=$(mktemp -d) | 31 | tmpdir=$(mktemp -d) |
32 | mkdir -p ${tmpdir}/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | 32 | mkdir -p ${tmpdir}/{BUILD,RPMS,SOURCES,SPECS,SRPMS} |
33 | function cleanup { | 33 | function cleanup { |
34 | rm -rf ${tmpdir} | 34 | rm -rf ${tmpdir} |
35 | } | 35 | } |
36 | trap cleanup EXIT | 36 | trap cleanup EXIT |
37 | 37 | ||