diff options
author | 2021-08-31 13:24:56 +0000 | |
---|---|---|
committer | 2021-11-05 02:59:23 -0300 | |
commit | efcd54c0db501e9438cfc97f3ff2e6aa546ecb55 (patch) | |
tree | 3410a9294ea70808a71e741920918adeba11c4d0 | |
parent | Merge pull request #4533 from smitsohu/exitcode (diff) | |
download | firejail-efcd54c0db501e9438cfc97f3ff2e6aa546ecb55.tar.gz firejail-efcd54c0db501e9438cfc97f3ff2e6aa546ecb55.tar.zst firejail-efcd54c0db501e9438cfc97f3ff2e6aa546ecb55.zip |
Fix some shellcheck warnings
Note: This does not modify the configure script, which is a source of a
lot of the remaining shellcheck warnings, because it comes from autoconf
and so it makes little sense to try to fix it here.
Also, it does not modify the scripts in contrib, because they possibly
are maintained at some other place. Similarly with the other scripts
that don't appear to be called from any of the makefiles.
-rwxr-xr-x | gcov.sh | 6 | ||||
-rwxr-xr-x | linecnt.sh | 4 | ||||
-rwxr-xr-x | mkasc.sh | 12 | ||||
-rwxr-xr-x | mkdeb.sh.in | 38 | ||||
-rwxr-xr-x | mkman.sh | 10 | ||||
-rwxr-xr-x | mkuid.sh | 4 |
6 files changed, 37 insertions, 37 deletions
@@ -4,7 +4,7 @@ | |||
4 | # License GPL v2 | 4 | # License GPL v2 |
5 | 5 | ||
6 | gcov_init() { | 6 | gcov_init() { |
7 | USER=`whoami` | 7 | USER="$(whoami)" |
8 | firejail --help > /dev/null | 8 | firejail --help > /dev/null |
9 | firemon --help > /dev/null | 9 | firemon --help > /dev/null |
10 | /usr/lib/firejail/fnet --help > /dev/null | 10 | /usr/lib/firejail/fnet --help > /dev/null |
@@ -20,7 +20,7 @@ gcov_init() { | |||
20 | /usr/lib/firejail/faudit --help > /dev/null | 20 | /usr/lib/firejail/faudit --help > /dev/null |
21 | /usr/lib/firejail/fbuilder --help > /dev/null | 21 | /usr/lib/firejail/fbuilder --help > /dev/null |
22 | 22 | ||
23 | sudo chown $USER:$USER `find .` | 23 | find . -exec sudo chown "$USER:$USER" '{}' + |
24 | } | 24 | } |
25 | 25 | ||
26 | generate() { | 26 | generate() { |
@@ -28,7 +28,7 @@ generate() { | |||
28 | lcov --add-tracefile gcov-file-old --add-tracefile gcov-file-new --output-file gcov-file | 28 | lcov --add-tracefile gcov-file-old --add-tracefile gcov-file-new --output-file gcov-file |
29 | rm -fr gcov-dir | 29 | rm -fr gcov-dir |
30 | genhtml -q gcov-file --output-directory gcov-dir | 30 | genhtml -q gcov-file --output-directory gcov-dir |
31 | sudo rm `find . -name *.gcda` | 31 | find . -name '*.gcda' -exec sudo rm '{}' + |
32 | cp gcov-file gcov-file-old | 32 | cp gcov-file gcov-file-old |
33 | gcov_init | 33 | gcov_init |
34 | } | 34 | } |
diff --git a/linecnt.sh b/linecnt.sh index ccce2da82..37b4f2a65 100755 --- a/linecnt.sh +++ b/linecnt.sh | |||
@@ -4,7 +4,7 @@ | |||
4 | # License GPL v2 | 4 | # License GPL v2 |
5 | 5 | ||
6 | gcov_init() { | 6 | gcov_init() { |
7 | USER=`whoami` | 7 | USER="$(whoami)" |
8 | firejail --help > /dev/null | 8 | firejail --help > /dev/null |
9 | firemon --help > /dev/null | 9 | firemon --help > /dev/null |
10 | /usr/lib/firejail/fnet --help > /dev/null | 10 | /usr/lib/firejail/fnet --help > /dev/null |
@@ -20,7 +20,7 @@ gcov_init() { | |||
20 | /usr/lib/firejail/faudit --help > /dev/null | 20 | /usr/lib/firejail/faudit --help > /dev/null |
21 | /usr/lib/firejail/fbuilder --help > /dev/null | 21 | /usr/lib/firejail/fbuilder --help > /dev/null |
22 | 22 | ||
23 | sudo chown $USER:$USER `find .` | 23 | find . -exec sudo chown "$USER:$USER" '{}' + |
24 | } | 24 | } |
25 | 25 | ||
26 | rm -fr gcov-dir | 26 | rm -fr gcov-dir |
@@ -5,9 +5,9 @@ | |||
5 | 5 | ||
6 | echo "Calculating SHA256 for all files in /transfer - firejail version $1" | 6 | echo "Calculating SHA256 for all files in /transfer - firejail version $1" |
7 | 7 | ||
8 | cd /transfer | 8 | cd /transfer || exit 1 |
9 | sha256sum * > firejail-$1-unsigned | 9 | sha256sum ./* > "firejail-$1-unsigned" |
10 | gpg --clearsign --digest-algo SHA256 < firejail-$1-unsigned > firejail-$1.asc | 10 | gpg --clearsign --digest-algo SHA256 < "firejail-$1-unsigned" > "firejail-$1.asc" |
11 | gpg --verify firejail-$1.asc | 11 | gpg --verify "firejail-$1.asc" |
12 | gpg --detach-sign --armor firejail-$1.tar.xz | 12 | gpg --detach-sign --armor "firejail-$1.tar.xz" |
13 | rm firejail-$1-unsigned | 13 | rm "firejail-$1-unsigned" |
diff --git a/mkdeb.sh.in b/mkdeb.sh.in index e45acf8eb..ddd6ca1ee 100755 --- a/mkdeb.sh.in +++ b/mkdeb.sh.in | |||
@@ -22,7 +22,7 @@ if [ -n "$HAVE_SELINUX" ]; then | |||
22 | CONFIG_ARGS="$CONFIG_ARGS --enable-selinux" | 22 | CONFIG_ARGS="$CONFIG_ARGS --enable-selinux" |
23 | fi | 23 | fi |
24 | 24 | ||
25 | TOP=`pwd` | 25 | TOP="$PWD" |
26 | CODE_ARCHIVE="$NAME-$VERSION.tar.xz" | 26 | CODE_ARCHIVE="$NAME-$VERSION.tar.xz" |
27 | CODE_DIR="$NAME-$VERSION" | 27 | CODE_DIR="$NAME-$VERSION" |
28 | INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian" | 28 | INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian" |
@@ -35,9 +35,9 @@ echo "install directory: $INSTALL_DIR" | |||
35 | echo "debian control directory: $DEBIAN_CTRL_DIR" | 35 | echo "debian control directory: $DEBIAN_CTRL_DIR" |
36 | echo "*****************************************" | 36 | echo "*****************************************" |
37 | 37 | ||
38 | tar -xJvf $CODE_ARCHIVE | 38 | tar -xJvf "$CODE_ARCHIVE" |
39 | #mkdir -p $INSTALL_DIR | 39 | #mkdir -p "$INSTALL_DIR" |
40 | cd $CODE_DIR | 40 | cd "$CODE_DIR" |
41 | ./configure $CONFIG_ARGS | 41 | ./configure $CONFIG_ARGS |
42 | make -j2 | 42 | make -j2 |
43 | mkdir debian | 43 | mkdir debian |
@@ -45,26 +45,26 @@ DESTDIR=debian make install-strip | |||
45 | 45 | ||
46 | cd .. | 46 | cd .. |
47 | echo "*****************************************" | 47 | echo "*****************************************" |
48 | SIZE=`du -s $INSTALL_DIR` | 48 | SIZE="$(du -s "$INSTALL_DIR")" |
49 | echo "install size $SIZE" | 49 | echo "install size $SIZE" |
50 | echo "*****************************************" | 50 | echo "*****************************************" |
51 | 51 | ||
52 | mv $INSTALL_DIR/usr/share/doc/firejail/RELNOTES $INSTALL_DIR/usr/share/doc/firejail/changelog.Debian | 52 | mv "$INSTALL_DIR/usr/share/doc/firejail/RELNOTES" "$INSTALL_DIR/usr/share/doc/firejail/changelog.Debian" |
53 | gzip -9 -n $INSTALL_DIR/usr/share/doc/firejail/changelog.Debian | 53 | gzip -9 -n "$INSTALL_DIR/usr/share/doc/firejail/changelog.Debian" |
54 | rm $INSTALL_DIR/usr/share/doc/firejail/COPYING | 54 | rm "$INSTALL_DIR/usr/share/doc/firejail/COPYING" |
55 | install -m644 $CODE_DIR/platform/debian/copyright $INSTALL_DIR/usr/share/doc/firejail/. | 55 | install -m644 "$CODE_DIR/platform/debian/copyright" "$INSTALL_DIR/usr/share/doc/firejail/." |
56 | mkdir -p $DEBIAN_CTRL_DIR | 56 | mkdir -p "$DEBIAN_CTRL_DIR" |
57 | sed "s/FIREJAILVER/$VERSION/g" $CODE_DIR/platform/debian/control.$(dpkg-architecture -qDEB_HOST_ARCH) > $DEBIAN_CTRL_DIR/control | 57 | sed "s/FIREJAILVER/$VERSION/g" "$CODE_DIR/platform/debian/control.$(dpkg-architecture -qDEB_HOST_ARCH)" > "$DEBIAN_CTRL_DIR/control" |
58 | 58 | ||
59 | mkdir -p $INSTALL_DIR/usr/share/lintian/overrides/ | 59 | mkdir -p "$INSTALL_DIR/usr/share/lintian/overrides/" |
60 | install -m644 $CODE_DIR/platform/debian/firejail.lintian-overrides $INSTALL_DIR/usr/share/lintian/overrides/firejail | 60 | install -m644 "$CODE_DIR/platform/debian/firejail.lintian-overrides" "$INSTALL_DIR/usr/share/lintian/overrides/firejail" |
61 | 61 | ||
62 | find $INSTALL_DIR/etc -type f | sed "s,^$INSTALL_DIR,," | LC_ALL=C sort > $DEBIAN_CTRL_DIR/conffiles | 62 | find "$INSTALL_DIR/etc" -type f | sed "s,^$INSTALL_DIR,," | LC_ALL=C sort > "$DEBIAN_CTRL_DIR/conffiles" |
63 | chmod 644 $DEBIAN_CTRL_DIR/conffiles | 63 | chmod 644 "$DEBIAN_CTRL_DIR/conffiles" |
64 | find $INSTALL_DIR -type d | xargs chmod 755 | 64 | find "$INSTALL_DIR" -type d -exec chmod 755 '{}' + |
65 | cd $CODE_DIR | 65 | cd "$CODE_DIR" |
66 | fakeroot dpkg-deb --build debian | 66 | fakeroot dpkg-deb --build debian |
67 | lintian --no-tag-display-limit debian.deb | 67 | lintian --no-tag-display-limit debian.deb |
68 | mv debian.deb ../firejail_${VERSION}${EXTRA_VERSION}_1_$(dpkg-architecture -qDEB_HOST_ARCH).deb | 68 | mv debian.deb "../firejail_${VERSION}${EXTRA_VERSION}_1_$(dpkg-architecture -qDEB_HOST_ARCH).deb" |
69 | cd .. | 69 | cd .. |
70 | rm -fr $CODE_DIR | 70 | rm -fr "$CODE_DIR" |
@@ -5,8 +5,8 @@ | |||
5 | 5 | ||
6 | set -e | 6 | set -e |
7 | 7 | ||
8 | sed "s/VERSION/$1/g" $2 > $3 | 8 | sed "s/VERSION/$1/g" "$2" > "$3" |
9 | MONTH=`LC_ALL=C date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%b` | 9 | MONTH="$(LC_ALL=C date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%b)" |
10 | sed -i "s/MONTH/$MONTH/g" $3 | 10 | sed -i "s/MONTH/$MONTH/g" "$3" |
11 | YEAR=`LC_ALL=C date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y` | 11 | YEAR="$(LC_ALL=C date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y)" |
12 | sed -i "s/YEAR/$YEAR/g" $3 | 12 | sed -i "s/YEAR/$YEAR/g" "$3" |
@@ -9,8 +9,8 @@ echo "#define FIREJAIL_UIDS_H" >> uids.h | |||
9 | 9 | ||
10 | if [ -r /etc/login.defs ] | 10 | if [ -r /etc/login.defs ] |
11 | then | 11 | then |
12 | UID_MIN=`awk '/^\s*UID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs` | 12 | UID_MIN="$(awk '/^\s*UID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs)" |
13 | GID_MIN=`awk '/^\s*GID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs` | 13 | GID_MIN="$(awk '/^\s*GID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs)" |
14 | fi | 14 | fi |
15 | 15 | ||
16 | # use default values if not found | 16 | # use default values if not found |