Skip to content

Commit 9b0db57

Browse files
committed
Sync with microG unofficial installer
1 parent 3408cc7 commit 9b0db57

File tree

8 files changed

+75
-21
lines changed

8 files changed

+75
-21
lines changed

.github/workflows/base.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,21 @@ jobs:
4747
- name: "Execute code coverage"
4848
run: |
4949
# Executing code coverage...
50-
sudo apt-get -qq -y install moreutils 1> /dev/null
50+
sudo apt-get -qq -y install moreutils 1>/dev/null
5151
export OPENSOURCE_ONLY='true'
5252
bashcov './build.sh' # | TZ=UTC ts '[%H:%M:%S]' # Timestamp disabled as it break GitHub notice
5353
# Testing zip installation...
54-
# bash './recovery-simulator/recovery.sh' ./output/*.zip
55-
# printf '\n\n'
56-
# echo '==============='
57-
# echo 'RECOVERY OUTPUT'
58-
# echo '==============='
59-
# cat './recovery-simulator/output/recovery-output-parsed.log'
54+
#bash './recovery-simulator/recovery.sh' ./output/*.zip
55+
#printf '\n\n'
56+
#echo '==============='
57+
#echo 'RECOVERY OUTPUT'
58+
#echo '==============='
59+
#cat './recovery-simulator/output/recovery-output.log'
60+
#printf '\n\n'
61+
#echo '==============='
62+
#echo 'STDOUT / STDERR'
63+
#echo '==============='
64+
#cat './recovery-simulator/output/recovery-stdout-stderr.log'
6065
- name: "Upload reports to Codecov"
6166
uses: codecov/codecov-action@v3
6267
with:

README.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ Release
3333
-------
3434
.. image:: https://img.shields.io/github/v/release/micro5k/google-sync-addon.svg?include_prereleases&cacheSeconds=3600
3535
:alt: GitHub (pre-)release
36-
:target: https://github.com/micro5k/google-sync-addon/releases/latest
36+
:target: docs/INSTRUCTIONS.rst
37+
38+
See `here <docs/INSTRUCTIONS.rst>`_ for the instructions.
39+
40+
.. image:: https://img.shields.io/github/downloads/micro5k/google-sync-addon/latest/total.svg?cacheSeconds=3600
41+
:alt: Downloads of the latest release
42+
:target: docs/INSTRUCTIONS.rst
3743

3844

3945
Copyright

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ tasks.register('buildOta', Exec) {
6161
doFirst {
6262
println 'Building the flashable OTA zip with Gradle...'
6363
executable "${projectDir}/build" + getScriptExt()
64+
environment OPENSOURCE_ONLY: 'false'
6465
}
6566
}
6667

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ org.gradle.jvmargs=-Dfile.encoding=UTF-8
66
org.gradle.warning.mode=all
77
org.gradle.parallel=true
88
org.gradle.caching=true
9-
org.gradle.configureondemand=true
9+
#org.gradle.configureondemand=true

gradle/wrapper/gradle-wrapper.jar.license

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SPDX-FileCopyrightText: Copyright 2007 the original author or authors.
1+
SPDX-FileCopyrightText: 2007 the original author or authors.
22
SPDX-License-Identifier: Apache-2.0
33
SPDX-FileType: ARCHIVE
44

recovery-simulator/recovery.sh

+50-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,42 @@ link_folder()
2121
ln -sf "${2}" "${1}" || mkdir -p "${1}" || fail_with_msg "Failed to link dir '${1}'"
2222
}
2323

24+
ui_print()
25+
{
26+
echo "ui_print ${1}"
27+
}
28+
29+
recovery_flash_start()
30+
{
31+
ui_print "I:Set page: 'install'"
32+
ui_print "I:Set page: 'flash_confirm'"
33+
ui_print "I:Set page: 'flash_zip'"
34+
ui_print "I:operation_start: 'Flashing'"
35+
ui_print "Installing zip file '${1}'"
36+
#ui_print "Checking for MD5 file..."
37+
#ui_print "MD5 matched for '${1}'."
38+
ui_print "I:Update binary zip"
39+
}
40+
41+
recovery_flash_end()
42+
{
43+
if test "${1}" -eq 0; then
44+
ui_print "I:Updater process ended with RC=0"
45+
else
46+
ui_print "Updater process ended with ERROR: ${1}"
47+
ui_print "Error installing zip file '${2}'"
48+
fi
49+
ui_print "Updating partition details..."
50+
ui_print "...done"
51+
ui_print "I:Set page: 'flash_done'"
52+
if test "${1}" -eq 0; then
53+
ui_print "I:operation_end - status=0"
54+
else
55+
ui_print "I:operation_end - status=1"
56+
fi
57+
ui_print ''
58+
}
59+
2460
if test -z "${1}"; then fail_with_msg 'You must pass the filename of the flashable ZIP as parameter'; fi
2561

2662
# Reset environment
@@ -102,14 +138,15 @@ chmod +x "${TMPDIR}/updater" || fail_with_msg "chmod failed on '${TMPDIR}/update
102138

103139
# Setup recovery output
104140
recovery_fd=99
141+
recovery_logs_dir="${THIS_SCRIPT_DIR}/output"
105142
if test -e "/proc/self/fd/${recovery_fd}"; then fail_with_msg 'Recovery FD already exist'; fi
106-
mkdir -p "${THIS_SCRIPT_DIR}/output"
107-
touch "${THIS_SCRIPT_DIR}/output/recovery-output.log"
143+
mkdir -p "${recovery_logs_dir}"
144+
touch "${recovery_logs_dir}/recovery-output-raw.log"
108145
if test "${uname_o_saved}" != 'MS/Windows'; then
109-
sudo chattr +aAd "${THIS_SCRIPT_DIR}/output/recovery-output.log" || fail_with_msg "chattr failed on 'recovery-output.log'"
146+
sudo chattr +aAd "${recovery_logs_dir}/recovery-output-raw.log" || fail_with_msg "chattr failed on 'recovery-output-raw.log'"
110147
fi
111148
# shellcheck disable=SC3023
112-
exec 99>> "${THIS_SCRIPT_DIR}/output/recovery-output.log"
149+
exec 99>> "${recovery_logs_dir}/recovery-output-raw.log"
113150

114151
# Simulate the environment variables (part 2)
115152
PATH="${OVERRIDE_DIR}:${BASE_SIMULATION_PATH}/sbin:${ANDROID_ROOT}/bin:${PATH}" # We have to keep the original folders inside PATH otherwise everything stop working
@@ -131,15 +168,17 @@ FLASHABLE_ZIP_NAME="$("${CUSTOM_BUSYBOX}" basename "${FLASHABLE_ZIP_PATH}")" ||
131168
chmod +x "${TMPDIR}/update-binary" || fail_with_msg "chmod failed on '${TMPDIR}/update-binary'"
132169

133170
# Execute the script that will run the flashable zip
171+
recovery_flash_start "${SECONDARY_STORAGE}/${FLASHABLE_ZIP_NAME}" 1>&"${recovery_fd}"
134172
set +e
135-
"${CUSTOM_BUSYBOX}" ash "${TMPDIR}/updater" 3 "${recovery_fd}" "${SECONDARY_STORAGE}/${FLASHABLE_ZIP_NAME}" | TZ=UTC ts '[%H:%M:%S]'; STATUS="$?"
173+
"${CUSTOM_BUSYBOX}" ash "${TMPDIR}/updater" 3 "${recovery_fd}" "${SECONDARY_STORAGE}/${FLASHABLE_ZIP_NAME}" 1>>"${recovery_logs_dir}/recovery-stdout-stderr.log" 2>&1; STATUS="${?}"
136174
set -e
175+
recovery_flash_end "${STATUS}" "${SECONDARY_STORAGE}/${FLASHABLE_ZIP_NAME}" 1>&"${recovery_fd}"
137176

138177
# Close recovery output
139178
# shellcheck disable=SC3023
140179
exec 99>&-
141180
if test "${uname_o_saved}" != 'MS/Windows'; then
142-
sudo chattr -a "${THIS_SCRIPT_DIR}/output/recovery-output.log" || fail_with_msg "chattr failed on 'recovery-output.log'"
181+
sudo chattr -a "${recovery_logs_dir}/recovery-output-raw.log" || fail_with_msg "chattr failed on 'recovery-output-raw.log'"
143182
fi
144183

145184
# Parse recovery output
@@ -152,15 +191,17 @@ while IFS=' ' read -r ui_command text; do
152191
echo "${text}"
153192
last_msg_printed=true
154193
fi
194+
elif test "${ui_command}" = 'custom_std'; then
195+
echo "${text}"
155196
else
156-
echo "> COMMAND: ${ui_command} ${text}"
197+
echo "> ${ui_command} ${text}"
157198
last_msg_printed=false
158199
fi
159-
done < "${THIS_SCRIPT_DIR}/output/recovery-output.log" > "${THIS_SCRIPT_DIR}/output/recovery-output-parsed.log"
200+
done < "${recovery_logs_dir}/recovery-output-raw.log" > "${recovery_logs_dir}/recovery-output.log"
160201

161202
# Final cleanup
162203
cd "${INIT_DIR}" || fail_with_msg 'Failed to change back the folder'
163204
unset TMPDIR
164205
rm -rf -- "${OUR_TEMP_DIR:?}" &
165206
set +e
166-
if test "${STATUS}" -ne 0; then fail_with_msg "Installation failed with error ${STATUS}"; fi
207+
if test "${STATUS}" -ne 0; then exit "${STATUS}"; fi

recovery-simulator/updater.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ unset OVERRIDE_DIR
3535
export TEST_INSTALL=true
3636

3737
# shellcheck source=SCRIPTDIR/../zip-content/META-INF/com/google/android/update-binary.sh
38-
. "${TMPDIR}/update-binary" || exit 124
38+
. "${TMPDIR}/update-binary" || exit "${?}"

zip-content/uninstall.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ done
136136
delete_recursive "${SYS_PATH}"/etc/default-permissions/google-sync-permissions.xml
137137
delete_recursive "${SYS_PATH}"/etc/default-permissions/contacts-calendar-sync.xml
138138

139+
if test -e "${SYS_PATH}/etc/zips"; then rmdir --ignore-fail-on-non-empty -- "${SYS_PATH}/etc/zips"; fi
140+
139141
if [[ -z "${INSTALLER}" ]]; then
140-
rmdir --ignore-fail-on-non-empty -- "${SYS_PATH}/etc/zips"
141142
ui_debug 'Done.'
142143
fi

0 commit comments

Comments
 (0)