Skip to content

Commit 0642ae1

Browse files
committed
Sync with microG unofficial installer
1 parent 2ff9ff6 commit 0642ae1

4 files changed

Lines changed: 181 additions & 22 deletions

File tree

tools/get-signature.sh

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,64 @@
11
#!/usr/bin/env sh
2+
# @name Find app signature
3+
# @brief Find the signature of Android applications
4+
# @author ale5000
5+
# Get the latest version from here: https://github.com/micro5k/microg-unofficial-installer/tree/main/tools
6+
27
# SPDX-FileCopyrightText: (c) 2025 ale5000
38
# SPDX-License-Identifier: GPL-3.0-or-later
49

510
# shellcheck enable=all
611
# shellcheck disable=SC3043 # In POSIX sh, local is undefined
712

8-
export SCRIPT_NAME='Get signature'
9-
export SCRIPT_VERSION='0.0.3'
13+
readonly SCRIPT_NAME='Find app signature'
14+
readonly SCRIPT_SHORTNAME='FindAppSign'
15+
readonly SCRIPT_VERSION='0.1.0'
16+
readonly SCRIPT_AUTHOR='ale5000'
17+
18+
pause_if_needed()
19+
{
20+
# shellcheck disable=SC3028 # Ignore: In POSIX sh, SHLVL is undefined
21+
if test "${NO_PAUSE:-0}" = '0' && test "${no_pause:-0}" = '0' && test "${CI:-false}" = 'false' && test "${TERM_PROGRAM:-unknown}" != 'vscode' && test "${SHLVL:-1}" = '1' && test -t 0 && test -t 1 && test -t 2; then
22+
if test -n "${NO_COLOR-}"; then
23+
printf 1>&2 '\n%s' 'Press any key to exit... ' || :
24+
else
25+
printf 1>&2 '\n\033[1;32m\r%s' 'Press any key to exit... ' || :
26+
fi
27+
# shellcheck disable=SC3045 # Ignore: In POSIX sh, read -s / -n is undefined
28+
IFS='' read 2> /dev/null 1>&2 -r -s -n1 _ || IFS='' read 1>&2 -r _ || :
29+
printf 1>&2 '\n' || :
30+
test -n "${NO_COLOR-}" || printf 1>&2 '\033[0m\r \r' || :
31+
fi
32+
unset no_pause || :
33+
return "${1:-0}"
34+
}
35+
36+
show_status()
37+
{
38+
printf 1>&2 '\033[1;32m%s\033[0m\n' "${1?}"
39+
}
40+
41+
show_error()
42+
{
43+
printf 1>&2 '\033[1;31m%s\033[0m\n' "ERROR: ${1?}"
44+
}
1045

1146
get_cert_sha256()
1247
{
1348
local _cert_sha256
1449

15-
test -n "${APKSIGNER_PATH-}" || APKSIGNER_PATH="$(command -v 'apksigner')" || APKSIGNER_PATH="$(command -v 'apksigner.bat')" || :
50+
test -n "${1-}" || {
51+
show_error "You must pass the filename of the file to be processed."
52+
return 3
53+
}
1654

17-
if test -n "${APKSIGNER_PATH-}"; then
18-
_cert_sha256="$("${APKSIGNER_PATH:?}" verify --min-sdk-version 24 --print-certs -- "${1:?}" | grep -m 1 -F -e 'certificate SHA-256 digest:' | cut -d ':' -f '2-' -s | tr -d -- ' ' | tr -- '[:lower:]' '[:upper:]' | sed -e 's/../&:/g;s/:$//')" || _cert_sha256=''
19-
elif command 1> /dev/null -v 'keytool'; then
20-
_cert_sha256="$(keytool -printcert -jarfile "${1:?}" | grep -m 1 -F -e 'SHA256:' | cut -d ':' -f '2-' -s | tr -d -- ' ')" || _cert_sha256=''
55+
if : "${APKSIGNER_PATH:="$(command -v 'apksigner' || command -v 'apksigner.bat' || :)"}" && test -n "${APKSIGNER_PATH?}"; then
56+
_cert_sha256="$("${APKSIGNER_PATH:?}" verify --min-sdk-version 24 --print-certs -- "${1:?}" | grep -m 1 -F -e 'certificate SHA-256 digest:' | cut -d ':' -f '2-' -s | tr -d -- ' ' | tr -- '[:lower:]' '[:upper:]' | sed -e 's/../&:/g;s/:$//')" || return 4
57+
elif : "${KEYTOOL_PATH:="$(command -v 'keytool' || :)"}" && test -n "${KEYTOOL_PATH-}"; then
58+
_cert_sha256="$("${KEYTOOL_PATH:?}" -printcert -jarfile "${1:?}" | grep -m 1 -F -e 'SHA256:' | cut -d ':' -f '2-' -s | tr -d -- ' ')" || return 5
59+
else
60+
show_error "Neither apksigner nor keytool were found. You must set either APKSIGNER_PATH or KEYTOOL_PATH"
61+
return 255
2162
fi
2263

2364
if test -n "${_cert_sha256?}"; then
@@ -27,4 +68,54 @@ get_cert_sha256()
2768
fi
2869
}
2970

30-
get_cert_sha256 "${@}"
71+
main()
72+
{
73+
get_cert_sha256 "${@}"
74+
}
75+
76+
STATUS=0
77+
execute_script='true'
78+
79+
while test "${#}" -gt 0; do
80+
case "${1?}" in
81+
-V | --version)
82+
printf '%s\n' "${SCRIPT_NAME:?} v${SCRIPT_VERSION:?}"
83+
printf '%s\n' "Copyright (c) 2025 ${SCRIPT_AUTHOR:?}"
84+
printf '%s\n' 'License GPLv3+'
85+
execute_script='false'
86+
;;
87+
88+
--)
89+
shift
90+
break
91+
;;
92+
93+
--*)
94+
printf 1>&2 '%s\n' "${SCRIPT_SHORTNAME?}: unrecognized option '${1}'"
95+
execute_script='false'
96+
STATUS=2
97+
;;
98+
99+
-*)
100+
printf 1>&2 '%s\n' "${SCRIPT_SHORTNAME?}: invalid option -- '${1#-}'"
101+
execute_script='false'
102+
STATUS=2
103+
;;
104+
105+
*)
106+
break
107+
;;
108+
esac
109+
110+
shift
111+
done
112+
113+
if test "${execute_script:?}" = 'true'; then
114+
show_status "${SCRIPT_NAME:?} v${SCRIPT_VERSION:?} by ${SCRIPT_AUTHOR:?}"
115+
116+
if test "${#}" -eq 0; then set -- ''; fi
117+
main "${@}" || STATUS="${?}"
118+
fi
119+
120+
pause_if_needed "${STATUS:?}"
121+
exit "${?}"

tools/list-app-perms.sh

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/usr/bin/env sh
2+
# @name List apps permissions
3+
# @brief List the permissions used by Android applications
4+
# @author ale5000
5+
# Get the latest version from here: https://github.com/micro5k/microg-unofficial-installer/tree/main/tools
6+
27
# SPDX-FileCopyrightText: (c) 2025 ale5000
38
# SPDX-License-Identifier: GPL-3.0-or-later
49

510
# shellcheck enable=all
611
# shellcheck disable=SC3043 # In POSIX sh, local is undefined
712

8-
export SCRIPT_NAME='List permissions used by apps'
9-
export SCRIPT_VERSION='0.0.3'
13+
readonly SCRIPT_NAME='List apps permissions'
14+
readonly SCRIPT_SHORTNAME='ListAppPerms'
15+
readonly SCRIPT_VERSION='0.1.0'
16+
readonly SCRIPT_AUTHOR='ale5000'
1017

1118
# shellcheck disable=SC3040 # Ignore: In POSIX sh, set option pipefail is undefined
1219
case "$(set 2> /dev/null -o || set || :)" in *'pipefail'*) set -o pipefail || echo 1>&2 'Failed: pipefail' ;; *) ;; esac
@@ -29,13 +36,21 @@ pause_if_needed()
2936
return "${1:-0}"
3037
}
3138

39+
show_status()
40+
{
41+
printf 1>&2 '\033[1;32m%s\033[0m\n' "${1?}"
42+
}
43+
44+
show_error()
45+
{
46+
printf 1>&2 '\033[1;31m%s\033[0m\n' "ERROR: ${1?}"
47+
}
48+
3249
find_android_build_tool()
3350
{
3451
local _tool_path
3552

36-
if test -n "${2-}" && _tool_path="${2:?}"; then
37-
:
38-
elif _tool_path="$(command -v "${1:?}")" && test -n "${_tool_path?}"; then
53+
if _tool_path="$(command -v "${1:?}")" && test -n "${_tool_path?}"; then
3954
:
4055
elif test -n "${ANDROID_SDK_ROOT-}" && test -d "${ANDROID_SDK_ROOT:?}/build-tools" && _tool_path="$(find "${ANDROID_SDK_ROOT:?}/build-tools" -maxdepth 2 -iname "${1:?}*" | LC_ALL=C sort -V -r | head -n 1)" && test -n "${_tool_path?}"; then
4156
:
@@ -48,16 +63,63 @@ find_android_build_tool()
4863

4964
main()
5065
{
51-
AAPT2_PATH="$(find_android_build_tool 'aapt2' "${AAPT2_PATH-}")" || AAPT_PATH="$(find_android_build_tool 'aapt' "${AAPT_PATH-}")" || :
66+
test -n "${1-}" || {
67+
show_error "You must pass the filename of the file to be processed."
68+
return 3
69+
}
70+
71+
: "${AAPT_PATH:="$(find_android_build_tool 'aapt2' || find_android_build_tool 'aapt' || :)"}"
5272

53-
if test -n "${AAPT2_PATH-}"; then
54-
"${AAPT2_PATH:?}" dump permissions "${@}" | grep -F -e 'uses-permission: ' | cut -d ':' -f '2-' -s | cut -b '2-' | LC_ALL=C sort || return "${?}"
55-
elif test -n "${AAPT_PATH-}"; then
73+
if test -n "${AAPT_PATH-}"; then
5674
"${AAPT_PATH:?}" dump permissions "${@}" | grep -F -e 'uses-permission: ' | cut -d ':' -f '2-' -s | cut -b '2-' | LC_ALL=C sort || return "${?}"
5775
else
5876
return 255
5977
fi
6078
}
6179

62-
main "${@}"
63-
pause_if_needed "${?}"
80+
STATUS=0
81+
execute_script='true'
82+
83+
while test "${#}" -gt 0; do
84+
case "${1?}" in
85+
-V | --version)
86+
printf '%s\n' "${SCRIPT_NAME:?} v${SCRIPT_VERSION:?}"
87+
printf '%s\n' "Copyright (c) 2025 ${SCRIPT_AUTHOR:?}"
88+
printf '%s\n' 'License GPLv3+'
89+
execute_script='false'
90+
;;
91+
92+
--)
93+
shift
94+
break
95+
;;
96+
97+
--*)
98+
printf 1>&2 '%s\n' "${SCRIPT_SHORTNAME?}: unrecognized option '${1}'"
99+
execute_script='false'
100+
STATUS=2
101+
;;
102+
103+
-*)
104+
printf 1>&2 '%s\n' "${SCRIPT_SHORTNAME?}: invalid option -- '${1#-}'"
105+
execute_script='false'
106+
STATUS=2
107+
;;
108+
109+
*)
110+
break
111+
;;
112+
esac
113+
114+
shift
115+
done
116+
117+
if test "${execute_script:?}" = 'true'; then
118+
show_status "${SCRIPT_NAME:?} v${SCRIPT_VERSION:?} by ${SCRIPT_AUTHOR:?}"
119+
120+
if test "${#}" -eq 0; then set -- ''; fi
121+
main "${@}" || STATUS="${?}"
122+
fi
123+
124+
pause_if_needed "${STATUS:?}"
125+
exit "${?}"

zip-content/inc/common-functions.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,14 @@ prepare_installation()
14751475
_need_newline='true'
14761476
replace_permission_placeholders 'ACCESS_BACKGROUND_LOCATION' 'true'
14771477

1478-
if test "${API:?}" -ge 33; then # Android 13+
1479-
replace_permission_placeholders 'POST_NOTIFICATIONS'
1478+
if test "${API:?}" -ge 31; then # Android 12+
1479+
replace_permission_placeholders 'BLUETOOTH_ADVERTISE'
1480+
replace_permission_placeholders 'BLUETOOTH_CONNECT'
1481+
replace_permission_placeholders 'BLUETOOTH_SCAN'
1482+
1483+
if test "${API:?}" -ge 33; then # Android 13+
1484+
replace_permission_placeholders 'POST_NOTIFICATIONS'
1485+
fi
14801486
fi
14811487
fi
14821488

zip-content/module.prop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
numericId=928871
66
id=google-sync-addon
77
name=Google sync add-on
8-
version=v1.3.2.22-alpha
8+
version=v1.3.2.23-alpha
99
versionCode=6
1010
author=ale5000
1111
description=It installs Google sync adapters on Android.

0 commit comments

Comments
 (0)