nixos/postgresql: Fix initdb for existing, empty postgres partitions
This commit is contained in:
parent
54022375eb
commit
b21fd5d066
@ -186,8 +186,9 @@ in
|
|||||||
preStart =
|
preStart =
|
||||||
''
|
''
|
||||||
# Initialise the database.
|
# Initialise the database.
|
||||||
if ! test -e ${cfg.dataDir}; then
|
if ! test -e ${cfg.dataDir}/PG_VERSION; then
|
||||||
mkdir -m 0700 -p ${cfg.dataDir}
|
mkdir -m 0700 -p ${cfg.dataDir}
|
||||||
|
rm -f ${cfg.dataDir}/*.conf
|
||||||
if [ "$(id -u)" = 0 ]; then
|
if [ "$(id -u)" = 0 ]; then
|
||||||
chown -R postgres ${cfg.dataDir}
|
chown -R postgres ${cfg.dataDir}
|
||||||
su -s ${pkgs.stdenv.shell} postgres -c 'initdb -U root'
|
su -s ${pkgs.stdenv.shell} postgres -c 'initdb -U root'
|
||||||
@ -195,8 +196,6 @@ in
|
|||||||
# For non-root operation.
|
# For non-root operation.
|
||||||
initdb
|
initdb
|
||||||
fi
|
fi
|
||||||
rm -f ${cfg.dataDir}/*.conf
|
|
||||||
touch "${cfg.dataDir}/.first_startup"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -sfn "${configFile}" "${cfg.dataDir}/postgresql.conf"
|
ln -sfn "${configFile}" "${cfg.dataDir}/postgresql.conf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user