diff options
author | Brendan Abolivier | 2016-03-13 21:37:46 +0100 |
---|---|---|
committer | Brendan Abolivier | 2016-03-13 21:37:46 +0100 |
commit | bf94928ab2e0fb955e3ca0bb8ec88c8aaed372bf (patch) | |
tree | 68ef0eaad89d2f08ddf6ef28bc944073aaada6a5 /configure-cozy-domain | |
download | aur-bf94928ab2e0fb955e3ca0bb8ec88c8aaed372bf.tar.gz |
First commit
Diffstat (limited to 'configure-cozy-domain')
-rwxr-xr-x | configure-cozy-domain | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/configure-cozy-domain b/configure-cozy-domain new file mode 100755 index 000000000000..5a7d18bf4f2b --- /dev/null +++ b/configure-cozy-domain @@ -0,0 +1,26 @@ +#!/bin/sh + +if [ $# -eq 1 ]; then + COZY_DOMAIN=$1 + + CURRENT_DOMAIN=`/usr/bin/cozy_management get_cozy_param domain` + if [ "$CURRENT_DOMAIN" = "$COZY_DOMAIN" ]; then + echo "Cozy already configured with domain: $COZY_DOMAIN" + else + echo "Configuring Cozy with domain: $COZY_DOMAIN" + coffee /usr/local/cozy/apps/home/commands.coffee setdomain $COZY_DOMAIN + fi + + echo 'Generating SSL keys and certificates...' + if [ ! -f /etc/cozy/dh.pem ]; then + openssl dhparam -out /etc/cozy/dh.pem -outform PEM -2 2048 + chmod 400 /etc/cozy/dh.pem + fi + if [ ! -f /etc/cozy/server.crt ]; then + cozy_management normalize_cert_dir + cozy_management generate_certificate ${COZY_DOMAIN} + fi +else + echo "Usage: /usr/bin/configure-cozy-domain cozy.example.tld" + echo "Replace \"cozy.example.tld\" by your Cozy's own domain" +fi |