Merge pull request #6283 from mdorman/master

Fix initial-install issues with couchdb.nix.
This commit is contained in:
lethalman 2015-02-26 10:11:18 +01:00
commit b6672f232a
1 changed files with 6 additions and 3 deletions

View File

@ -131,8 +131,8 @@ in {
type = types.string;
default = "/var/lib/couchdb/couchdb.ini";
description = ''
Custom configuration file. File needs to be readable and writable
from couchdb user/group.
Configuration file for persisting runtime changes. File
needs to be readable and writable from couchdb user/group.
'';
};
@ -157,12 +157,15 @@ in {
mkdir -p ${cfg.databaseDir};
mkdir -p ${cfg.viewIndexDir};
touch ${cfg.configFile}
touch -a ${cfg.logFile}
if [ "$(id -u)" = 0 ]; then
chown ${cfg.user}:${cfg.group} ${cfg.uriFile}
chown ${cfg.user}:${cfg.group} `dirname ${cfg.uriFile}`;
(-f ${cfg.uriFile} && chown ${cfg.user}:${cfg.group} ${cfg.uriFile}) || true
chown ${cfg.user}:${cfg.group} ${cfg.databaseDir}
chown ${cfg.user}:${cfg.group} ${cfg.viewIndexDir}
chown ${cfg.user}:${cfg.group} ${cfg.configFile}
chown ${cfg.user}:${cfg.group} ${cfg.logFile}
fi
'';