[ASUS ZenFone 8] bnsmb:
For those who work with multiple repositories for custom ROMs and/or multiple ROM zip files for Android phones, it might be useful to determine the security level used in the repositories and/or zip files with a simple command

I have written a small shell script for Linux that can do this:

print_security_patch

The usage for the script is:

[ OmniRom 14 Dev - xtrnaw7@t15g ~ ] $ print_security_patch -h

print_security_patch - print either the security patch of a repository tree for AOSP or an Android ROM zip file

This script works for repositories that were last updated before and after the release of Android 14 QPR2 (in Q1 2024)
If the script is called without parameters, it must be executed at the top level in a repository tree for AOSP

Usage:

print_security_patch [rom_zip_file|repository_tree] [...]

[ OmniRom 14 Dev - xtrnaw7@t15g ~ ] $

Usage examples

- Print the security patch level of a repository for a custom ROM for Android 14 QPR2 or newer in the current directory:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ print_security_patch
Retrieving the security patch level for the repository at "/data/develop/android/OmniROM_14.0" ...
The repository uses the new definitions
The current security patch is "2024-03-05"
The current build_id is "ap1a"
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

or in another output format:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ print_security_patch $PWD
Repository: /data/develop/android/OmniROM_14.0, Patch Level: 2024-03-05, Build ID: ap1a, Repository format: new
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

- Print the security patch level of a repository for a Custom ROM for Android 14 without QPR2 or Android 13 or older in the current directory:

[ OmniRom 13 Dev - xtrnaw7@t15g /devpool001/develop/OmniROM_13.0 ] $ print_security_patch
Retrieving the security patch level for the repository at "/devpool001/develop/OmniROM_13.0" ...
The repository uses the old definitions
The current security patch is "2023-09-01"
The current build_id is "TP1A"
[ OmniRom 13 Dev - xtrnaw7@t15g /devpool001/develop/OmniROM_13.0 ] $

- Print the security patch level of a repository for a custom ROM in the current directory and store the values in environment variables :

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ . print_security_patch
Retrieving the security patch level for the repository at "/data/develop/android/OmniROM_14.0" ...
The repository uses the new definitions
The current security patch is "2024-03-05"
The current build_id is "ap1a"
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ echo $RELEASE_PLATFORM_SECURITY_PATCH
2024-03-05
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ echo $BUILD_ID
ap1a
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ echo $REPO_FORMAT
new
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

This usage is quite useful in a script to build a new ROM image for Android 14 with QPR2 and newer that works also after the BUILD_ID changed in a repository (e.g after applying a patch):

. build/envsetup.sh

. ../scripts/print_security_patch

if [ "${REPO_FORMAT}"x = "new"x ] ; then

LUNCH_PARAMETER="omni_zenfone8-${BUILD_ID}-user"

BRUNCH_PARAMETER="zenfone8 ${BUILD_ID} user"

lunch ${LUNCH_PARAMETER}

brunch ${BRUNCH_PARAMETER}
fi

- Print the security patch level for multiple repositories for custom ROMs:

[ OmniRom 14 Dev - xtrnaw7@t15g ~ ] $ print_security_patch /devpool001/develop/OmniROM_1*
Repository: /devpool001/develop/OmniROM_13.0, Patch Level: 2023-09-01, Build ID: TP1A, Repository format: old
Repository: /devpool001/develop/OmniROM_14.0, Patch Level: 2024-04-05, Build ID: ap1a, Repository format: new
Repository: /devpool001/develop/OmniROM_14.0_new, Patch Level: 2024-03-05, Build ID: ap1a, Repository format: new
Repository: /devpool001/develop/OmniROM_14.0_patch_2024-02-05, Patch Level: 2024-02-05, Build ID: UP1A, Repository format: old
[ OmniRom 14 Dev - xtrnaw7@t15g ~ ] $

- Print the security patch level used to build a ROM image file:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ print_security_patch out/target/product/zenfone8/omni-14-20240401-zenfone8-MICROG.zip
ZIP File: out/target/product/zenfone8/omni-14-20240401-zenfone8-MICROG.zip, Patch Level: 2024-03-05
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

- Print the security patch level for multiple ROM image files:

[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $ print_security_patch /data/backup/ASUS_ZENFONE8/Lineage-*/*zip /data/backup/ASUS_ZENFONE8/omnirom/*/*zip /data/backup/ASUS_ZENFONE8/omnirom_local/*/*zip
ZIP File: /data/backup/ASUS_ZENFONE8/Lineage-18_Android11/lineage-18.1-20220311-nightly-sake-signed.zip, Patch Level: 2022-02-05
ZIP File: /data/backup/ASUS_ZENFONE8/Lineage-19_Android12/lineage-19.1-20220923-nightly-sake-signed.zip, Patch Level: 2022-09-05
ZIP File: /data/backup/ASUS_ZENFONE8/Lineage-19_Android12/lineage-19.1-20221216-nightly-sake-signed.zip, Patch Level: 2022-12-05
ZIP File: /data/backup/ASUS_ZENFONE8/Lineage-19_Android12_with_MicroG/lineage-19.1-20221222-microG-sake.zip, Patch Level: 2022-12-05
ZIP File: /data/backup/ASUS_ZENFONE8/Lineage-20/lineage-20.0-20230526-nightly-sake-signed.zip, Patch Level: 2023-05-05
ZIP File: /data/backup/ASUS_ZENFONE8/Lineage-21/lineage-21.0-20231113-UNOFFICIAL-sake.zip, Patch Level: 2023-11-01
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom/omni-12/omni-12-20220807-zenfone8-MICROG.zip, Patch Level: 2022-05-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom/omni-12/omni-12-20220814-zenfone8-MICROG.zip, Patch Level: 2022-05-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom/omni-13/omni-13-202307291409-zenfone8-MICROG.zip, Patch Level: 2023-07-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom/omni-13/omni-13-202307291412-zenfone8-GAPPS.zip, Patch Level: 2023-07-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom/omni-13/omni-13-202308121832-zenfone8-MICROG.zip, Patch Level: 2023-08-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom/omni-13/omni-13-202308130136-zenfone8-WEEKLY.zip, Patch Level: 2023-08-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom/omni-14/omni-14-202404041405-zenfone8-MICROG.zip, Patch Level: 2024-03-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom_local/omni-12/omni-12-20220927-zenfone8-MICROG.zip, Patch Level: 2022-05-05
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom_local/omni-13/omni-13-202309302115-zenfone8-WEEKLY.zip, Patch Level: 2023-09-01
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom_local/omni-13/omni-13-20231203-zenfone8-MICROG.zip, Patch Level: 2023-09-01
ZIP File: /data/backup/ASUS_ZENFONE8/omnirom_local/omni-14/omni-14-20240408-zenfone8-MICROG.zip, Patch Level: 2024-04-05
[ OmniRom 14 Dev - xtrnaw7@t15g /data/develop/android/OmniROM_14.0 ] $

The script writes all error messages to STDERR; to ignore error messages use

print_security_patch ... 2>/dev/null

The script can be downloaded from here: print_security_patch

See the How to get the security patch level in a ROM image zip file and Infos for building an Android 14 based Custom ROM image in Q1 2024 or later for details how to retrieve the infos about the security level.