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
9e86c675
Commit
9e86c675
authored
Aug 16, 2014
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make setup/owncloud.sh idempotent: don't wreck user data on second run
parent
6e380ade
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
owncloud.sh
setup/owncloud.sh
+19
-13
No files found.
setup/owncloud.sh
View file @
9e86c675
...
...
@@ -22,10 +22,13 @@ if [ ! -d /usr/local/lib/owncloud ]; then
rm
-f
/tmp/owncloud.zip
fi
# 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
<<
EOF
;
# 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
# 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
<<
EOF
;
<?php
\$
CONFIG = array (
'datadirectory' => '
$STORAGE_ROOT
/owncloud',
...
...
@@ -63,9 +66,11 @@ cat - > /usr/local/lib/owncloud/config/config.php <<EOF;
?>
EOF
# Create an auto-configuration file to fill in database settings.
adminpassword
=
$(
dd
if
=
/dev/random
bs
=
40
count
=
1 2>/dev/null |
sha1sum
|
fold
-w
30 |
head
-n
1
)
cat
-
>
/usr/local/lib/owncloud/config/autoconfig.php
<<
EOF
;
# 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.
adminpassword
=
$(
dd
if
=
/dev/random
bs
=
40
count
=
1 2>/dev/null |
sha1sum
|
fold
-w
30 |
head
-n
1
)
cat
-
>
/usr/local/lib/owncloud/config/autoconfig.php
<<
EOF
;
<?php
\$
AUTOCONFIG = array (
# storage/database
...
...
@@ -80,13 +85,14 @@ cat - > /usr/local/lib/owncloud/config/autoconfig.php <<EOF;
?>
EOF
# S
et permissions
mkdir
-p
$STORAGE_ROOT
/owncloud
chown
-R
www-data.www-data
$STORAGE_ROOT
/owncloud /usr/local/lib/owncloud
# Create user data directory and s
et 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
;
)
# 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
;
)
fi
# Enable/disable apps. Note that this must be done after the ownCloud setup.
# The firstrunwizard gave Josh all sorts of problems, so disabling that.
...
...
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