diff --git a/build.sh b/build.sh index 2c098ad..97dc57f 100755 --- a/build.sh +++ b/build.sh @@ -56,6 +56,11 @@ preflight_check() { ok=false fi + if ! command -v keytool &>/dev/null; then + error "keytool not found. It ships with the JDK — check your JAVA_HOME/PATH." + ok=false + fi + if [[ ! -x "./gradlew" ]]; then error "Gradle wrapper not found or not executable." ok=false @@ -133,6 +138,9 @@ create_keystore() { info "Creating keystore..." + local keytool_err + keytool_err=$(mktemp) + keytool -genkeypair \ -alias "$KEY_ALIAS" \ -keyalg RSA \ @@ -142,9 +150,10 @@ create_keystore() { -storepass "$password" \ -keypass "$password" \ -dname "$dname" \ - 2>/dev/null || true + 2>"$keytool_err" || true if [[ -f "$KEYSTORE_FILE" ]]; then + rm -f "$keytool_err" echo "" success "Keystore created at ${BOLD}$KEYSTORE_FILE${NC}" echo "" @@ -153,6 +162,10 @@ create_keystore() { warn "that already have this version installed." else error "Keystore creation failed." + if [[ -s "$keytool_err" ]]; then + echo -e "${DIM}$(cat "$keytool_err")${NC}" >&2 + fi + rm -f "$keytool_err" return 1 fi }