1
0
mirror of https://github.com/lineageos4microg/docker-lineage-cicd synced 2024-11-09 10:09:56 +01:00

Handle OTA_URL

This commit is contained in:
Pete Fotheringham 2024-09-05 18:26:43 +01:00
parent 2475c7d997
commit a311f3967f

@ -35,6 +35,7 @@
# - `repo sync`
# - setup our overlays
# - Set RELEASE_TYPE
# - Handle OTA_URL
# - Add custom packages to be installed
# - Handle keys
# - Prepare the environment
@ -277,6 +278,34 @@ for codename in ${devices//,/ }; do
echo ">> [$(date)] Setting \"$RELEASE_TYPE\" as release type"
sed -i "/\$(filter .*\$(${vendor^^}_BUILDTYPE)/,/endif/d" "$makefile_containing_version"
# Set a custom updater URI if a OTA URL is provided
echo ">> [$(date)] Adding OTA URL overlay (for custom URL $OTA_URL)"
if [ -n "$OTA_URL" ]; then
if [ -d "packages/apps/Updater/app/src/main/res/values" ]; then
# "New" Updater project structure
updater_values_dir="packages/apps/Updater/app/src/main/res/values"
elif [ -d "packages/apps/Updater/res/values" ]; then
# "Old" Updater project structure
updater_values_dir="packages/apps/Updater/res/values"
else
echo ">> [$(date)] ERROR: no 'values' dir of Updater app found"
exit 1
fi
updater_url_overlay_dir="vendor/$vendor/overlay/microg/${updater_values_dir}/"
mkdir -p "$updater_url_overlay_dir"
if grep -q updater_server_url ${updater_values_dir}/strings.xml; then
# "New" updater configuration: full URL (with placeholders {device}, {type} and {incr})
sed "s|{name}|updater_server_url|g; s|{url}|$OTA_URL/v1/{device}/{type}/{incr}|g" /root/packages_updater_strings.xml > "$updater_url_overlay_dir/strings.xml"
elif grep -q conf_update_server_url_def ${updater_values_dir}/strings.xml; then
# "Old" updater configuration: just the URL
sed "s|{name}|conf_update_server_url_def|g; s|{url}|$OTA_URL|g" /root/packages_updater_strings.xml > "$updater_url_overlay_dir/strings.xml"
else
echo ">> [$(date)] ERROR: no known Updater URL property found"
exit 1
fi
fi
# Add custom packages to be installed
if [ -n "$CUSTOM_PACKAGES" ]; then