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
Hide 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
...
@@ -22,10 +22,13 @@ if [ ! -d /usr/local/lib/owncloud ]; then
rm
-f
/tmp/owncloud.zip
rm
-f
/tmp/owncloud.zip
fi
fi
# Create a configuration file.
# Setup ownCloud if the ownCloud database does not yet exist. Running setup when
TIMEZONE
=
`
cat
/etc/timezone
`
# the database does exist wipes the database and user data.
instanceid
=
oc
$(
echo
$PRIMARY_HOSTNAME
|
sha1sum
|
fold
-w
10 |
head
-n
1
)
if
[
!
-f
$STORAGE_ROOT
/owncloud/owncloud.db
]
;
then
cat
-
>
/usr/local/lib/owncloud/config/config.php
<<
EOF
;
# 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
<?php
\$
CONFIG = array (
\$
CONFIG = array (
'datadirectory' => '
$STORAGE_ROOT
/owncloud',
'datadirectory' => '
$STORAGE_ROOT
/owncloud',
...
@@ -63,9 +66,11 @@ cat - > /usr/local/lib/owncloud/config/config.php <<EOF;
...
@@ -63,9 +66,11 @@ cat - > /usr/local/lib/owncloud/config/config.php <<EOF;
?>
?>
EOF
EOF
# Create an auto-configuration file to fill in database settings.
# 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
)
# when the install script is run. Make an administrator account
cat
-
>
/usr/local/lib/owncloud/config/autoconfig.php
<<
EOF
;
# 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
<?php
\$
AUTOCONFIG = array (
\$
AUTOCONFIG = array (
# storage/database
# storage/database
...
@@ -80,13 +85,14 @@ cat - > /usr/local/lib/owncloud/config/autoconfig.php <<EOF;
...
@@ -80,13 +85,14 @@ cat - > /usr/local/lib/owncloud/config/autoconfig.php <<EOF;
?>
?>
EOF
EOF
# S
et permissions
# Create user data directory and s
et permissions
mkdir
-p
$STORAGE_ROOT
/owncloud
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 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
# Enable/disable apps. Note that this must be done after the ownCloud setup.
# Enable/disable apps. Note that this must be done after the ownCloud setup.
# The firstrunwizard gave Josh all sorts of problems, so disabling that.
# 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