22
0
mirror of https://github.com/SuperSandro2000/nixos-modules.git synced 2024-06-14 03:46:57 +02:00

postgres: exit if up to date

This commit is contained in:
Sandro - 2023-01-06 22:08:26 +01:00
parent 5c68301e93
commit 85bdc26d2d
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5

View File

@ -38,10 +38,17 @@ in
newBin = "${cfg.newPackage}/bin";
oldData = config.services.postgresql.dataDir;
oldBin = "${config.services.postgresql.package}/bin";
currPkg = config.services.postgresql.package;
in
pkgs.writeScriptBin "upgrade-pg-cluster" /* bash */ ''
set -eux
if [[ ${cfg.newPackage} == ${currPkg} ]]; then
echo "There is no major postgres update available."
echo "Current version: ${currPkg.version}"
exit 2
fi
systemctl stop --wait postgresql ${lib.concatStringsSep " " cfg.stopServices}
install -d -m 0700 -o postgres -g postgres "${newData}"