Skip to content

Commit 1de342b

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

12 files changed

Lines changed: 290 additions & 78 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
# SPDX-FileCopyrightText: NONE
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
name: "Generate permission XML files"
6+
permissions: {}
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
# At 02:00 AM, every 6 days (UTC)
11+
- cron: "0 2 */6 * *"
12+
13+
jobs:
14+
generation:
15+
name: "Generation"
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 20
18+
if: "${{ github.event_name != 'schedule' }}"
19+
20+
steps:
21+
- name: "Checkout sources"
22+
uses: actions/checkout@v5
23+
- name: "Use cache"
24+
id: cache-step
25+
uses: actions/cache@v4
26+
timeout-minutes: 5
27+
with:
28+
key: "perms-${{ hashFiles('tools/dl-perm-list.sh') }}"
29+
restore-keys: "perms-"
30+
path: "cache/tools/perms"
31+
enableCrossOsArchive: true
32+
- name: "Execute script"
33+
shell: bash
34+
timeout-minutes: 10
35+
run: |
36+
# Executing script...
37+
export TOOLS_DATA_DIR='./cache/tools'
38+
if test ! -d './cache/tools/perms' || '${{ steps.cache-step.outputs.cache-hit != 'true' }}'; then
39+
'./tools/dl-perm-list.sh' || exit "${?}"
40+
fi
41+
find './zip-content' -name '*.apk' | sort | './tools/generate-perm-xml.sh' --use-placeholders - || exit "${?}"
42+
- name: "Upload artifacts"
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: "XML permissions"
46+
path: "output/*.xml"
47+
overwrite: false
48+
retention-days: 10
49+
if-no-files-found: "error"
50+
51+
keep-alive:
52+
name: "Keep alive"
53+
runs-on: ubuntu-latest
54+
timeout-minutes: 10
55+
if: "${{ github.event_name == 'schedule' }}"
56+
permissions:
57+
actions: write # Needed to keep alive the workflow
58+
59+
steps:
60+
- name: "Checkout file"
61+
uses: actions/checkout@v5
62+
with:
63+
sparse-checkout: |
64+
tools/dl-perm-list.sh
65+
sparse-checkout-cone-mode: false
66+
- name: "Ping cache" # Cache expiration: 7 days
67+
uses: actions/cache@v4
68+
timeout-minutes: 5
69+
with:
70+
key: "perms-${{ hashFiles('tools/dl-perm-list.sh') }}"
71+
path: "cache/tools/perms"
72+
enableCrossOsArchive: true
73+
lookup-only: true
74+
- name: "Keep workflow alive"
75+
uses: actions/github-script@v7
76+
timeout-minutes: 5
77+
env:
78+
WORKFLOW_REF: "${{ github.workflow_ref }}"
79+
with:
80+
retries: 3
81+
script: |
82+
/* jshint esversion: 6 */
83+
const workflow_filename = process.env.WORKFLOW_REF.split('@', 1).at(0).split('/').slice(2).join('/');
84+
const response = await github.rest.actions.enableWorkflow({
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
workflow_id: workflow_filename
88+
}).catch(response => response);
89+
if(response && response.status === 204) {
90+
console.log('Workflow enabled.');
91+
} else {
92+
let errorMsg = 'enableWorkflow failed';
93+
if(response && response.status && response.message) errorMsg += ' with error ' + response.status + ' (' + response.message + ')';
94+
throw new Error(errorMsg);
95+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ user.gradle
4646
/recovery-simulator/output/
4747
/tools/data/
4848
/utils/data/
49+
/tools/output/
50+
/utils/output/

recovery-simulator/recovery.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,14 @@ if test "${ENV_RESETTED:-false}" = 'false'; then
258258
SHELL="${BASH:-${SHELL-}}"
259259
if test -z "${SHELL?}"; then SHELL="$(command -v 'bash')" || fail_with_msg 'Unable to find current shell path'; fi
260260
THIS_SCRIPT="$(realpath 2> /dev/null "${0:?}")" || fail_with_msg 'Unable to resolve current script name'
261+
TMPDIR="${TMPDIR:-${RUNNER_TEMP:-${TMP:-${TEMP:-/tmp}}}}"
261262

262263
reset_env_and_rerun_myself()
263264
{
264265
if test "${COVERAGE:-false}" = 'false'; then
265-
exec env -i -- ENV_RESETTED=true PATH="${PATH:?}" BB_GLOBBING='0' SHELL="${SHELL:?}" THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:-${RUNNER_TEMP:-${TMP:-${TEMP:-/tmp}}}}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" DRY_RUN="${DRY_RUN-}" KEY_TEST_ONLY="${KEY_TEST_ONLY-}" INPUT_TYPE="${INPUT_TYPE-}" FORCE_HW_KEYS="${FORCE_HW_KEYS-}" CI="${CI-}" "${SHELL:?}" -- "${THIS_SCRIPT:?}" "${@}"
266+
exec env -i -- ENV_RESETTED=true PATH="${PATH:?}" BB_GLOBBING='0' SHELL="${SHELL:?}" THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:?}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" DRY_RUN="${DRY_RUN-}" KEY_TEST_ONLY="${KEY_TEST_ONLY-}" BYPASS_LOCK_CHECK="${BYPASS_LOCK_CHECK-}" INPUT_TYPE="${INPUT_TYPE-}" FORCE_HW_KEYS="${FORCE_HW_KEYS-}" CI="${CI-}" "${SHELL:?}" -- "${THIS_SCRIPT:?}" "${@}"
266267
else
267-
exec env -i -- ENV_RESETTED=true PATH="${PATH:?}" BB_GLOBBING='0' SHELL="${SHELL:?}" THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:-${RUNNER_TEMP:-${TMP:-${TEMP:-/tmp}}}}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" DRY_RUN="${DRY_RUN-}" KEY_TEST_ONLY="${KEY_TEST_ONLY-}" INPUT_TYPE="${INPUT_TYPE-}" FORCE_HW_KEYS="${FORCE_HW_KEYS-}" CI="${CI-}" BASH_XTRACEFD="${BASH_XTRACEFD-}" BASH_ENV="${BASH_ENV-}" OLDPWD="${OLDPWD-}" SHELLOPTS="${SHELLOPTS-}" PS4="${PS4-}" "${SHELL:?}" -x -- "${THIS_SCRIPT:?}" "${@}"
268+
exec env -i -- ENV_RESETTED=true PATH="${PATH:?}" BB_GLOBBING='0' SHELL="${SHELL:?}" THIS_SCRIPT="${THIS_SCRIPT:?}" TMPDIR="${TMPDIR:?}" DEBUG_LOG="${DEBUG_LOG-}" LIVE_SETUP_ALLOWED="${LIVE_SETUP_ALLOWED-}" DRY_RUN="${DRY_RUN-}" KEY_TEST_ONLY="${KEY_TEST_ONLY-}" BYPASS_LOCK_CHECK="${BYPASS_LOCK_CHECK-}" INPUT_TYPE="${INPUT_TYPE-}" FORCE_HW_KEYS="${FORCE_HW_KEYS-}" CI="${CI-}" BASH_XTRACEFD="${BASH_XTRACEFD-}" BASH_ENV="${BASH_ENV-}" OLDPWD="${OLDPWD-}" SHELLOPTS="${SHELLOPTS-}" PS4="${PS4-}" "${SHELL:?}" -x -- "${THIS_SCRIPT:?}" "${@}"
268269
fi
269270
}
270271

@@ -277,6 +278,8 @@ if test -z "${LIVE_SETUP_ALLOWED-}"; then unset LIVE_SETUP_ALLOWED; fi
277278

278279
test -n "${DRY_RUN-unset}" || unset DRY_RUN
279280
test -n "${KEY_TEST_ONLY-unset}" || unset KEY_TEST_ONLY
281+
test -n "${BYPASS_LOCK_CHECK-unset}" || unset BYPASS_LOCK_CHECK
282+
280283
test -n "${INPUT_TYPE-unset}" || unset INPUT_TYPE
281284
test -n "${FORCE_HW_KEYS-unset}" || unset FORCE_HW_KEYS
282285

tools/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TOOLS
99

1010
- zipsigner_ **3.0** => zipsigner.jar
1111
- zipsigner_ **3.0** (Dalvik) => zipsigner-dvk.jar
12-
- `BusyBox for Windows`_ **1.38.0-PRE-5755-g5e60bd4a7 (2025-08-18)** => win/busybox.exe
12+
- `BusyBox for Windows`_ **1.38.0-PRE-5759-g2c94f4417 (2025-08-28)** => win/busybox.exe
1313
- `BusyBox legacy for Windows`_ **1.21.0-TIG-931-g7e6a84d (2012-11-29)** => win/busybox-legacy.bin
1414
- Zip_ **3.0** => win/zip.exe
1515
- UnZip_ **6.0** => win/unzip.exe

tools/bits-info.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ while test "${#}" -gt 0; do
14531453
execute_script='false'
14541454
no_pause=1
14551455
printf '%s\n' "${SCRIPT_NAME} v${SCRIPT_VERSION}"
1456-
printf '%s\n' 'Copyright (c) 2024 ale5000'
1456+
printf '%s\n' "Copy""right (c) 2024 ale5000"
14571457
printf '%s\n' 'License GPLv3+'
14581458
;;
14591459
-h | --help | '-?')

tools/dl-perm-list.sh

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@
55
# Get the latest version from here: https://github.com/micro5k/microg-unofficial-installer/tree/main/tools
66

77
# SPDX-FileCopyrightText: (c) 2025 ale5000
8-
# SPDX-License-Identifier: GPL-3.0-or-later
8+
# SPDX-License-Identifier: GPL-3.0-or-later OR Apache-2.0
99

1010
# shellcheck enable=all
1111
# shellcheck disable=SC3043 # In POSIX sh, local is undefined
1212

1313
readonly SCRIPT_NAME='Android permissions retriever'
1414
readonly SCRIPT_SHORTNAME='DlPermList'
15-
readonly SCRIPT_VERSION='0.2.0'
15+
readonly SCRIPT_VERSION='0.3.0'
1616
readonly SCRIPT_AUTHOR='ale5000'
1717

1818
set -u
1919
# shellcheck disable=SC3040,SC3041,SC2015
2020
{
2121
# Unsupported set options may cause the shell to exit (even without set -e), so first try them in a subshell to avoid this issue
22-
(set -o posix 2> /dev/null) && set -o posix || true
2322
(set +H 2> /dev/null) && set +H || true
2423
(set -o pipefail 2> /dev/null) && set -o pipefail || true
2524
}
@@ -50,11 +49,34 @@ readonly DL_UA='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/201001
5049
readonly DL_ACCEPT_HEADER='Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
5150
readonly DL_ACCEPT_LANG_HEADER='Accept-Language: en-US,en;q=0.5'
5251

52+
pause_if_needed()
53+
{
54+
# shellcheck disable=SC3028 # Ignore: In POSIX sh, SHLVL is undefined
55+
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
56+
if test -n "${NO_COLOR-}"; then
57+
printf 1>&2 '\n%s' 'Press any key to exit... ' || :
58+
else
59+
printf 1>&2 '\n\033[1;32m\r%s' 'Press any key to exit... ' || :
60+
fi
61+
# shellcheck disable=SC3045 # Ignore: In POSIX sh, read -s / -n is undefined
62+
IFS='' read 2> /dev/null 1>&2 -r -s -n1 _ || IFS='' read 1>&2 -r _ || :
63+
printf 1>&2 '\n' || :
64+
test -n "${NO_COLOR-}" || printf 1>&2 '\033[0m\r \r' || :
65+
fi
66+
unset no_pause || :
67+
return "${1:-0}"
68+
}
69+
5370
show_status()
5471
{
5572
printf 1>&2 '\033[1;32m%s\033[0m\n' "${1?}"
5673
}
5774

75+
show_error()
76+
{
77+
printf 1>&2 '\n\033[1;31m%s\033[0m\n' "ERROR: ${1?}"
78+
}
79+
5880
find_data_dir()
5981
{
6082
local _path
@@ -72,8 +94,7 @@ find_data_dir()
7294
return 1
7395
fi
7496

75-
_path="$(realpath "${_path:?}")" || return 1
76-
97+
_path="$(realpath 2> /dev/null "${_path:?}" || readlink -f "${_path:?}")" || return 1
7798
printf '%s\n' "${_path:?}"
7899
}
79100

@@ -94,9 +115,9 @@ create_and_return_data_dir()
94115
return 1
95116
fi
96117

97-
_path="$(realpath "${_path:?}")" || return 1
98118
test -d "${_path:?}" || mkdir -p -- "${_path:?}" || return 1
99119

120+
_path="$(realpath 2> /dev/null "${_path:?}" || readlink -f "${_path:?}")" || return 1
100121
printf '%s\n' "${_path:?}"
101122
}
102123

@@ -122,13 +143,24 @@ main()
122143
{
123144
local api tag
124145

146+
command 1> /dev/null -v "${WGET_CMD:?}" || {
147+
show_error 'Missing: wget'
148+
return 255
149+
}
150+
125151
DATA_DIR="$(find_data_dir || create_and_return_data_dir)" || return 1
126152
test -d "${DATA_DIR:?}/perms" || mkdir -p -- "${DATA_DIR:?}/perms" || return 1
127153

128154
for api in $(seq -- 23 "${MAX_API:?}"); do
129-
tag="$(eval " printf '%s\n' \"\${TAG_API_${api:?}:?}\" ")" || printf '%s\n' "Failed to get tag for API ${api?}"
155+
tag="$(eval " printf '%s\n' \"\${TAG_API_${api:?}:?}\" ")" || {
156+
printf '%s\n' "Failed to get tag for API ${api?}"
157+
return 4
158+
}
130159
printf '%s\n' "API ${api:?}: ${tag:?}"
131-
download_and_parse_permissions "${api:?}" "${tag:?}" || printf '%s\n' "Failed to download/parse XML for API ${api?}"
160+
download_and_parse_permissions "${api:?}" "${tag:?}" || {
161+
printf '%s\n' "Failed to download/parse XML for API ${api?}"
162+
return 5
163+
}
132164
done
133165
}
134166

@@ -139,8 +171,8 @@ while test "${#}" -gt 0; do
139171
case "${1?}" in
140172
-V | --version)
141173
printf '%s\n' "${SCRIPT_NAME:?} v${SCRIPT_VERSION:?}"
142-
printf '%s\n' "Copyright (c) 2025 ${SCRIPT_AUTHOR:?}"
143-
printf '%s\n' 'License GPLv3+'
174+
printf '%s\n' "Copy""right (c) 2025 ${SCRIPT_AUTHOR:?}"
175+
printf '%s\n' 'License GPL-3.0+ OR Apache-2.0'
144176
execute_script='false'
145177
;;
146178

@@ -173,8 +205,8 @@ if test "${execute_script:?}" = 'true'; then
173205
show_status "${SCRIPT_NAME:?} v${SCRIPT_VERSION:?} by ${SCRIPT_AUTHOR:?}"
174206

175207
if test "${#}" -eq 0; then set -- ''; fi
176-
main "${@}"
177-
STATUS="${?}"
208+
main "${@}" || STATUS="${?}"
178209
fi
179210

180-
exit "${STATUS:?}"
211+
pause_if_needed "${STATUS:?}"
212+
exit "${?}"

0 commit comments

Comments
 (0)