git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/postgresql: Fix initdb for existing, empty postgres partitions
commitb21fd5d066baadb06ca8e9a2accfcb4e94c60a09 authorWilliam A. Kennington III <william@wkennington.com> dateThu 2 Jul 2015, 00:08 (11 years ago) parent5402237
1 file changed+2−3
nixos/modules/services/databases/postgresql.nix+2−3
nixos/modules/services/databases/postgresql.nix+2−3
@@ -186,8 +186,9 @@ in
186186 preStart =
187187 ''
188188 # Initialise the database.
189− if ! test -e ${cfg.dataDir}; then
189+ if ! test -e ${cfg.dataDir}/PG_VERSION; then
190190 mkdir -m 0700 -p ${cfg.dataDir}
191+ rm -f ${cfg.dataDir}/*.conf
191192 if [ "$(id -u)" = 0 ]; then
192193 chown -R postgres ${cfg.dataDir}
193194 su -s ${pkgs.stdenv.shell} postgres -c 'initdb -U root'
@@ -195,8 +196,6 @@ in
195196 # For non-root operation.
196197 initdb
197198 fi
198− rm -f ${cfg.dataDir}/*.conf
199− touch "${cfg.dataDir}/.first_startup"
200199 fi
201200
202201 ln -sfn "${configFile}" "${cfg.dataDir}/postgresql.conf"