autoconfigure owncloud
This commit is contained in:
parent
a98bcfc173
commit
f6cc5042d5
|
@ -6531,44 +6531,6 @@ function upgrade_owncloud_finish {
|
|||
cp -r $OWNCLOUD_UPGRADE_PATH/data/* $OWNCLOUD_PATH/data/
|
||||
chown -R www-data:www-data $OWNCLOUD_PATH/data
|
||||
|
||||
if [ ! -f $OWNCLOUD_PATH/config/config.sample.php ]; then
|
||||
echo $'No owncloud configuration sample file found'
|
||||
exit 54289
|
||||
fi
|
||||
cp $OWNCLOUD_PATH/config/config.sample.php $OWNCLOUD_PATH/config/config.php
|
||||
|
||||
if [ -f $OWNCLOUD_UPGRADE_PATH/config/config.php ]; then
|
||||
OWNCLOUD_INSTANCE_ID=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "instanceid" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_PASSWORD_SALT=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "passwordsalt" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_DATA_DIR=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "datadirectory" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_DBTYPE=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "dbtype" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_DBNAME=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "dbname" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_DBHOST=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "dbhost" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_DBUSER=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "dbuser" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_DBPASS=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "dbpassword" | awk -F "'" '{print $4}')
|
||||
OWNCLOUD_SECRET=$(cat $OWNCLOUD_UPGRADE_PATH/config/config.php | grep "secret" | awk -F "'" '{print $4}')
|
||||
|
||||
sed -i "s|'instanceid'.*|'instanceid' => '$OWNCLOUD_INSTANCE_ID',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'passwordsalt'.*|'passwordsalt' => '$OWNCLOUD_PASSWORD_SALT',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'datadirectory'.*|'datadirectory' => '$OWNCLOUD_DATA_DIR',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbtype'.*|'dbtype' => '$OWNCLOUD_DBTYPE',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbname'.*|'dbname' => '$OWNCLOUD_DBNAME',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbhost'.*|'dbhost' => '$OWNCLOUD_DBHOST',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbuser'.*|'dbuser' => '$OWNCLOUD_DBUSER',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbpassword'.*|'dbpassword' => '$OWNCLOUD_DBPASS',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'secret'.*|'secret' => '$OWNCLOUD_SECRET',|g" $OWNCLOUD_PATH/config/config.php
|
||||
fi
|
||||
|
||||
chown root:root $OWNCLOUD_PATH/config/config.php
|
||||
|
||||
# re-index the files
|
||||
for d in /home/*/ ; do
|
||||
USRNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||
if [[ $USRNAME != "git" && $USRNAME != "mirrors" ]]; then
|
||||
$OWNCLOUD_PATH/occ files:scan $USRNAME
|
||||
fi
|
||||
done
|
||||
|
||||
# remove the temporary upgrade
|
||||
rm -rf $OWNCLOUD_UPGRADE_PATH
|
||||
}
|
||||
|
@ -6883,43 +6845,20 @@ function install_owncloud_official_deb {
|
|||
|
||||
upgrade_owncloud_finish
|
||||
|
||||
# copy the configuration file
|
||||
if [ ! -f $OWNCLOUD_PATH/config/config.php ]; then
|
||||
if [ ! -f $OWNCLOUD_PATH/config/config.sample.php ]; then
|
||||
echo $'No owncloud configuration sample file found'
|
||||
exit 54289
|
||||
fi
|
||||
cp $OWNCLOUD_PATH/config/config.sample.php $OWNCLOUD_PATH/config/config.php
|
||||
chown root:root $OWNCLOUD_PATH/config/config.php
|
||||
fi
|
||||
|
||||
if [ -f $OWNCLOUD_PATH/config/config.php ]; then
|
||||
OWNCLOUD_INSTANCE_ID="$(openssl rand -base64 14 | cut -c1-12)"
|
||||
OWNCLOUD_PASSWORD_SALT="$(openssl rand -base64 32 | cut -c1-30)"
|
||||
OWNCLOUD_DATA_DIR="$OWNCLOUD_PATH/data"
|
||||
OWNCLOUD_DBTYPE='mysql'
|
||||
OWNCLOUD_DBNAME='owncloud'
|
||||
OWNCLOUD_DBHOST='localhost'
|
||||
OWNCLOUD_DBUSER="owncloudadmin"
|
||||
OWNCLOUD_DBPASS="$OWNCLOUD_ADMIN_PASSWORD"
|
||||
OWNCLOUD_SECRET="$(openssl rand -base64 32 | cut -c1-30)$(openssl rand -base64 32 | cut -c1-30)$(openssl rand -base64 32 | cut -c1-30)$(openssl rand -base64 32 | cut -c1-30)"
|
||||
|
||||
sed -i "s|demo.example.org|${OWNCLOUD_DOMAIN_NAME}|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|otherdomain.example.org|${OWNCLOUD_ONION_HOSTNAME}|g" $OWNCLOUD_PATH/config/config.php
|
||||
|
||||
if [ ! $UPGRADING_OWNCLOUD ]; then
|
||||
sed -i "s|'instanceid'.*|'instanceid' => '$OWNCLOUD_INSTANCE_ID',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'passwordsalt'.*|'passwordsalt' => '$OWNCLOUD_PASSWORD_SALT',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'secret'.*|'secret' => '$OWNCLOUD_SECRET',|g" $OWNCLOUD_PATH/config/config.php
|
||||
fi
|
||||
sed -i "s|'datadirectory'.*|'datadirectory' => '$OWNCLOUD_DATA_DIR',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbtype'.*|'dbtype' => '$OWNCLOUD_DBTYPE',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbname'.*|'dbname' => '$OWNCLOUD_DBNAME',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbhost'.*|'dbhost' => '$OWNCLOUD_DBHOST',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbuser'.*|'dbuser' => '$OWNCLOUD_DBUSER',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'dbpassword'.*|'dbpassword' => '$OWNCLOUD_DBPASS',|g" $OWNCLOUD_PATH/config/config.php
|
||||
sed -i "s|'mail_domain'.*|'mail_domain' => '$DEFAULT_DOMAIN_NAME',|g" $OWNCLOUD_PATH/config/config.php
|
||||
fi
|
||||
echo "<?php
|
||||
$AUTOCONFIG = array(
|
||||
\"dbtype\" => \"mysql\",
|
||||
\"dbname\" => \"owncloud\",
|
||||
\"dbuser\" => \"owncloudadmin\",
|
||||
\"dbpass\" => \"$OWNCLOUD_ADMIN_PASSWORD\",
|
||||
\"dbhost\" => \"localhost\",
|
||||
\"dbtableprefix\" => \"\",
|
||||
\"trusted_domains\" =>
|
||||
array (
|
||||
'${OWNCLOUD_DOMAIN_NAME}',
|
||||
'${OWNCLOUD_ONION_HOSTNAME}',
|
||||
),
|
||||
);" > $OWNCLOUD_PATH/config/autoconfig.php
|
||||
|
||||
echo 'install_owncloud_official_deb' >> $COMPLETION_FILE
|
||||
|
||||
|
|
Loading…
Reference in New Issue