pixel: Add script to automatically upgrade build.prop overrides

Change-Id: Ic3d2026c2cc65532a5f1eed1ac7bc11aa5a0a6e1
This commit is contained in:
Chirayu Desai
2022-01-18 03:24:02 +05:30
committed by Michael Bestas
parent a046d305ee
commit 62efd7264e

76
pixel/build-desc-fingerprint.sh Executable file
View File

@@ -0,0 +1,76 @@
#!/bin/bash
#
# build-desc-fingerprint:
#
# Update build.prop build description and fingerprint overrides to match stock
#
#
##############################################################################
### SET ###
# use bash strict mode
set -euo pipefail
set -x
### TRAPS ###
# trap signals for clean exit
trap 'rm -rf ${tmp_dir} && exit $?' EXIT
trap 'error_m interrupted!' SIGINT
### CONSTANTS ###
readonly script_path="$(cd "$(dirname "$0")";pwd -P)"
readonly vars_path="${script_path}/../vars/"
readonly top="${script_path}/../../../"
readonly tmp_dir="${TMPDIR:-/tmp}/pixel"
source "${vars_path}/devices"
## HELP MESSAGE (USAGE INFO)
# TODO
### FUNCTIONS ###
# error message
# ARG1: error message for STDERR
# ARG2: error status
error_m() {
echo "ERROR: ${1:-'failed.'}" 1>&2
return "${2:-1}"
}
# print help message.
help_message() {
echo "${help_message:-'No help available.'}"
}
main() {
mkdir -p "${tmp_dir}"
if [[ $# -ne 0 ]]; then
local ds="${@}"
else
local ds="${devices[@]}"
fi
for d in ${ds}; do
(
local dv="${vars_path}/${d}"
source "${dv}"
local mk="$(ls ${top}/device/google/*/calyx_${d}.mk)"
sed -i "s/${prev_build_id}/${build_id}/g" "${mk}"
sed -i "s/${prev_build_number}/${build_number}/g" "${mk}"
)
done
}
### RUN PROGRAM ###
main "${@}"
##