From 63afbd4d60f8292e8e7d9dc99c75f00c25e7213f Mon Sep 17 00:00:00 2001 From: Fernando Alegre Date: Sun, 17 Nov 2024 21:11:21 -0600 Subject: [PATCH] made prep idempotent --- nextcloud/data/ncconfig/host.config.php | 6 ++--- nextcloud/data/ncconfig/secret.config.php | 3 ++- nextcloud/scripts/prep.sh | 30 ++++++++++++++++------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/nextcloud/data/ncconfig/host.config.php b/nextcloud/data/ncconfig/host.config.php index 0db22bf..b3079b2 100644 --- a/nextcloud/data/ncconfig/host.config.php +++ b/nextcloud/data/ncconfig/host.config.php @@ -2,11 +2,11 @@ $CONFIG = array( 'trusted_domains' => array ( - 0 => 'cloud.alemor.org', + 0 => 'example.domain.com', ), 'overwriteprotocol' => 'https', -'overwritehost' => 'cloud.alemor.org', +'overwritehost' => 'example.domain.com', ### 'overwritewebroot' => '/nextcloud', -'overwrite.cli.url' => 'https://cloud.alemor.org/', +'overwrite.cli.url' => 'https://example.domain.com/', 'default_phone_region' => 'US' ); diff --git a/nextcloud/data/ncconfig/secret.config.php b/nextcloud/data/ncconfig/secret.config.php index 58cc67e..e400174 100644 --- a/nextcloud/data/ncconfig/secret.config.php +++ b/nextcloud/data/ncconfig/secret.config.php @@ -1,8 +1,9 @@ 'Tor00eCxYW7hxUzeBhdzEU0+MJWwg/', 'secret' => 'jBL6XxrYZs7h5TQcLDB33vB5N4RzHxomGGgUEer25K4wdSwc', 'instanceid' => 'oc3sbo2jitqd', +*/ ); diff --git a/nextcloud/scripts/prep.sh b/nextcloud/scripts/prep.sh index 7588ed2..5f7d697 100644 --- a/nextcloud/scripts/prep.sh +++ b/nextcloud/scripts/prep.sh @@ -1,16 +1,28 @@ #!/bin/sh -USE_HOST=cloud.alemor.org - DATADIR=$HOME/vol/nextcloud/data +FILEDIR=$HOME/vol/nextcloud/files + +if [ -f env ]; then + . ./env +else + echo "Need env like:" + echo USE_HOST="" + exit 1 +fi + +if [ ! -d $DATADIR ]; then + mkdir -p $DATADIR/etc $DATADIR/ncconfig + cp data/ncconfig/* $DATADIR/ncconfig/ + sed -e "s/example.domain.com/$USE_HOST/" \ + data/ncconfig/host.config.php \ + > $DATADIR/ncconfig/host.config.php +fi + +if [ ! -d $FILEDIR ]; then + mkdir -p $FILEDIR +fi -mkdir -p $DATADIR/etc \ - $DATADIR/ncconfig \ - $HOME/vol/nextcloud/files -cp data/ncconfig/* $DATADIR/ncconfig/ -sed -e "s/example.domain.com/$USE_HOST/" \ - data/ncconfig/host.config.php \ - > $DATADIR/ncconfig/host.config.php mkdir -p assets/nextcloud cd assets/nextcloud