From 3528c446fb5d17f498a6cd74f26bfe65fdc2efbd Mon Sep 17 00:00:00 2001 From: Thomas Penteker Date: Fri, 18 Mar 2016 23:11:58 +0100 Subject: [PATCH] postgresql: make post-install idempotent --- postgresql/post-install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/postgresql/post-install b/postgresql/post-install index fe0e066b7..8d2481b95 100755 --- a/postgresql/post-install +++ b/postgresql/post-install @@ -8,6 +8,8 @@ ID=42 getent group ${GROUP} >/dev/null || groupadd -r ${GROUP} getent passwd ${USER} >/dev/null || useradd -u $ID -d ${HOME} -g ${GROUP} -s /bin/false ${USER} +test -d ${HOME} && exit 0 + install -d -o ${USER} -g ${GROUP} ${HOME} su -s /bin/sh -c "pg_ctl -D ${HOME} initdb" ${USER}