summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-01-25 11:44:41 +0100
committerMarkus Pettersson <markus.pettersson@mullvad.net>2024-02-02 11:04:48 +0100
commitb6e0545e1b5ae2fbcb6655bd4d28739cf9f943d6 (patch)
tree40644f1100793192c23fd7491978dc26ad1fef97 /android
parent1438e369b10bbf50900d9e380329001513de2c1e (diff)
downloadmullvadvpn-b6e0545e1b5ae2fbcb6655bd4d28739cf9f943d6.tar.xz
mullvadvpn-b6e0545e1b5ae2fbcb6655bd4d28739cf9f943d6.zip
Fix `shellcheck` lints of our various bash scripts
The following lints have been fixed: SC2046,SC2086,SC2068,SC2148,SC2007,SC2004,SC2006, SC2164,SC2145,SC1091,SC2034,SC2155.
Diffstat (limited to 'android')
-rwxr-xr-xandroid/docs/diagrams/update_graphs.sh2
-rwxr-xr-xandroid/fdroid-build/env.sh2
-rwxr-xr-xandroid/fdroid-build/init.sh2
-rwxr-xr-xandroid/scripts/generate-pngs.sh11
-rwxr-xr-xandroid/scripts/run-instrumented-tests-locally.sh4
-rwxr-xr-xandroid/scripts/run-instrumented-tests.sh6
6 files changed, 16 insertions, 11 deletions
diff --git a/android/docs/diagrams/update_graphs.sh b/android/docs/diagrams/update_graphs.sh
index 51d3b74b85..c339cdeac1 100755
--- a/android/docs/diagrams/update_graphs.sh
+++ b/android/docs/diagrams/update_graphs.sh
@@ -2,4 +2,4 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-plantuml $SCRIPT_DIR/*.puml
+plantuml "$SCRIPT_DIR"/*.puml
diff --git a/android/fdroid-build/env.sh b/android/fdroid-build/env.sh
index 3e2faf8fe2..c6c3e224b6 100755
--- a/android/fdroid-build/env.sh
+++ b/android/fdroid-build/env.sh
@@ -1,6 +1,8 @@
+#!/usr/bin/env bash
# Sourcing this file prepares the environment for building inside the F-Droid build server
# Ensure Cargo tools are accessible
+# shellcheck source=/dev/null
source "$HOME/.cargo/env"
# Ensure Go compiler is accessible
diff --git a/android/fdroid-build/init.sh b/android/fdroid-build/init.sh
index 4d5cf8ce35..07bc5939d7 100755
--- a/android/fdroid-build/init.sh
+++ b/android/fdroid-build/init.sh
@@ -5,12 +5,12 @@ set -eux
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_DIR="$SCRIPT_DIR/../../"
-TOOLCHAINS_DIR="$HOME/android-ndk-toolchains"
# Install Rust
curl -sf -L https://sh.rustup.rs > /tmp/rustup.sh
chmod +x /tmp/rustup.sh
/tmp/rustup.sh -y
+# shellcheck source=/dev/null
source "$HOME/.cargo/env"
rustup set profile minimal
rustup target add \
diff --git a/android/scripts/generate-pngs.sh b/android/scripts/generate-pngs.sh
index 6aa4aa380e..dc72e9f538 100755
--- a/android/scripts/generate-pngs.sh
+++ b/android/scripts/generate-pngs.sh
@@ -46,11 +46,12 @@ function convert_image() {
local source_image="$1"
local dpi_config="$2"
+ local destination_image
if (( $# >= 3 )); then
- local destination_image="$3"
+ destination_image="$3"
else
- local destination_image="$(basename "$source_image" .svg | sed -e 's/-/_/g')"
+ destination_image="$(basename "$source_image" .svg | sed -e 's/-/_/g')"
fi
if (( $# >= 4 )); then
@@ -59,8 +60,10 @@ function convert_image() {
local destination_dir="drawable"
fi
- local dpi="$(echo "$dpi_config" | cut -f1 -d'-')"
- local size="$(echo "$dpi_config" | cut -f2 -d'-')"
+ local dpi
+ dpi="$(echo "$dpi_config" | cut -f1 -d'-')"
+ local size
+ size="$(echo "$dpi_config" | cut -f2 -d'-')"
local dpi_dir="../lib/resource/src/main/res/${destination_dir}-${dpi}"
diff --git a/android/scripts/run-instrumented-tests-locally.sh b/android/scripts/run-instrumented-tests-locally.sh
index 359c648d30..4a642356eb 100755
--- a/android/scripts/run-instrumented-tests-locally.sh
+++ b/android/scripts/run-instrumented-tests-locally.sh
@@ -4,7 +4,7 @@ set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-cd $SCRIPT_DIR/..
+cd "$SCRIPT_DIR"/..
./gradlew assembleOssProdAndroidTest
./gradlew app:assembleOssProdDebug
-$SCRIPT_DIR/run-instrumented-tests.sh app
+"$SCRIPT_DIR"/run-instrumented-tests.sh app
diff --git a/android/scripts/run-instrumented-tests.sh b/android/scripts/run-instrumented-tests.sh
index 5e3320533f..e72d4687bd 100755
--- a/android/scripts/run-instrumented-tests.sh
+++ b/android/scripts/run-instrumented-tests.sh
@@ -23,7 +23,7 @@ INVALID_TEST_ACCOUNT_TOKEN="${INVALID_TEST_ACCOUNT_TOKEN:-}"
while [[ "$#" -gt 0 ]]; do
case $1 in
--test-type)
- if [[ ! -z ${2-} && "$2" =~ ^(app|mockapi|e2e)$ ]]; then
+ if [[ -n "${2-}" && "$2" =~ ^(app|mockapi|e2e)$ ]]; then
TEST_TYPE="$2"
else
echo "Error: Bad or missing test type. Must be one of: app, mockapi, e2e"
@@ -32,7 +32,7 @@ while [[ "$#" -gt 0 ]]; do
shift 2
;;
--infra-flavor)
- if [[ ! -z ${2-} && "$2" =~ ^(prod|stagemole)$ ]]; then
+ if [[ -n "${2-}" && "$2" =~ ^(prod|stagemole)$ ]]; then
INFRA_FLAVOR="$2"
else
echo "Error: Bad or missing infra flavor. Must be one of: prod, stagemole"
@@ -41,7 +41,7 @@ while [[ "$#" -gt 0 ]]; do
shift 2
;;
--billing-flavor)
- if [[ ! -z ${2-} && "$2" =~ ^(oss|play)$ ]]; then
+ if [[ -n "${2-}" && "$2" =~ ^(oss|play)$ ]]; then
BILLING_FLAVOR="$2"
else
echo "Error: Bad or missing billing flavor. Must be one of: oss, play"