diff options
-rw-r--r-- | cozy.install | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cozy.install b/cozy.install index 23711bb82951..7a0f556eef71 100644 --- a/cozy.install +++ b/cozy.install @@ -52,12 +52,12 @@ post_install() { if [ ! -f /etc/cozy/couchdb.login ]; then if [ ! -f /tmp/couchdb.login ]; then - msg 'Found tokens from previous installation' - cp /tmp/couchdb.login /etc/cozy/couchdb.login - else msg 'Generating CouchDB tokens...' pwgen -1 > /etc/cozy/couchdb.login && \ pwgen -1 >> /etc/cozy/couchdb.login + else + msg 'Found tokens from previous installation' + cp /tmp/couchdb.login /etc/cozy/couchdb.login fi msg 'Enabling CouchDB' systemctl enable couchdb @@ -72,7 +72,9 @@ post_install() { fi sleep 5 done - curl -s -X PUT 127.0.0.1:5984/_config/admins/$(head -n1 /etc/cozy/couchdb.login) -d "\"$(tail -n1 /etc/cozy/couchdb.login)\"" + if [ ! -f /tmp/couchdb.login ]; then + curl -s -X PUT 127.0.0.1:5984/_config/admins/$(head -n1 /etc/cozy/couchdb.login) -d "\"$(tail -n1 /etc/cozy/couchdb.login)\"" + fi fi chown cozy-data-system /etc/cozy/couchdb.login chmod 640 /etc/cozy/couchdb.login |