Fix shellcheck complaints about provisioning scripts

Also adds executable attributes to shell scripts that were missing it.

Change-Id: Id52ef495147fdbfb5cb1a1f711fac530e0e85f3b
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Tony Sarajärvi
2023-03-29 12:04:54 +00:00
parent ddef5cc5f2
commit 620666bce4
263 changed files with 457 additions and 422 deletions

View File

@@ -39,14 +39,14 @@ function check_for_android_device
function check_if_fully_booted
{
# The "getprop" command separates lines with \r\n so we trim them
bootanim=` timeout 1 $ADB_EXEC shell getprop init.svc.bootanim | tr -d '\r\n'`
boot_completed=`timeout 1 $ADB_EXEC shell getprop sys.boot_completed | tr -d '\r\n'`
bootcomplete=` timeout 1 $ADB_EXEC shell getprop dev.bootcomplete | tr -d '\r\n'`
bootanim=$( timeout 1 "$ADB_EXEC" shell getprop init.svc.bootanim | tr -d '\r\n')
boot_completed=$(timeout 1 "$ADB_EXEC" shell getprop sys.boot_completed | tr -d '\r\n')
bootcomplete=$( timeout 1 "$ADB_EXEC" shell getprop dev.bootcomplete | tr -d '\r\n')
echo "bootanim=$bootanim boot_completed=$boot_completed bootcomplete=$bootcomplete"
[ "$bootanim" = stopped ] && [ "$boot_completed" = 1 ] && [ "$bootcomplete" = 1 ]
}
for counter in `seq ${EMULATOR_MAX_RETRIES}`
for counter in $(seq ${EMULATOR_MAX_RETRIES})
do
$ADB_EXEC kill-server
$ADB_EXEC start-server
@@ -62,22 +62,22 @@ do
EMULATOR_RUN_LOG_PATH=${EMULATOR_RUN_LOG_PATH//%iter/${counter}}
echo "Starting emulator ${ANDROID_EMULATOR}, try ${counter}/${EMULATOR_MAX_RETRIES}" \
| tee ${EMULATOR_RUN_LOG_PATH}
$EMULATOR_EXEC -avd $ANDROID_EMULATOR \
| tee "${EMULATOR_RUN_LOG_PATH}"
$EMULATOR_EXEC -avd "$ANDROID_EMULATOR" \
-gpu swiftshader_indirect -no-audio -no-window -no-boot-anim \
-cores 4 -memory 16000 -partition-size 4096 \
-detect-image-hang -restart-when-stalled -no-snapshot-save \
-no-nested-warnings -logcat-output ${LOGCAT_PATH} \
</dev/null >${EMULATOR_RUN_LOG_PATH} 2>&1 &
-no-nested-warnings -logcat-output "${LOGCAT_PATH}" \
</dev/null >"${EMULATOR_RUN_LOG_PATH}" 2>&1 &
emulator_pid=$!
disown $emulator_pid
echo "Waiting ${ADB_MAX_TIMEOUT} seconds for emulated device to appear..."
timeout ${ADB_MAX_TIMEOUT} $ADB_EXEC wait-for-device
timeout ${ADB_MAX_TIMEOUT} "$ADB_EXEC" wait-for-device
echo "Waiting a few minutes for the emulator to fully boot..."
emulator_status=down
for i in `seq ${ADB_MAX_TIMEOUT}`
for _ in $(seq ${ADB_MAX_TIMEOUT})
do
sleep 1
@@ -95,13 +95,13 @@ do
echo "Emulator started successfully"
break
else
if [ $counter -lt $EMULATOR_MAX_RETRIES ]
if [ "$counter" -lt "$EMULATOR_MAX_RETRIES" ]
then
echo "Emulator failed to start," \
"forcefully killing current instance and re-starting emulator"
kill $emulator_pid || true
sleep 5
elif [ $counter -eq $EMULATOR_MAX_RETRIES ]
elif [ "$counter" -eq "$EMULATOR_MAX_RETRIES" ]
then
echo "Emulator failed to start, reached maximum number of retries. Aborting\!"
exit 2