51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
umask 077
|
|
|
|
ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
|
|
env_file=${1:-"$ROOT/.env"}
|
|
config_home=${XDG_CONFIG_HOME:-"$HOME/.config"}
|
|
signing_dir=${WNH_ANDROID_DEVELOPMENT_SIGNING_DIR:-"$config_home/who_need_help/android-development"}
|
|
key_alias=${WNH_ANDROID_DEVELOPMENT_SIGNING_KEY_ALIAS:-who-need-help-development}
|
|
keystore="$signing_dir/who-need-help-development.p12"
|
|
password_file="$signing_dir/who-need-help-development.password"
|
|
values_file=$(mktemp "${TMPDIR:-/tmp}/wnh-android-development-env.XXXXXX")
|
|
|
|
cleanup() {
|
|
if [ -e "$values_file" ]; then
|
|
unlink "$values_file"
|
|
fi
|
|
}
|
|
trap cleanup EXIT HUP INT TERM
|
|
|
|
case "$env_file" in
|
|
/*) ;;
|
|
*) env_file="$ROOT/$env_file" ;;
|
|
esac
|
|
|
|
if [ ! -f "$env_file" ]; then
|
|
echo "Development environment file does not exist: $env_file" >&2
|
|
exit 1
|
|
fi
|
|
|
|
fingerprint=$(
|
|
"$ROOT/scripts/android-signing-fingerprint.sh" \
|
|
"$keystore" \
|
|
"$password_file" \
|
|
"$key_alias"
|
|
)
|
|
|
|
printf '%s\n' \
|
|
'DEPLOYMENT_ENV=development' \
|
|
'ANDROID_APP_LINKS_PACKAGE_NAME=org.whoneedhelp.mobile.development' \
|
|
"ANDROID_APP_LINKS_SHA256_CERT_FINGERPRINTS=$fingerprint" \
|
|
"WNH_ANDROID_DEVELOPMENT_SIGNING_KEY_ALIAS=$key_alias" \
|
|
>"$values_file"
|
|
chmod 600 "$values_file"
|
|
|
|
"$ROOT/scripts/set-env-values.sh" "$env_file" "$values_file" >/dev/null
|
|
"$ROOT/scripts/validate-android-environment.sh" "$env_file" development
|
|
|
|
echo "Configured the ignored development environment with the public Android identity."
|