#!/bin/sh # Creates an apex stub in a subdirectory named after the input package name. # Exit early if any subcommands fail. set -e usage() { echo "Usage $0 [options] apex_package_name" echo " -v" echo " Whether this is a vendor APEX" echo " -k existing_apex_keyname" echo " Use existing key instead of creating a new key" echo " -m" echo " Whether this is a Mainline module" exit -1 } is_vendor=0 mainline_module=0 while getopts "vmk:" opt; do case $opt in v) is_vendor=1 ;; k) APEX_KEY=${OPTARG} ;; m) mainline_module=1 ;; *) usage esac done shift $((OPTIND-1)) APEX_NAME=$1 if [ -z ${APEX_NAME} ] then echo "Missing apex package name" usage fi YEAR=$(date +%Y) # For Mainline module, add the apex at the root apex/ directory. if ((mainline_module == 0)); then mkdir -p ${APEX_NAME} cd ${APEX_NAME} fi cat > Android.bp < csr.conf <> Android.bp <> Android.bp <> Android.bp < manifest.json << EOF { "name": "${APEX_NAME}", // Placeholder module version to be replaced during build. // Do not change! "version": 0 } EOF else cat >> Android.bp < manifest.json << EOF { "name": "${APEX_NAME}", "version": 1 } EOF cat > file_contexts << EOF (/.*)? u:object_r:vendor_file:s0 /etc(/.*)? u:object_r:vendor_configs_file:s0 # Add more ... # /bin/hw/foo u:object_r:hal_foo_exec:s0 EOF fi