Move OwnCloud's config to Storage Root
This commit is contained in:
parent
e4caed9277
commit
38632f0f90
1 changed files with 22 additions and 10 deletions
|
@ -18,17 +18,26 @@ apt-get purge -qq -y owncloud*
|
||||||
owncloud_ver=8.0.3
|
owncloud_ver=8.0.3
|
||||||
owncloud_hash=3192f3d783f81247eaf2914df63afdd593def4e5
|
owncloud_hash=3192f3d783f81247eaf2914df63afdd593def4e5
|
||||||
|
|
||||||
|
# Migrate existing configurations
|
||||||
|
if [ ! -f $STORAGE_ROOT/owncloud/config.php ] \
|
||||||
|
&& [ -f /usr/local/lib/owncloud/config/config.php ]; then
|
||||||
|
|
||||||
|
# Move config.php
|
||||||
|
mv /usr/local/lib/owncloud/config/config.php $STORAGE_ROOT/owncloud/config.php
|
||||||
|
|
||||||
|
# Symlink OwnCloud's config
|
||||||
|
ln -sf $STORAGE_ROOT/owncloud/config.php /usr/local/lib/owncloud/config/config.php
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if ownCloud dir exist, and check if version matches owncloud_ver (if either doesn't - install/upgrade)
|
# Check if ownCloud dir exist, and check if version matches owncloud_ver (if either doesn't - install/upgrade)
|
||||||
if [ ! -d /usr/local/lib/owncloud/ ] \
|
if [ ! -d /usr/local/lib/owncloud/ ] \
|
||||||
|| ! grep -q $owncloud_ver /usr/local/lib/owncloud/version.php; then
|
|| ! grep -q $owncloud_ver /usr/local/lib/owncloud/version.php; then
|
||||||
|
|
||||||
# Clear out the existing ownCloud.
|
# Clear out the existing ownCloud.
|
||||||
rm -f /tmp/owncloud-config.php
|
|
||||||
if [ ! -d /usr/local/lib/owncloud/ ]; then
|
if [ ! -d /usr/local/lib/owncloud/ ]; then
|
||||||
echo installing ownCloud...
|
echo installing ownCloud...
|
||||||
else
|
else
|
||||||
echo "upgrading ownCloud to $owncloud_ver (backing up existing ownCloud directory to /tmp/owncloud-backup-$$)..."
|
echo "upgrading ownCloud to $owncloud_ver (backing up existing ownCloud directory to /tmp/owncloud-backup-$$)..."
|
||||||
cp /usr/local/lib/owncloud/config/config.php /tmp/owncloud-config.php
|
|
||||||
mv /usr/local/lib/owncloud /tmp/owncloud-backup-$$
|
mv /usr/local/lib/owncloud /tmp/owncloud-backup-$$
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -46,10 +55,8 @@ if [ ! -d /usr/local/lib/owncloud/ ] \
|
||||||
# Fix weird permissions.
|
# Fix weird permissions.
|
||||||
chmod 750 /usr/local/lib/owncloud/{apps,config}
|
chmod 750 /usr/local/lib/owncloud/{apps,config}
|
||||||
|
|
||||||
# Restore configuration file if we're doing an upgrade.
|
# Make sure our symlink exists
|
||||||
if [ -f /tmp/owncloud-config.php ]; then
|
ln -sf $STORAGE_ROOT/owncloud/config.php /usr/local/lib/owncloud/config/config.php
|
||||||
mv /tmp/owncloud-config.php /usr/local/lib/owncloud/config/config.php
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure permissions are correct or the upgrade step won't run.
|
# Make sure permissions are correct or the upgrade step won't run.
|
||||||
# $STORAGE_ROOT/owncloud may not yet exist, so use -f to suppress
|
# $STORAGE_ROOT/owncloud may not yet exist, so use -f to suppress
|
||||||
|
@ -65,17 +72,20 @@ fi
|
||||||
# Setup ownCloud if the ownCloud database does not yet exist. Running setup when
|
# Setup ownCloud if the ownCloud database does not yet exist. Running setup when
|
||||||
# the database does exist wipes the database and user data.
|
# the database does exist wipes the database and user data.
|
||||||
if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then
|
if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then
|
||||||
|
# Create user data directory
|
||||||
|
mkdir -p $STORAGE_ROOT/owncloud
|
||||||
|
|
||||||
# Create a configuration file.
|
# Create a configuration file.
|
||||||
TIMEZONE=$(cat /etc/timezone)
|
TIMEZONE=$(cat /etc/timezone)
|
||||||
instanceid=oc$(echo $PRIMARY_HOSTNAME | sha1sum | fold -w 10 | head -n 1)
|
instanceid=oc$(echo $PRIMARY_HOSTNAME | sha1sum | fold -w 10 | head -n 1)
|
||||||
cat > /usr/local/lib/owncloud/config/config.php <<EOF;
|
cat > $STORAGE_ROOT/owncloud/config.php <<EOF;
|
||||||
<?php
|
<?php
|
||||||
\$CONFIG = array (
|
\$CONFIG = array (
|
||||||
'datadirectory' => '$STORAGE_ROOT/owncloud',
|
'datadirectory' => '$STORAGE_ROOT/owncloud',
|
||||||
|
|
||||||
'instanceid' => '$instanceid',
|
'instanceid' => '$instanceid',
|
||||||
|
|
||||||
'trusted_domains' =>
|
'trusted_domains' =>
|
||||||
array (
|
array (
|
||||||
0 => '$PRIMARY_HOSTNAME',
|
0 => '$PRIMARY_HOSTNAME',
|
||||||
),
|
),
|
||||||
|
@ -125,8 +135,10 @@ EOF
|
||||||
?>
|
?>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Create user data directory and set permissions
|
# Link ownCloud's config
|
||||||
mkdir -p $STORAGE_ROOT/owncloud
|
ln -sf $STORAGE_ROOT/owncloud/config.php /usr/local/lib/owncloud/config/config.php
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/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.
|
# Execute ownCloud's setup step, which creates the ownCloud sqlite database.
|
||||||
|
|
Loading…
Reference in a new issue