-
Notifications
You must be signed in to change notification settings - Fork 5
/
check_and_install_apk.sh
executable file
·50 lines (44 loc) · 1.02 KB
/
check_and_install_apk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
Help() {
# Display Help
echo "Description of the script functions."
echo
echo "Syntax: scriptTemplate [-h|s <store_id>]"
echo "options:"
echo "h Print this Help."
echo "s Enter a store_id."
echo
}
while getopts hs: option; do
case $option in
h) # display Help
Help
exit
;;
s) # Enter a store_id
app=$OPTARG ;;
\?) # Invalid option
echo "Error: Invalid option"
exit
;;
esac
done
if [ -z "$app" ]; then
echo "${app:?Missing -s}"
else
echo "App is set to: $app"
fi
waydroidinstalledapps=$(waydroid app list)
linecount=$(echo "$waydroidinstalledapps" | grep -c "packageName: $app" || true)
# echo "Line count " "$linecount" " and lines " "$lines"
if [ "$linecount" = 0 ]; then
echo "store_id: $app not yet installed"
source mitm-env/bin/activate
python download_apk.py -s "$app"
echo "store_id: $app installing"
waydroid app install "apks/$app.apk"
else
lines=$(echo "$waydroidinstalledapps" | grep "packageName: $app")
echo "Matches $linecount already installed apps: $lines"
fi