dotfiles/.local/bin/lineage-build.sh

562 lines
24 KiB
Bash
Executable File

#!/bin/bash
# LineageOS build helper script, credit to @AOSPA, @YumeMichi
# red = errors, cyan = warnings, green = confirmations, blue = informational
# plain for generic text, bold for titles, reset flag at each end of line
# plain blue should not be used for readability reasons - use plain cyan instead
CLR_RST=$(tput sgr0) ## reset flag
#CLR_RED=$CLR_RST$(tput setaf 1) # red, plain
CLR_GRN=$CLR_RST$(tput setaf 2) # green, plain
#CLR_BLU=$CLR_RST$(tput setaf 4) # blue, plain
CLR_CYA=$CLR_RST$(tput setaf 6) # cyan, plain
CLR_BLD=$(tput bold) ## bold flag
CLR_BLD_RED=$CLR_RST$CLR_BLD$(tput setaf 1) # red, bold
CLR_BLD_GRN=$CLR_RST$CLR_BLD$(tput setaf 2) # green, bold
CLR_BLD_BLU=$CLR_RST$CLR_BLD$(tput setaf 4) # blue, bold
#CLR_BLD_CYA=$CLR_RST$CLR_BLD$(tput setaf 6) # cyan, bold
# Set defaults
LINEAGE_BUILD_VARIANT="userdebug"
LINEAGE_VERSION_MAJOR="20"
LINEAGE_VERSION_MINOR="0"
LINEAGE_BUILD_DATE=$(date -u +%Y%m%d)
LINEAGE_BUILD_TYPE="X"
LINEAGE_EXTRAVERSION=""
function checkExit() {
if [ $? -ne 0 ]; then
EXIT_CODE=$?
echo "${CLR_BLD_RED}Build failed!${CLR_RST}"
echo -e ""
exit $EXIT_CODE
fi
}
# Output usage help
function showHelpAndExit {
echo -e "${CLR_BLD_BLU}Usage: $0 <device> [options]${CLR_RST}"
echo -e ""
echo -e "${CLR_BLD_BLU}Options:${CLR_RST}"
echo -e "${CLR_BLD_BLU} -h, --help Display this help message${CLR_RST}"
echo -e "${CLR_BLD_BLU} -c, --clean Wipe the tree before building${CLR_RST}"
echo -e "${CLR_BLD_BLU} -i, --installclean Dirty build - Use 'installclean'${CLR_RST}"
echo -e "${CLR_BLD_BLU} -r, --repo-sync Sync before building${CLR_RST}"
echo -e "${CLR_BLD_BLU} -b, --build-id LineageOS unofficial build id${CLR_RST}"
echo -e "${CLR_BLD_BLU} -t, --build-type Specify build type${CLR_RST}"
echo -e "${CLR_BLD_BLU} -j, --jobs Specify jobs/threads to use${CLR_RST}"
echo -e "${CLR_BLD_BLU} -m, --module Build a specific module${CLR_RST}"
echo -e "${CLR_BLD_BLU} -g, --gms Build with GMS${CLR_RST}"
echo -e "${CLR_BLD_BLU} -s, --sign-keys Specify path to sign key mappings${CLR_RST}"
echo -e "${CLR_BLD_BLU} -p, --pwfile Specify path to sign key password file${CLR_RST}"
echo -e "${CLR_BLD_BLU} -z, --imgzip Generate fastboot flashable image zip from signed target_files${CLR_RST}"
exit 1
}
# Setup getopt.
long_opts="help,clean,installclean,repo-sync,build-id:,build-type:,jobs:,module:,gms,sign-keys:,pwfile:,imgzip"
getopt_cmd=$(getopt -o hcir:b:t:j:m:gs:p:z --long "$long_opts" \
-n "$(basename "$0")" -- "$@") ||
{
echo -e "${CLR_BLD_RED}\nError: Getopt failed. Extra args\n${CLR_RST}"
showHelpAndExit
exit 1
}
eval set -- "$getopt_cmd"
while true; do
case "$1" in
-h | --help | h | help) showHelpAndExit ;;
-c | --clean | c | clean) FLAG_CLEAN_BUILD=y ;;
-i | --installclean | i | installclean) FLAG_INSTALLCLEAN_BUILD=y ;;
-r | --repo-sync | r | repo-sync) FLAG_SYNC=y ;;
-b | --build-id | b | build-id)
LINEAGE_BUILD_ID="$2"
shift
;;
-t | --build-type | t | build-type)
LINEAGE_BUILD_VARIANT="$2"
shift
;;
-j | --jobs | j | jobs)
JOBS="$2"
shift
;;
-m | --module | m | module)
MODULES+=("$2")
echo "$2"
shift
;;
-g | --gms | g | gms) FLAG_GMS="y" ;;
-s | --sign-keys | s | sign-keys)
KEY_MAPPINGS="$2"
shift
;;
-p | --pwfile | p | pwfile)
PWFILE="$2"
shift
;;
-z | --imgzip | img | imgzip) FLAG_IMG_ZIP=y ;;
--)
shift
break
;;
esac
shift
done
# Mandatory argument
if [ $# -eq 0 ]; then
echo -e "${CLR_BLD_RED}Error: No device specified${CLR_RST}"
showHelpAndExit
fi
export DEVICE="$1"
shift
# Make sure we are running on 64-bit before carrying on with anything
ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
if [ "$ARCH" != "64" ]; then
echo -e "${CLR_BLD_RED}error: unsupported arch (expected: 64, found: $ARCH)${CLR_RST}"
exit 1
fi
# Set up paths
#cd $(dirname $0)
DIR_ROOT=$(pwd)
# Make sure everything looks sane so far
if [ ! -d "$DIR_ROOT/vendor/lineage" ]; then
echo -e "${CLR_BLD_RED}error: insane root directory ($DIR_ROOT)${CLR_RST}"
exit 1
fi
# Setup LineageOS build id if specified
if [ "$LINEAGE_BUILD_ID" ]; then
LINEAGE_EXTRAVERSION="-$LINEAGE_BUILD_ID"
export TARGET_UNOFFICIAL_BUILD_ID=$LINEAGE_BUILD_ID
fi
# Initializationizing!
echo -e "${CLR_BLD_BLU}Setting up the environment${CLR_RST}"
echo -e ""
# shellcheck source=/dev/null
. build/envsetup.sh
echo -e ""
# Use the thread count specified by user
CMD=""
if [ "$JOBS" ]; then
CMD+="-j$JOBS"
fi
# Pick the default thread count (allow overrides from the environment)
if [ -z "$JOBS" ]; then
if [ "$(uname -s)" = 'Darwin' ]; then
JOBS=$(sysctl -n machdep.cpu.core_count)
else
JOBS=$(grep </proc/cpuinfo -c '^processor')
fi
fi
# Grab the build version
LINEAGE_VERSION_SUFFIX=$LINEAGE_BUILD_DATE-$LINEAGE_BUILD_TYPE$LINEAGE_EXTRAVERSION-$DEVICE
LINEAGE_VERSION=lineage-$LINEAGE_VERSION_MAJOR.$LINEAGE_VERSION_MINOR-$LINEAGE_VERSION_SUFFIX
# Prep for a clean build, if requested so
if [ "$FLAG_CLEAN_BUILD" = 'y' ]; then
echo -e "${CLR_BLD_BLU}Cleaning output files left from old builds${CLR_RST}"
echo -e ""
m clobber "$CMD"
fi
# Sync up, if asked to
if [ "$FLAG_SYNC" = 'y' ]; then
echo -e "${CLR_BLD_BLU}Downloading the latest source files${CLR_RST}"
echo -e ""
repo sync -j"$JOBS" -c --no-clone-bundle --current-branch --no-tags
fi
# GMS
if [ "$FLAG_GMS" = 'y' ]; then
echo -e "${CLR_BLD_BLU}Building with GMS${CLR_RST}"
echo -e ""
export WITH_GMS=true
fi
# Check the starting time (of the real build process)
TIME_START=$(date +%s.%N)
# Friendly logging to tell the user everything is working fine is always nice
echo -e "${CLR_BLD_GRN}Building LineageOS $LINEAGE_VERSION for $DEVICE${CLR_RST}"
echo -e "${CLR_GRN}Start time: $(date)${CLR_RST}"
echo -e ""
# Lunch-time!
echo -e "${CLR_BLD_BLU}Lunching $DEVICE${CLR_RST} ${CLR_CYA}(Including dependencies sync)${CLR_RST}"
echo -e ""
lunch "lineage_$DEVICE-$LINEAGE_BUILD_VARIANT"
checkExit
echo -e ""
# Perform installclean, if requested so
if [ "$FLAG_INSTALLCLEAN_BUILD" = 'y' ]; then
echo -e "${CLR_BLD_BLU}Cleaning compiled image files left from old builds${CLR_RST}"
echo -e ""
m installclean "$CMD"
fi
# Build away!
echo -e "${CLR_BLD_BLU}Starting compilation${CLR_RST}"
echo -e ""
# Build a specific module(s)
if [ "${MODULES[*]}" ]; then
m "${MODULES[@]}" "$CMD"
checkExit
# Build signed rom package if specified
elif [ "${KEY_MAPPINGS}" ]; then
# Set sign key password file if specified
if [ "${PWFILE}" ]; then
export ANDROID_PW_FILE=$PWFILE
fi
# Make target-files-package
m otatools target-files-package "$CMD"
checkExit
echo -e "${CLR_BLD_BLU}Signing target files apks${CLR_RST}"
# sign_target_files_apks -o -d $KEY_MAPPINGS \
# "$OUT/obj/PACKAGING/target_files_intermediates/lineage_$DEVICE-target_files-eng.nobody.zip" \
# signed-target_files.zip
if [ "$FLAG_GMS" = 'y' ]; then
SIGNING_FLAGS="-e Gallery2.apk= -e GoogleCalendarSyncAdapter.apk= -e GoogleContactsSyncAdapter.apk=
-e LocalContactsBackup.apk= -e MarkupGoogle.apk= -e ModuleMetadata.apk= -e PhotoTable.apk=
-e PixelCameraServicesC10.apk=
-e PrebuiltExchange3Google.apk=
-e Recorder.apk=
-e SpeechServicesByGoogle.apk=
-e ThemesStub.apk=
-e VZWAPNLib.apk=
-e messaging.apk=
-e talkback.apk=
-e DisplayCutoutEmulationCornerOverlay.apk=
-e DisplayCutoutEmulationDoubleOverlay.apk=
-e DisplayCutoutEmulationHoleOverlay.apk=
-e DisplayCutoutEmulationTallOverlay.apk=
-e DisplayCutoutEmulationWaterfallOverlay.apk=
-e NoCutoutOverlay.apk=
-e DocumentsUIOverlay.apk=
-e EuiccSupportPixelOverlay.apk=
-e FontLatoOverlay.apk=
-e FontNotoSerifSourceOverlay.apk=
-e FontRubikOverlay.apk=
-e GmsOverlay.apk=
-e GmsSettingsProviderOverlay.apk=
-e GoogleParts__auto_generated_rro_product.apk=
-e IconPackCircularAndroidOverlay.apk=
-e IconPackCircularLauncherOverlay.apk=
-e IconPackCircularSettingsOverlay.apk=
-e IconPackCircularSystemUIOverlay.apk=
-e IconPackFilledAndroidOverlay.apk=
-e IconPackFilledLauncherOverlay.apk=
-e IconPackFilledSettingsOverlay.apk=
-e IconPackFilledSystemUIOverlay.apk=
-e IconPackKaiAndroidOverlay.apk=
-e IconPackKaiLauncherOverlay.apk=
-e IconPackKaiSettingsOverlay.apk=
-e IconPackKaiSystemUIOverlay.apk=
-e IconPackRoundedAndroidOverlay.apk=
-e IconPackRoundedLauncherOverlay.apk=
-e IconPackRoundedSettingsOverlay.apk=
-e IconPackRoundedSystemUIOverlay.apk=
-e IconPackSamAndroidOverlay.apk=
-e IconPackSamLauncherOverlay.apk=
-e IconPackSamSettingsOverlay.apk=
-e IconPackSamSystemUIOverlay.apk=
-e IconPackVictorAndroidOverlay.apk=
-e IconPackVictorLauncherOverlay.apk=
-e IconPackVictorSettingsOverlay.apk=
-e IconPackVictorSystemUIOverlay.apk=
-e IconShapePebbleOverlay.apk=
-e IconShapeRoundedRectOverlay.apk=
-e IconShapeSquareOverlay.apk=
-e IconShapeSquircleOverlay.apk=
-e IconShapeTaperedRectOverlay.apk=
-e IconShapeTeardropOverlay.apk=
-e IconShapeVesselOverlay.apk=
-e ImsServiceEntitlement__auto_generated_rro_product.apk=
-e LineageBlackTheme.apk=
-e LineageNavigationBarNoHint.apk=
-e LineageParts__auto_generated_rro_product.apk=
-e LineageSettingsProvider__auto_generated_rro_product.apk=
-e LineageSetupWizard__auto_generated_rro_product.apk=
-e ManagedProvisioning__auto_generated_rro_product.apk=
-e NavigationBarMode3ButtonOverlay.apk=
-e NavigationBarModeGesturalOverlay.apk=
-e NavigationBarModeGesturalOverlayExtraWideBack.apk=
-e NavigationBarModeGesturalOverlayNarrowBack.apk=
-e NavigationBarModeGesturalOverlayWideBack.apk=
-e NetworkStackOverlay.apk=
-e SettingsOverlayGE2AE.apk=
-e SettingsOverlayGFE4J.apk=
-e SettingsOverlayGP4BC.apk=
-e SettingsProvider__auto_generated_rro_product.apk=
-e Settings__auto_generated_rro_product.apk=
-e SimpleDeviceConfig__auto_generated_rro_product.apk=
-e StorageManager__auto_generated_rro_product.apk=
-e SystemUI__auto_generated_rro_product.apk=
-e TrebuchetOverlay.apk=
-e TrebuchetQuickStep__auto_generated_rro_product.apk=
-e WifiOverlay2022_C10.apk=
-e framework-res__auto_generated_rro_product.apk=
-e org.lineageos.platform-res__auto_generated_rro_product.apk=
-e DCMO.apk=
-e DMService.apk=
-e DeviceIntelligenceNetworkPrebuilt.apk=
-e DevicePersonalizationPrebuiltPixel2022.apk=
-e DiagMon.apk=
-e Dialer.apk=
-e EuiccGoogle.apk=
-e GmsCore.apk=
-e GooglePartnerSetup.apk=
-e GoogleRestore.apk=
-e HardwareInfo.apk=
-e HotwordEnrollmentOKGoogleFUSIONPro.apk=
-e HotwordEnrollmentXGoogleFUSIONPro.apk=
-e ImsServiceEntitlement.apk=
-e OemDmTrigger.apk=
-e OneTimeInitializer.apk=
-e Phonesky.apk=
-e SettingsIntelligence.apk=
-e TetheringEntitlement.apk=
-e Velvet.apk=
-e WfcActivation.apk=
-e EasterEgg.apk=
-e ExtShared.apk=
-e KeyChain.apk=
-e NfcNci.apk=
-e PacProcessor.apk=
-e PartnerBookmarksProvider.apk=
-e PrintRecommendationService.apk=
-e PrintSpooler.apk=
-e SecureElement.apk=
-e SimAppDialog.apk=
-e Stk.apk=
-e WallpaperBackup.apk=
-e BuildManifest.apk=
-e framework-res.apk=
-e org.lineageos.platform-res.apk=
-e DocumentsUI.apk=
-e DownloadProvider.apk=
-e DownloadProviderUi.apk=
-e DynamicSystemInstallationService.apk=
-e ExternalStorageProvider.apk=
-e FusedLocation.apk=
-e InputDevices.apk=
-e IntentResolver.apk=
-e LiveWallpapersPicker.apk=
-e LocalTransport.apk=
-e ManagedProvisioning.apk=
-e MediaProviderLegacy.apk=
-e MmsService.apk=
-e MtpService.apk=
-e NetworkStack.apk=
-e NetworkStackNext.apk=
-e ONS.apk=
-e PackageInstaller.apk=
-e ProxyHandler.apk=
-e SettingsProvider.apk=
-e SharedStorageBackup.apk=
-e Shell.apk=
-e SoundPicker.apk=
-e StatementService.apk=
-e Tag.apk=
-e TeleService.apk=
-e Telecom.apk=
-e TelephonyProvider.apk=
-e UserDictionaryProvider.apk=
-e VpnDialogs.apk=
-e OemRilHookService.apk=
-e Profiles.apk=
-e EuiccGoogleOverlay.apk=
-e EuiccSupportPixel.apk=
-e EuiccSupportPixelPermissions.apk=
-e GoogleFeedback.apk=
-e GoogleParts.apk=
-e GoogleServicesFramework.apk=
-e HbmSVManager.apk=
-e Iwlan.apk=
-e LLKAgent.apk=
-e LineageParts.apk=
-e LineageSettingsProvider.apk=
-e LineageSetupWizard.apk=
-e MyVerizonServices.apk=
-e OemRilService.apk=
-e PixelNfc.apk=
-e QualifiedNetworksService.apk=
-e QuickAccessWallet.apk=
-e RemoteProvisioner.apk=
-e RilConfigService.apk=
-e Seedvault.apk=
-e Settings.apk=
-e SetupWizard.apk=
-e ShannonIms.apk=
-e ShannonRcs.apk=
-e SimpleDeviceConfig.apk=
-e StorageManager.apk=
-e SystemUI.apk=
-e ThemePicker.apk=
-e TrebuchetQuickStep.apk=
-e UwbVendorService.apk=
-e grilservice.apk=
-e GoogleParts__auto_generated_rro_vendor.apk=
-e LineageParts__auto_generated_rro_vendor.apk=
-e LineageSetupWizard__auto_generated_rro_vendor.apk=
-e NfcNci__auto_generated_rro_vendor.apk=
-e ONS__auto_generated_rro_vendor.apk=
-e SettingsProvider__auto_generated_rro_vendor.apk=
-e Settings__auto_generated_rro_vendor.apk=
-e SimpleDeviceConfig__auto_generated_rro_vendor.apk=
-e StorageManager__auto_generated_rro_vendor.apk=
-e SystemUI__auto_generated_rro_vendor.apk=
-e TeleService__auto_generated_rro_vendor.apk=
-e framework-res__auto_generated_rro_vendor.apk=
-e org.lineageos.platform-res__auto_generated_rro_vendor.apk=
--extra_apks com.android.adbd.apex=$KEY_MAPPINGS/com.android.adbd
--extra_apex_payload_key com.android.adbd.apex=$KEY_MAPPINGS/com.android.adbd.pem
--extra_apks com.android.adservices.apex=$KEY_MAPPINGS/com.android.adservices
--extra_apex_payload_key com.android.adservices.apex=$KEY_MAPPINGS/com.android.adservices.pem
--extra_apks com.android.adservices.api.apex=$KEY_MAPPINGS/com.android.adservices.api
--extra_apex_payload_key com.android.adservices.api.apex=$KEY_MAPPINGS/com.android.adservices.api.pem
--extra_apks com.android.appsearch.apex=$KEY_MAPPINGS/com.android.appsearch
--extra_apex_payload_key com.android.appsearch.apex=$KEY_MAPPINGS/com.android.appsearch.pem
--extra_apks com.android.art.apex=$KEY_MAPPINGS/com.android.art
--extra_apex_payload_key com.android.art.apex=$KEY_MAPPINGS/com.android.art.pem
--extra_apks com.android.bluetooth.apex=$KEY_MAPPINGS/com.android.bluetooth
--extra_apex_payload_key com.android.bluetooth.apex=$KEY_MAPPINGS/com.android.bluetooth.pem
--extra_apks com.android.btservices.apex=$KEY_MAPPINGS/com.android.btservices
--extra_apex_payload_key com.android.btservices.apex=$KEY_MAPPINGS/com.android.btservices.pem
--extra_apks com.android.cellbroadcast.apex=$KEY_MAPPINGS/com.android.cellbroadcast
--extra_apex_payload_key com.android.cellbroadcast.apex=$KEY_MAPPINGS/com.android.cellbroadcast.pem
--extra_apks com.android.compos.apex=$KEY_MAPPINGS/com.android.compos
--extra_apex_payload_key com.android.compos.apex=$KEY_MAPPINGS/com.android.compos.pem
--extra_apks com.android.connectivity.resources.apex=$KEY_MAPPINGS/com.android.connectivity.resources
--extra_apex_payload_key com.android.connectivity.resources.apex=$KEY_MAPPINGS/com.android.connectivity.resources.pem
--extra_apks com.android.conscrypt.apex=$KEY_MAPPINGS/com.android.conscrypt
--extra_apex_payload_key com.android.conscrypt.apex=$KEY_MAPPINGS/com.android.conscrypt.pem
--extra_apks com.android.extservices.apex=$KEY_MAPPINGS/com.android.extservices
--extra_apex_payload_key com.android.extservices.apex=$KEY_MAPPINGS/com.android.extservices.pem
--extra_apks com.android.hotspot2.osulogin.apex=$KEY_MAPPINGS/com.android.hotspot2.osulogin
--extra_apex_payload_key com.android.hotspot2.osulogin.apex=$KEY_MAPPINGS/com.android.hotspot2.osulogin.pem
--extra_apks com.android.i18n.apex=$KEY_MAPPINGS/com.android.i18n
--extra_apex_payload_key com.android.i18n.apex=$KEY_MAPPINGS/com.android.i18n.pem
--extra_apks com.android.ipsec.apex=$KEY_MAPPINGS/com.android.ipsec
--extra_apex_payload_key com.android.ipsec.apex=$KEY_MAPPINGS/com.android.ipsec.pem
--extra_apks com.android.media.apex=$KEY_MAPPINGS/com.android.media
--extra_apex_payload_key com.android.media.apex=$KEY_MAPPINGS/com.android.media.pem
--extra_apks com.android.media.swcodec.apex=$KEY_MAPPINGS/com.android.media.swcodec
--extra_apex_payload_key com.android.media.swcodec.apex=$KEY_MAPPINGS/com.android.media.swcodec.pem
--extra_apks com.android.mediaprovider.apex=$KEY_MAPPINGS/com.android.mediaprovider
--extra_apex_payload_key com.android.mediaprovider.apex=$KEY_MAPPINGS/com.android.mediaprovider.pem
--extra_apks com.android.nearby.halfsheet.apex=$KEY_MAPPINGS/com.android.nearby.halfsheet
--extra_apex_payload_key com.android.nearby.halfsheet.apex=$KEY_MAPPINGS/com.android.nearby.halfsheet.pem
--extra_apks com.android.neuralnetworks.apex=$KEY_MAPPINGS/com.android.neuralnetworks
--extra_apex_payload_key com.android.neuralnetworks.apex=$KEY_MAPPINGS/com.android.neuralnetworks.pem
--extra_apks com.android.ondevicepersonalization.apex=$KEY_MAPPINGS/com.android.ondevicepersonalization
--extra_apex_payload_key com.android.ondevicepersonalization.apex=$KEY_MAPPINGS/com.android.ondevicepersonalization.pem
--extra_apks com.android.os.statsd.apex=$KEY_MAPPINGS/com.android.os.statsd
--extra_apex_payload_key com.android.os.statsd.apex=$KEY_MAPPINGS/com.android.os.statsd.pem
--extra_apks com.android.permission.apex=$KEY_MAPPINGS/com.android.permission
--extra_apex_payload_key com.android.permission.apex=$KEY_MAPPINGS/com.android.permission.pem
--extra_apks com.android.resolv.apex=$KEY_MAPPINGS/com.android.resolv
--extra_apex_payload_key com.android.resolv.apex=$KEY_MAPPINGS/com.android.resolv.pem
--extra_apks com.android.runtime.apex=$KEY_MAPPINGS/com.android.runtime
--extra_apex_payload_key com.android.runtime.apex=$KEY_MAPPINGS/com.android.runtime.pem
--extra_apks com.android.safetycenter.resources.apex=$KEY_MAPPINGS/com.android.safetycenter.resources
--extra_apex_payload_key com.android.safetycenter.resources.apex=$KEY_MAPPINGS/com.android.safetycenter.resources.pem
--extra_apks com.android.scheduling.apex=$KEY_MAPPINGS/com.android.scheduling
--extra_apex_payload_key com.android.scheduling.apex=$KEY_MAPPINGS/com.android.scheduling.pem
--extra_apks com.android.sdkext.apex=$KEY_MAPPINGS/com.android.sdkext
--extra_apex_payload_key com.android.sdkext.apex=$KEY_MAPPINGS/com.android.sdkext.pem
--extra_apks com.android.support.apexer.apex=$KEY_MAPPINGS/com.android.support.apexer
--extra_apex_payload_key com.android.support.apexer.apex=$KEY_MAPPINGS/com.android.support.apexer.pem
--extra_apks com.android.telephony.apex=$KEY_MAPPINGS/com.android.telephony
--extra_apex_payload_key com.android.telephony.apex=$KEY_MAPPINGS/com.android.telephony.pem
--extra_apks com.android.tethering.apex=$KEY_MAPPINGS/com.android.tethering
--extra_apex_payload_key com.android.tethering.apex=$KEY_MAPPINGS/com.android.tethering.pem
--extra_apks com.android.tzdata.apex=$KEY_MAPPINGS/com.android.tzdata
--extra_apex_payload_key com.android.tzdata.apex=$KEY_MAPPINGS/com.android.tzdata.pem
--extra_apks com.android.uwb.apex=$KEY_MAPPINGS/com.android.uwb
--extra_apex_payload_key com.android.uwb.apex=$KEY_MAPPINGS/com.android.uwb.pem
--extra_apks com.android.uwb.resources.apex=$KEY_MAPPINGS/com.android.uwb.resources
--extra_apex_payload_key com.android.uwb.resources.apex=$KEY_MAPPINGS/com.android.uwb.resources.pem
--extra_apks com.android.virt.apex=$KEY_MAPPINGS/com.android.virt
--extra_apex_payload_key com.android.virt.apex=$KEY_MAPPINGS/com.android.virt.pem
--extra_apks com.android.vndk.current.apex=$KEY_MAPPINGS/com.android.vndk.current
--extra_apex_payload_key com.android.vndk.current.apex=$KEY_MAPPINGS/com.android.vndk.current.pem
--extra_apks com.android.wifi.apex=$KEY_MAPPINGS/com.android.wifi
--extra_apex_payload_key com.android.wifi.apex=$KEY_MAPPINGS/com.android.wifi.pem
--extra_apks com.android.wifi.dialog.apex=$KEY_MAPPINGS/com.android.wifi.dialog
--extra_apex_payload_key com.android.wifi.dialog.apex=$KEY_MAPPINGS/com.android.wifi.dialog.pem
--extra_apks com.android.wifi.resources.apex=$KEY_MAPPINGS/com.android.wifi.resources
--extra_apex_payload_key com.android.wifi.resources.apex=$KEY_MAPPINGS/com.android.wifi.resources.pem
--extra_apks com.qorvo.uwb.apex=$KEY_MAPPINGS/com.qorvo.uwb
--extra_apex_payload_key com.qorvo.uwb.apex=$KEY_MAPPINGS/com.qorvo.uwb.pem"
fi
sign_target_files_apks -o -d "$KEY_MAPPINGS" \
$OUT/obj/PACKAGING/target_files_intermediates/lineage_$DEVICE-target_files-eng.nobody.zip \
signed-target_files.zip
checkExit
if [ "$FLAG_IMG_ZIP" = 'y' ]; then
echo -e "${CLR_BLD_BLU}Generating signed fastboot package${CLR_RST}"
img_from_target_files \
signed-target_files.zip \
"$LINEAGE_VERSION-image.zip"
checkExit
else
echo -e "${CLR_BLD_BLU}Generating signed install package${CLR_RST}"
ota_from_target_files -k $KEY_MAPPINGS/releasekey \
--block --backup=true \
signed-target_files.zip \
"$LINEAGE_VERSION.zip"
checkExit
fi
# Build rom package
elif [ "$FLAG_IMG_ZIP" = 'y' ]; then
m otatools target-files-package "$CMD"
checkExit
echo -e "${CLR_BLD_BLU}Generating fastboot package${CLR_RST}"
img_from_target_files \
"$OUT/obj/PACKAGING/target_files_intermediates/lineage_$DEVICE-target_files-eng.nobody.zip" \
"$LINEAGE_VERSION-image.zip"
checkExit
else
m otapackage "$CMD"
checkExit
mv -f "$OUT/lineage_$DEVICE-ota-eng.nobody.zip" "$LINEAGE_VERSION.zip"
echo "Package Complete: $LINEAGE_VERSION.zip"
fi
echo -e ""
# Check the finishing time
TIME_END=$(date +%s.%N)
# Log those times at the end as a fun fact of the day
echo -e "${CLR_BLD_GRN}Total time elapsed:${CLR_RST} ${CLR_GRN}$(echo "($TIME_END - $TIME_START) / 60" | bc) minutes ($(echo "$TIME_END - $TIME_START" | bc) seconds)${CLR_RST}"
echo -e ""
exit 0