Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
0cbba71c
Commit
0cbba71c
authored
Jun 14, 2015
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Plain Diff
merge #429 - Move OwnCloud's config to Storage Root
parents
0754ce01
d28563fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
owncloud.sh
setup/owncloud.sh
+23
-11
No files found.
setup/owncloud.sh
View file @
0cbba71c
...
@@ -18,17 +18,27 @@ apt-get purge -qq -y owncloud*
...
@@ -18,17 +18,27 @@ apt-get purge -qq -y owncloud*
owncloud_ver
=
8.0.3
owncloud_ver
=
8.0.3
owncloud_hash
=
3192f3d783f81247eaf2914df63afdd593def4e5
owncloud_hash
=
3192f3d783f81247eaf2914df63afdd593def4e5
# Migrate <= v0.10 setups that stored the ownCloud config.php in /usr/local rather than
# in STORAGE_ROOT. Move the file to STORAGE_ROOT.
if
[
!
-f
$STORAGE_ROOT
/owncloud/config.php
]
\
&&
[
-f
/usr/local/lib/owncloud/config/config.php
]
;
then
# Move config.php and symlink back into previous location.
echo
"Migrating owncloud/config.php to new location."
mv
/usr/local/lib/owncloud/config/config.php
$STORAGE_ROOT
/owncloud/config.php
\
&&
\
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 +56,9 @@ if [ ! -d /usr/local/lib/owncloud/ ] \
...
@@ -46,10 +56,9 @@ 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.
# Create a symlink to the config.php in STORAGE_ROOT (for upgrades we're restoring the symlink we previously
if
[
-f
/tmp/owncloud-config.php
]
;
then
# put in, and in new installs we're creating a symlink and will create the actual config later).
mv
/tmp/owncloud-config.php /usr/local/lib/owncloud/config/config.php
ln
-sf
$STORAGE_ROOT
/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,10 +74,13 @@ fi
...
@@ -65,10 +74,13 @@ 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',
...
@@ -125,12 +137,12 @@ EOF
...
@@ -125,12 +137,12 @@ EOF
?>
?>
EOF
EOF
# Create user data directory and set permissions
# Set permissions
mkdir
-p
$STORAGE_ROOT
/owncloud
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.
# It also wipes it if it exists. And it deletes the autoconfig.php file.
# It also wipes it if it exists. And it updates config.php with database
# settings and deletes the autoconfig.php file.
(
cd
/usr/local/lib/owncloud
;
sudo
-u
www-data php /usr/local/lib/owncloud/index.php
;
)
(
cd
/usr/local/lib/owncloud
;
sudo
-u
www-data php /usr/local/lib/owncloud/index.php
;
)
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment