32 lines
1.2 KiB
Bash
32 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|||
|
|
|
||
|
|
set -Eeuo pipefail
|
||
|
|
|
||
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
# shellcheck source=install_common.sh
|
||
|
|
source "$SCRIPT_DIR/install_common.sh"
|
||
|
|
|
||
|
|
readonly STAGING_DIR="${STAGING_DIR:-/app/staging_area/copilot/tmp}"
|
||
|
|
readonly POSTGRES_ROOT="${POSTGRES_ROOT:-/app/postgres/rdbms}"
|
||
|
|
readonly PG_CRON_REPOSITORY="${PG_CRON_REPOSITORY:-citusdata/pg_cron}"
|
||
|
|
|
||
|
|
[[ $# -eq 1 ]] || die "Usage: $0 <postgresql-version>"
|
||
|
|
readonly POSTGRES_VERSION="$1"
|
||
|
|
validate_postgresql_version "$POSTGRES_VERSION"
|
||
|
|
require_tools curl tar make
|
||
|
|
readonly PREFIX="$POSTGRES_ROOT/$POSTGRES_VERSION"
|
||
|
|
readonly PG_CONFIG="$PREFIX/bin/pg_config"
|
||
|
|
require_postgresql_installation "$PREFIX"
|
||
|
|
reset_staging_dir "$STAGING_DIR"
|
||
|
|
|
||
|
|
readonly PG_CRON_TAG="${PG_CRON_TAG:-$(latest_tag "$PG_CRON_REPOSITORY")}"
|
||
|
|
[[ -n "$PG_CRON_TAG" ]] || die "could not determine the latest pg_cron release"
|
||
|
|
readonly PG_CRON_DIR="$STAGING_DIR/pg_cron-${PG_CRON_TAG#v}"
|
||
|
|
|
||
|
|
printf 'Building pg_cron %s\n' "$PG_CRON_TAG"
|
||
|
|
download_source "$STAGING_DIR" "$PG_CRON_REPOSITORY" "$PG_CRON_TAG" \
|
||
|
|
"pg_cron-${PG_CRON_TAG#v}.tar.gz" "$PG_CRON_DIR"
|
||
|
|
cd "$PG_CRON_DIR"
|
||
|
|
make -j"${JOBS:-$(nproc)}" PG_CONFIG="$PG_CONFIG"
|
||
|
|
make install PG_CONFIG="$PG_CONFIG"
|
||
|
|
test -x "$PREFIX/lib/pg_cron.so"
|