From 14cb9c51a7fc3bb68646a793624146d43c158adf Mon Sep 17 00:00:00 2001 From: Chihyun Song Date: Sun, 10 Feb 2019 16:47:51 +0900 Subject: [PATCH] Fix permission error on Synology NAS There were two bugs when trying to run the image on Synology NAS (DSM 6.2.1-23824 Update 4): 1) `initdb` failed because the permission of ${PG_HOME} was 000, and 2) `sed -i` failed because `sed` internally could not generate temporary files --- runtime/functions | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/functions b/runtime/functions index 440c206..e0befbe 100755 --- a/runtime/functions +++ b/runtime/functions @@ -32,6 +32,7 @@ create_datadir() { find ${PG_DATADIR} -type d -exec chmod 0700 {} \; fi chown -R ${PG_USER}:${PG_USER} ${PG_HOME} + chmod 700 ${PG_HOME} } create_certdir() { @@ -70,7 +71,7 @@ set_postgresql_param() { echo "‣ Setting postgresql.conf parameter: ${key} = '${value}'" fi value="$(echo "${value}" | sed 's|[&]|\\&|g')" - exec_as_postgres sed -i "s|^[#]*[ ]*${key} = .*|${key} = '${value}'|" ${PG_CONF} + sed -i "s|^[#]*[ ]*${key} = .*|${key} = '${value}'|" ${PG_CONF} fi fi } @@ -86,7 +87,7 @@ set_recovery_param() { true) echo "‣ Setting primary_conninfo parameter: ${key}" ;; *) echo "‣ Setting primary_conninfo parameter: ${key} = '${value}'" ;; esac - exec_as_postgres sed -i "s|${key}=[^ ']*|${key}=${value}|" ${PG_RECOVERY_CONF} + sed -i "s|${key}=[^ ']*|${key}=${value}|" ${PG_RECOVERY_CONF} fi fi }