From dae05ae17f6257f82e2cff1e55175997394d0eef Mon Sep 17 00:00:00 2001 From: Toilal Date: Thu, 5 Mar 2015 10:16:40 +0100 Subject: [PATCH] Create owncloud configuration files even if database exists --- setup/owncloud.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/setup/owncloud.sh b/setup/owncloud.sh index 0597b8fb..fec33eb2 100755 --- a/setup/owncloud.sh +++ b/setup/owncloud.sh @@ -31,13 +31,15 @@ fi # ### Configuring ownCloud +OWNCLOUD_CONFIG=/usr/local/lib/owncloud/config/config.php + # Setup ownCloud if the ownCloud database does not yet exist. Running setup when # the database does exist wipes the database and user data. -if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then +if [ ! -f $OWNCLOUD_CONFIG ]; then # Create a configuration file. TIMEZONE=$(cat /etc/timezone) instanceid=oc$(echo $PRIMARY_HOSTNAME | sha1sum | fold -w 10 | head -n 1) - cat > /usr/local/lib/owncloud/config/config.php < $OWNCLOUD_CONFIG < '$STORAGE_ROOT/owncloud', @@ -74,7 +76,13 @@ if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then ); ?> EOF +fi +# Create user data directory and set permissions +mkdir -p $STORAGE_ROOT/owncloud +chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud + +if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then # Create an auto-configuration file to fill in database settings # when the install script is run. Make an administrator account # here or else the install can't finish. @@ -94,10 +102,6 @@ EOF ?> EOF - # Create user data directory and set permissions - mkdir -p $STORAGE_ROOT/owncloud - chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud - # Execute ownCloud's setup step, which creates the ownCloud sqlite database. # It also wipes it if it exists. And it deletes the autoconfig.php file. (cd /usr/local/lib/owncloud; sudo -u www-data php /usr/local/lib/owncloud/index.php;)