summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrendan Abolivier2016-03-14 21:35:24 +0100
committerBrendan Abolivier2016-03-14 21:35:24 +0100
commit315af46db45b60305f9d2f2fdaceee84083002c3 (patch)
tree67c7b2714da892524f547602ae86eb88e3c71b6f
parente717fc58db41806441d424a50488fc4dc5e14c60 (diff)
downloadaur-315af46db45b60305f9d2f2fdaceee84083002c3.tar.gz
Added safe check
-rw-r--r--cozy.install10
1 files changed, 6 insertions, 4 deletions
diff --git a/cozy.install b/cozy.install
index 23711bb8295..7a0f556eef7 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