Skip to content

Commit f7925f7

Browse files
committed
Fix shellcheck warnings and notes
1 parent da9e5d1 commit f7925f7

11 files changed

+21
-17
lines changed

ci/ios/buildserver-build-ios.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -eu
33
shopt -s nullglob
44

5-
TAG_PATTERN_TO_BUILD=("^ios/")
5+
TAG_PATTERN_TO_BUILD="^ios/"
66
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
77
BUILD_DIR="$SCRIPT_DIR/mullvadvpn-app/ios"
88
LAST_BUILT_DIR="$SCRIPT_DIR/last-built"
@@ -93,6 +93,8 @@ function run_build_loop() {
9393

9494
run_git fetch --prune --tags 2> /dev/null || continue
9595
local tags
96+
97+
# shellcheck disable=SC2207
9698
tags=( $(run_git tag | grep "$TAG_PATTERN_TO_BUILD") )
9799

98100
for tag in "${tags[@]}"; do

ci/ios/run-in-vm.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ vm_pid=$!
2222
# Sleep to wait until VM is up
2323
sleep 10
2424

25-
# apparently, there's a difference between piping into zsh like this and doing
26-
# a <(echo $SCRIPT).
27-
cat "$SCRIPT" | ssh admin@"$(tart ip "$VM_NAME")" bash /dev/stdin
25+
ssh admin@"$(tart ip "$VM_NAME")" bash /dev/stdin < "$SCRIPT"
2826
script_status=$?
2927

3028
kill $vm_pid

dist-assets/linux/before-remove.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pkill -9 -x "mullvad-gui" || true
1010
is_number_re='^[0-9]+$'
1111
# Check if we're running during an upgrade step on Fedora
1212
# https://fedoraproject.org/wiki/Packaging:Scriptlets#Syntax
13-
if [[ "$1" =~ $is_number_re ]] && [ $1 -gt 0 ]; then
13+
if [[ "$1" =~ $is_number_re ]] && [ "$1" -gt 0 ]; then
1414
exit 0;
1515
fi
1616

dist-assets/linux/mullvad-gui-launcher.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ if [ "${XDG_SESSION_TYPE:-""}" = "wayland" ] && \
1313
echo " $SUPPORTED_COMPOSITORS " | \
1414
grep -qi -e " ${XDG_CURRENT_DESKTOP:-""} " -e " ${XDG_SESSION_DESKTOP:-""} "
1515
then
16-
WAYLAND_FLAGS="--ozone-platform=wayland --enable-features=WaylandWindowDecorations"
16+
WAYLAND_FLAGS=( "--ozone-platform=wayland" "--enable-features=WaylandWindowDecorations" )
1717
else
18-
WAYLAND_FLAGS=""
18+
WAYLAND_FLAGS=()
1919
fi
2020

2121
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
22-
exec "$SCRIPT_DIR/mullvad-gui" $SANDBOX_FLAG $WAYLAND_FLAGS "$@"
22+
exec "$SCRIPT_DIR/mullvad-gui" "$SANDBOX_FLAG" "${WAYLAND_FLAGS[@]}" "$@"

dist-assets/pkg-scripts/postinstall

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
LOG_DIR=/var/log/mullvad-vpn
66

77
mkdir -p $LOG_DIR
8-
exec 2>&1 > $LOG_DIR/postinstall.log
8+
exec > $LOG_DIR/postinstall.log 2>&1
99

1010
echo "Running postinstall at $(date)"
1111

dist-assets/pkg-scripts/preinstall

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ INSTALL_DIR=$2
77

88
mkdir -p $LOG_DIR
99
chmod 755 $LOG_DIR
10-
exec 2>&1 > $LOG_DIR/preinstall.log
10+
exec > $LOG_DIR/preinstall.log 2>&1
1111

1212
echo "Running preinstall at $(date)"
1313

dist-assets/uninstall_macos.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -ue
44

5-
read -p "Are you sure you want to stop and uninstall Mullvad VPN? (y/n) "
5+
read -r -p "Are you sure you want to stop and uninstall Mullvad VPN? (y/n) "
66
if [[ "$REPLY" =~ [Yy]$ ]]; then
77
echo "Uninstalling Mullvad VPN ..."
88
else
@@ -40,7 +40,7 @@ sudo pkgutil --forget net.mullvad.vpn || true
4040
echo "Removing login item ..."
4141
osascript -e 'tell application "System Events" to delete login item "Mullvad VPN"' 2>/dev/null || true
4242

43-
read -p "Do you want to delete the log and cache files the app has created? (y/n) "
43+
read -r -p "Do you want to delete the log and cache files the app has created? (y/n) "
4444
if [[ "$REPLY" =~ [Yy]$ ]]; then
4545
sudo rm -rf /var/log/mullvad-vpn /var/root/Library/Caches/mullvad-vpn /Library/Caches/mullvad-vpn
4646
for user in /Users/*; do
@@ -52,7 +52,7 @@ if [[ "$REPLY" =~ [Yy]$ ]]; then
5252
done
5353
fi
5454

55-
read -p "Do you want to delete the Mullvad VPN settings? (y/n) "
55+
read -r -p "Do you want to delete the Mullvad VPN settings? (y/n) "
5656
if [[ "$REPLY" =~ [Yy]$ ]]; then
5757
sudo rm -rf /etc/mullvad-vpn
5858
for user in /Users/*; do

ios/build-wireguard-go.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ WIREGUARD_KIT_GO_PATH="$RESOLVED_SOURCE_PACKAGES_PATH/checkouts/wireguard-apple/
3838
echo "WireGuardKitGo path resolved to $WIREGUARD_KIT_GO_PATH"
3939

4040
# Run make
41-
/usr/bin/make -C "$WIREGUARD_KIT_GO_PATH" $ACTION
41+
# shellcheck disable=SC2086
42+
/usr/bin/make -C "$WIREGUARD_KIT_GO_PATH" $ACTION

scripts/localization

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -eu
55
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
66
cd "$SCRIPT_DIR"
77

8+
# shellcheck disable=SC1091
89
source utils/log
910

1011
function main {
@@ -106,6 +107,8 @@ function download_from_crowdin {
106107
function verify {
107108
sync_localizations
108109
git diff
110+
111+
# shellcheck disable=SC2251
109112
! git status -s | grep .
110113
local out_of_sync=$?
111114

test/ci-runtests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function run_tests_for_os {
196196

197197
RUST_LOG=debug cargo run --bin test-manager \
198198
run-tests \
199-
--account "${ACCOUNT_TOKEN}" \
199+
--account "${ACCOUNT_TOKEN:?Error: ACCOUNT_TOKEN not set}" \
200200
--current-app "${cur_filename}" \
201201
--previous-app "${prev_filename}" \
202202
--test-report "$SCRIPT_DIR/.ci-logs/${os}_report" \

wireguard/libwg/build-android.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ for arch in ${ARCHITECTURES:-armv7 aarch64 x86_64 i686}; do
4141
esac
4242

4343
# Build Wireguard-Go
44-
echo "$(pwd)"
44+
pwd
4545
make -f Android.mk clean
4646
make -f Android.mk
4747

@@ -51,7 +51,7 @@ for arch in ${ARCHITECTURES:-armv7 aarch64 x86_64 i686}; do
5151

5252
# Create the directories with RWX permissions for all users so that the build server can clean
5353
# the directories afterwards
54-
mkdir -m 777 -p "$(dirname "$STRIPPED_LIB_PATH")"
54+
(umask ugo=rwx; mkdir -p "$(dirname "$STRIPPED_LIB_PATH")")
5555

5656
$ANDROID_STRIP_TOOL --strip-unneeded --strip-debug -o "$STRIPPED_LIB_PATH" "$UNSTRIPPED_LIB_PATH"
5757

0 commit comments

Comments
 (0)