Skip to content

Commit 53970fb

Browse files
committed
chore: account for loose files
1 parent 0e320d4 commit 53970fb

File tree

1 file changed

+3
-6
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+3
-6
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ function initiate_upgrade {
341341
echo "1.2. Installing flake revision: $NIX_FLAKE_VERSION"
342342
# shellcheck disable=SC1091
343343
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
344-
nix-collect-garbage -d > /tmp/pg_upgrade-nix-gc.log 2>&1 || true
344+
nix-collect-garbage -d > "${PG_UPGRADE_DIR}/pg_upgrade-nix-gc.log" 2>&1 || true
345345
PG_UPGRADE_BIN_DIR=$(nix build "github:supabase/postgres/${NIX_FLAKE_VERSION}#psql_15/bin" --no-link --print-out-paths --extra-experimental-features nix-command --extra-experimental-features flakes)
346346
PGSHARENEW="$PG_UPGRADE_BIN_DIR/share/postgresql"
347347
fi
@@ -360,10 +360,7 @@ function initiate_upgrade {
360360

361361
chown -R postgres:postgres "$PG_UPGRADE_BIN_DIR"
362362

363-
# upgrade job outputs a log in the cwd; needs write permissions
364-
mkdir -p /tmp/pg_upgrade/
365-
chown -R postgres:postgres /tmp/pg_upgrade/
366-
cd /tmp/pg_upgrade/
363+
cd "$PG_UPGRADE_DIR"
367364

368365
# Fixing erros generated by previous dpkg executions (package upgrades et co)
369366
echo "2. Fixing potential errors generated by dpkg"
@@ -487,7 +484,7 @@ EOF
487484
# copy sql files generated by pg_upgrade
488485
echo "12. Copying sql files generated by pg_upgrade"
489486
mkdir -p "$MOUNT_POINT/sql"
490-
cp /tmp/pg_upgrade/*.sql "$MOUNT_POINT/sql/" || true
487+
cp "$PG_UPGRADE_DIR"/pg_upgrade/*.sql "$MOUNT_POINT/sql/" || true
491488
chown -R postgres:postgres "$MOUNT_POINT/sql/"
492489

493490
echo "13. Cleaning up"

0 commit comments

Comments
 (0)