This commit is contained in:
@@ -28,6 +28,7 @@ mode_of() {
|
||||
sed -n '/^database_host()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^database_port()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^database_name()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^validate_database_configuration()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^is_semver()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^write_env_file_preserving_unknown()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^normalized_host_arch()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
@@ -41,13 +42,15 @@ mode_of() {
|
||||
sed -n '/^release_asset_url()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^download_release_asset()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^install_packages()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^mysql_client_bin()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^preflight_database()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^secure_release_tree()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
sed -n '/^restore_unit_state()/,/^}/p' "$ROOT/deploy/install.sh"
|
||||
} > "$WORK/helpers.sh"
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "$WORK/helpers.sh"
|
||||
# Avoid invoking the host's macOS `log` utility while exercising extracted
|
||||
# installer helpers.
|
||||
log() { printf '%s\n' "$*" >/dev/null; }
|
||||
|
||||
export SETUP_WIZARD=true
|
||||
preflight_database || fail 'setup wizard database preflight returned a failure status'
|
||||
@@ -66,10 +69,21 @@ cat > "$WORK/mysql-bin/mysql" <<'SH'
|
||||
exit 0
|
||||
SH
|
||||
chmod 0755 "$WORK/mysql-bin/mysql"
|
||||
export KAIDI_MYSQL_CLIENT="$WORK/mysql-bin/mysql"
|
||||
[ "$(mysql_client_bin)" = "$WORK/mysql-bin/mysql" ] \
|
||||
|| fail 'installer did not honor the explicit MySQL client path'
|
||||
unset KAIDI_MYSQL_CLIENT
|
||||
# Production-mode validation is intentionally side-effect free: it validates
|
||||
# the JDBC shape but never invokes a MySQL client or emits DDL/DML.
|
||||
SETUP_WIZARD=false
|
||||
DB_URL='jdbc:mysql://127.0.0.1:3306/kaidi_finance?useUnicode=true'
|
||||
DB_USERNAME='fixture-user'
|
||||
DB_PASSWORD='fixture-password'
|
||||
mysql_probe_marker="$WORK/mysql-probe-called"
|
||||
cat > "$WORK/mysql-bin/mysql" <<SH
|
||||
#!/bin/sh
|
||||
printf 'called\n' > "$mysql_probe_marker"
|
||||
exit 99
|
||||
SH
|
||||
chmod 0755 "$WORK/mysql-bin/mysql"
|
||||
preflight_database || fail 'side-effect-free database configuration validation returned a failure status'
|
||||
[ ! -e "$mysql_probe_marker" ] || fail 'installer invoked a MySQL client during configuration validation'
|
||||
|
||||
release_permissions="$WORK/release-permissions"
|
||||
mkdir -p "$release_permissions/public" "$release_permissions/ops"
|
||||
|
||||
Reference in New Issue
Block a user