mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-04 15:54:48 +01:00
more readable bash
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
source setup/functions.sh # load our functions
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
# ### Installing ownCloud
|
||||
|
||||
apt_install \
|
||||
dbconfig-common \
|
||||
php5-cli php5-sqlite php5-gd php5-imap php5-curl php-pear php-apc curl libapr1 libtool libcurl4-openssl-dev php-xml-parser \
|
||||
@@ -12,7 +14,7 @@ apt_install \
|
||||
|
||||
apt-get purge -qq -y owncloud*
|
||||
|
||||
# Install ownCloud from source
|
||||
# Install ownCloud from source of this version:
|
||||
owncloud_ver=7.0.2
|
||||
|
||||
# Check if ownCloud dir exist, and check if version matches owncloud_ver (if either doesn't - install/upgrade)
|
||||
@@ -27,13 +29,15 @@ if [ ! -d /usr/local/lib/owncloud/ ] \
|
||||
rm -f /tmp/owncloud.zip
|
||||
fi
|
||||
|
||||
# ### Configuring ownCloud
|
||||
|
||||
# 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`
|
||||
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;
|
||||
cat > /usr/local/lib/owncloud/config/config.php <<EOF;
|
||||
<?php
|
||||
\$CONFIG = array (
|
||||
'datadirectory' => '$STORAGE_ROOT/owncloud',
|
||||
@@ -75,7 +79,7 @@ EOF
|
||||
# when the install script is run. Make an administrator account
|
||||
# here or else the install can't finish.
|
||||
adminpassword=$(dd if=/dev/random bs=1 count=40 2>/dev/null | sha1sum | fold -w 30 | head -n 1)
|
||||
cat - > /usr/local/lib/owncloud/config/autoconfig.php <<EOF;
|
||||
cat > /usr/local/lib/owncloud/config/autoconfig.php <<EOF;
|
||||
<?php
|
||||
\$AUTOCONFIG = array (
|
||||
# storage/database
|
||||
@@ -123,13 +127,15 @@ sudo -u www-data php -f /usr/local/lib/owncloud/cron.php
|
||||
EOF
|
||||
chmod +x /etc/cron.hourly/mailinabox-owncloud
|
||||
|
||||
## Ensure all system admins are ownCloud admins.
|
||||
## Actually we don't do this. There's nothing much of interest that the user could
|
||||
## change from the ownCloud admin, and there's a lot they could mess up.
|
||||
#for user in $(tools/mail.py user admins); do
|
||||
# sqlite3 $STORAGE_ROOT/owncloud/owncloud.db "INSERT OR IGNORE INTO oc_group_user VALUES ('admin', '$user')"
|
||||
#done
|
||||
# There's nothing much of interest that a user could do as an admin for ownCloud,
|
||||
# and there's a lot they could mess up, so we don't make any users admins of ownCloud.
|
||||
# But if we wanted to, we would do this:
|
||||
# ```
|
||||
# for user in $(tools/mail.py user admins); do
|
||||
# sqlite3 $STORAGE_ROOT/owncloud/owncloud.db "INSERT OR IGNORE INTO oc_group_user VALUES ('admin', '$user')"
|
||||
# done
|
||||
# ```
|
||||
|
||||
# Finished.
|
||||
# Enable PHP modules and restart PHP.
|
||||
php5enmod imap
|
||||
restart_service php5-fpm
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
# Webmail: Using roundcube
|
||||
##########################
|
||||
# Webmail with Roundcube
|
||||
# ----------------------
|
||||
|
||||
source setup/functions.sh # load our functions
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
# Ubuntu's roundcube-core has dependencies on Apache & MySQL, which we don't want, so we can't
|
||||
# install roundcube directly via apt-get install.
|
||||
# ### Installing Roundcube
|
||||
|
||||
# We install Roundcube from sources, rather than from Ubuntu, because:
|
||||
#
|
||||
# Additionally, the Roundcube shipped with Ubuntu is consistently out of date.
|
||||
# 1. Ubuntu's `roundcube-core` package has dependencies on Apache & MySQL, which we don't want.
|
||||
#
|
||||
# And it's packaged incorrectly --- it seems to be missing a directory of files.
|
||||
# 2. The Roundcube shipped with Ubuntu is consistently out of date.
|
||||
#
|
||||
# 3. It's packaged incorrectly --- it seems to be missing a directory of files.
|
||||
#
|
||||
# So we'll use apt-get to manually install the dependencies of roundcube that we know we need,
|
||||
# and then we'll manually install roundcube from source.
|
||||
|
||||
# These dependencies are from 'apt-cache showpkg roundcube-core'.
|
||||
# These dependencies are from `apt-cache showpkg roundcube-core`.
|
||||
apt_install \
|
||||
dbconfig-common \
|
||||
php5 php5-sqlite php5-mcrypt php5-intl php5-json php5-common php-auth php-net-smtp php-net-socket php-net-sieve php-mail-mime php-crypt-gpg php5-gd php5-pspell \
|
||||
@@ -35,6 +38,8 @@ if [ ! -d /usr/local/lib/roundcubemail ]; then
|
||||
rm -f /tmp/roundcube.tgz
|
||||
fi
|
||||
|
||||
# ### Configuring Roundcube
|
||||
|
||||
# Generate a safe 24-character secret key of safe characters.
|
||||
SECRET_KEY=$(dd if=/dev/random bs=1 count=18 2>/dev/null | base64 | fold -w 24 | head -n 1)
|
||||
|
||||
@@ -43,7 +48,7 @@ SECRET_KEY=$(dd if=/dev/random bs=1 count=18 2>/dev/null | base64 | fold -w 24 |
|
||||
# For security, temp and log files are not stored in the default locations
|
||||
# which are inside the roundcube sources directory. We put them instead
|
||||
# in normal places.
|
||||
cat - > /usr/local/lib/roundcubemail/config/config.inc.php <<EOF;
|
||||
cat > /usr/local/lib/roundcubemail/config/config.inc.php <<EOF;
|
||||
<?php
|
||||
/*
|
||||
* Do not edit. Written by Mail-in-a-Box. Regenerated on updates.
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Z-Push: The Microsoft Exchange protocol server.
|
||||
# Z-Push: The Microsoft Exchange protocol server
|
||||
# ----------------------------------------------
|
||||
#
|
||||
# Mostly for use on iOS which doesn't support IMAP.
|
||||
#
|
||||
# Although Ubuntu ships Z-Push (as d-push) it has a dependency on Apache
|
||||
@@ -19,12 +21,12 @@ apt_install \
|
||||
php5enmod imap
|
||||
|
||||
# Copy Z-Push into place.
|
||||
needs_update=0
|
||||
needs_update=0 #NODOC
|
||||
if [ ! -f /usr/local/lib/z-push/version ]; then
|
||||
needs_update=1
|
||||
needs_update=1 #NODOC
|
||||
elif [[ `curl -s https://api.github.com/repos/fmbiete/Z-Push-contrib/git/refs/heads/master` != `cat /usr/local/lib/z-push/version` ]]; then
|
||||
# checks if the version
|
||||
needs_update=1
|
||||
needs_update=1 #NODOC
|
||||
fi
|
||||
if [ $needs_update == 1 ]; then
|
||||
rm -rf /usr/local/lib/z-push
|
||||
|
||||
Reference in New Issue
Block a user