Version to install must be given on the command line.

This commit is contained in:
Christoph 2017-10-12 03:43:34 +02:00
parent 52ffac83fe
commit ace5fa37bd
2 changed files with 376 additions and 12 deletions

View File

@ -0,0 +1,350 @@
# ----------------------------------------------------
# - Configuration for roundcube install/upgrade script
# ----------------------------------------------------
# - Name of the website - usualy 'webmail.<domain>.<tld>'
# -
WEBSITE_NAME=""
# - IPv4 Address
# -
IPV4=""
# - IPv6 Address
# -
IPV6=""
# - Is apache installed from debian package system ?
# -
# - Boolean, possible values are 'true', 'false'
# -
# - Defaults to 'false'
#
#APACHE_DEBIAN_INSTALLATION=""
# - Apache User
# -
# - If ommitted, script tries to determine the user under which user the webserver
# - is running. If that fails, parameter defaults to 'www-data'
# -
#HTTP_USER=""
# - Apache Group
# -
# - If ommitted, script tries to determine the user under which group the webserver
# - is running. If that fails, parameter defaults to 'www-data'
# -
#HTTP_GROUP=""
# - Webmasters E-Mail Address
# -
# - Defaults to 'admin@<domain>.<tld>'
# -
#WEBMASTER_EMAIL=""
# - Base Directory of Roundcube Website
# -
# - Note: it's not the 'DocumentRoot' directory, but the directory where
# - the 'DocumentRoot' Directory lives.
# -
# - Defaults to '/var/www/webmail/$WEBSITE_NAME'
# -
#WEBSITE_BASEDIR=""
# - Directory for storing temporary files
# -
# - Defaults to '${WEBMAIL_BASEDIR}/temp"
# -
#ROUNDCUBE_TMPDIR=""
# - Directory, where apache places the log-files for thw webmailers site.
# -
# - Defaults to '/var/log/apache2'
# -
#APACHE_LOG_DIR=""
# - Directory where certificate and key for the roundcube website
# - are stored.
# -
# - Example:
# - APACHE_CERT_DIR="/var/lib/dehydrated/certs/$WEBSITE_NAME"
# -
# - Defaults to
# - '/etc/apache2' if apache is installed from debian package system
# - '/usr/local/apache2/conf' otherwise
# -
#APACHE_CERT_DIR=""
# - Certificate for the Rounfcube Website
# -
# - Example:
# - APACHE_SERVER_CERT="fullchain.pem"
# -
# - Defaults to 'server-bundle.crt'
# -
#APACHE_SERVER_CERT=""
# - Key File for the Rounfcube Website
# -
# - Example:
# - APACHE_SERVER_KEY="privkey.pem"
# -
# - Defaults to 'server.key'
# -
#APACHE_SERVER_KEY=""
# - Certification Chain File
# -
# - Deprecated since Apache 2.4 - Leave empty if not present
# -
#CERT_ChainFile=""
# - Type of PHP installation.
# -
# - Possible values are: 'php_fpm' , 'fcgid' , 'mod_php
# -
# - defaults to 'php_fpm''
# -
#PHP_TYPE=""
# - Directory where apache vhosts definitions live.
# -
# - Defaults to
# - '/etc/apache2/sites-available' if installed from debain package system
# - '/usr/local/apache2/conf/vhosts' otherwise
# -
#APACHE_VHOST_DIR=""
# - Hostname for vacation / absence messages
# -
# - Defaults to 'autoreply.<domain>.<tld>
# -
#AUTOREPLY_HOSTNAME=""
# - Database type for Roundcube
# -
# - Possible values are 'pgsql' (PostgeSQL) or 'mysql' (MySQL)
# -
DB_TYPE=""
# - Host of Roundcube Database
# -
# - Defaults to 'localhost'
# -
#DB_HOST=""
# - Name of Roundcube Database
# -
# - Defaults to 'roundcubemail'
# -
#DB_NAME=
# - User of Roundcube Database
# -
# - Defaults to 'roundcube'
# -
#DB_USER=""
# - Password of Roundcube Database
# -
DB_PASS=""
# - Is MySQL installed from debian package system?
# -
# - Only needed, if DB_TYPE is set to 'mysql'
# -
# - Defaults to 'false'
# -
#MYSQL_DEBIAN_INSTALLATION=""
# - mysql_credential_args (root access to MySQL Database)
# -
# - Example
# - mysql_credential_args="--login-path=local"
# - mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf" (Debian default)
# - mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
# -
# - Defaults to:
# - '/etc/mysql/debian.cnf' if MySQL is installed from debian package system
# - '/usr/local/mysql/sys-maint.cnf' otherwise
# -
#MYSQL_CREDENTIALS=""
# - Name of the folder where (assumed) junk mails will be stored
# -
# - Defaults to 'Spam'
# -
#SPAM_FOLDER_NAME=""
# - You can set your own product name to replace the default.
# -
# - Defaults to 'Roundcube Webmail'
# -
#PRODUCT_NAME=""
# - URL for users, to get in contact if something goes wrong
# -
# - Defaults to 'www.<domain>.<tld>'
# -
#SUPPORT_URL=""
# - Provide your own logo under this URI
# -
# - Note: this script will NOT place the logo. You have to do this by your own
# - after installation is finisched.
# -
# - Default is empty
# -
#SKIN_LOGO=""
# --------------------
# - Plugins Configuration
# --------------------
# ==========
# - Settings Postfix Database
# ==========
# - Type of Postfix database
# -
# - used for setting $config['password_db_dsn']
# -
# - Possible values are 'pgsql' (PostgeSQL) or 'mysql' (MySQL)
# -
POSTFIX_DB_TYPE="pgsql"
# - Host of Postfix Database
# -
# - used for setting $config['password_db_dsn']
# -
# - Defaults to 'localhost'
# -
#POSTFIX_DB_HOST=""
# - Name of Postfix Database
# -
# - used for setting $config['password_db_dsn']
# -
# - Defaults to 'postfix'
# -
#POSTFIX_DB_NAME=
# - User of Postfix Database
# -
# - used for setting $config['password_db_dsn']
# -
# - Defaults to 'postfix'
# -
#POSTFIX_DB_USER=""
# - Password of Postfix Database
# -
# - used for setting $config['password_db_dsn']
# -
POSTFIX_DB_PASSWD=''
# ===
# - Plugin acl
# ===
# - Activate plugin 'acl'?
# -
# - Boolean - possible values are 'true' and 'false'
# -
# - Defaults to 'false'
# -
#INCLUDE_ACL_PLUGIN=""
# ===
# - Plugin password (change password)
# ===
# - Is current password reqired
# -
# - $config['password_confirm_current']
# -
# - Boolean - possible values are 'true' and 'false'
# -
# - Defaults to 'true'
# -
#PW_CONFIRM_CURRENT=""
# - Minimun length if new password
# -
# - $config['password_minimum_length']
# -
# - Defaults to '10'
# -
#PW_MIN_LENGTH=""
# - New Password requires nonalpha character
# -
# - $config['password_require_nonalpha']
# -
# - Boolean - possible values are 'true' and 'false'
# -
# - Defaults to 'true'
# -
#PW_REQUIRE_NONALPHA=''
# - Default password hashing/crypting algorithm.
# -
# - $config['password_algorithm']
# -
# - Possible values: des-crypt, ext-des-crypt, md5-crypt, blowfish-crypt,
# - sha256-crypt, sha512-crypt, md5, sha, smd5, ssha, samba,
# - ad, dovecot, clear.
# -
# - Defaults to 'dovecot'
# -
#PW_PASSWD_ALGO=''
# - Password prefix (e.g. {CRYPT}, {SHA}, {CRAM-MD5}) for passwords generated
# -
# - $config['password_algorithm_prefix']
# -
# - Defaults to '{CRAM-MD5}'
# -
#PW_PASSWD_ALGO_PREFIX=''
# - Path for dovecotpw/doveadm-pw
# -
# - $config['password_dovecotpw']
# -
# - Defaults to '/usr/local/dovecot/bin/doveadm pw'
# -
#PW_DOVEADM_PW=''
# - Dovecot password scheme.
# -
# - $config['password_dovecotpw_method']
# -
# - Defaults to 'CRAM-MD5
# -
#PW_DOVECOT_PW_METHOD=
# - The SQL query used to change the password.
# -
# - $config['password_query']
# -
PW_DB_UPDATE_STRING='UPDATE mailbox SET password=%P WHERE username=%u'
# ==========
# - Plugin password vacation
# ==========
# - allow vacation forwarder
# -
# - $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
# -
# - defaults to 'false'
# -
#VAC_GUI_FORWARDER=false

View File

@ -3,14 +3,10 @@
clear
echo -e "\n\t\033[32mStart script for installation Roundcube Webmailer..\033[m"
## ===================================================================
## - Install Postfixadmin
## ===================================================================
## -----------------------------------------------------------------
## ----------------------------------------------------------------
## ---
## --- For configurations see file conf/install_roundcube.conf
## --- For configurations see file conf/install_upgrade_roundcube.conf
## ---
## --- Dont make changes here!
## ---
@ -24,7 +20,7 @@ echo -e "\n\t\033[32mStart script for installation Roundcube Webmailer..\033[m"
_src_base_dir="$(realpath $(dirname $0))"
#_src_base_dir=/usr/local/src/postfixadmin
conf_file="${_src_base_dir}/conf/install_roundcube.conf"
conf_file="${_src_base_dir}/conf/install_upgrade_roundcube.conf"
curdir=`pwd`
log_file="$(mktemp)"
@ -107,6 +103,24 @@ else
echo_ok
fi
echo -e "\033[32m--\033[m"
echo ""
echo "Version of the Roundcube Webmailer to install"
echo ""
echo ""
ROUNDCUBE_VERSION=
while [ "X$ROUNDCUBE_VERSION" = "X" ]
do
echononl "Roundcube Version: "
read ROUNDCUBE_VERSION
if [ "X$ROUNDCUBE_VERSION" = "X" ]; then
echo -e "\n\t\033[33m\033[1mA version number is required!\033[m\n"
fi
done
echo ""
echo -e "\033[32m--\033[m"
echo ""
# - Default values
# -
@ -278,18 +292,18 @@ fi
# - Determin PHP of all installed versions
# -
echononl "\tGet major numbers of all installed PHP versions"
echononl "\tGet major version of all installed PHP versions"
php_major_versions=`find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort`
if [[ -z "$php_major_versions" ]]; then
echo_failed
error "Getting major numbers of installed PHP versions failed! No installed PHP versiond found!"
error "Getting major version of installed PHP versions failed! No installed PHP versiond found!"
else
echo_ok
fi
# - Get the latest PHP version
# -
echononl "\tGet major number of latest installed PHP version"
echononl "\tGet major version of latest installed PHP version"
php_latest_ver=""
if [[ -n "$php_major_versions" ]]; then
for _ver in $php_major_versions ; do
@ -304,7 +318,7 @@ if [[ -n "$php_major_versions" ]]; then
echo_ok
else
echo_skipped
warn "Getting major number of latest installed PHP version failed! - No installed PHP versiond found!"
warn "Getting major version of latest installed PHP version failed! - No installed PHP versiond found!"
fi
echo ""
@ -1441,7 +1455,7 @@ echo -e "\n\n\t\033[37m\033[1mSetup Database '$DB_TYPE'..\033[m\n"
if [[ "$DB_TYPE" = "mysql" ]]; then
if ! mysql $MYSQL_CREDENTIALS -N -s -e \
"SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$DB_NAME'" 2>> $log_file \
| grep $POSTFIX_DB_NAME >> $log_file 2>&1 ; then
| grep $DB_NAME >> $log_file 2>&1 ; then
database_exists=false
else
database_exists=true
@ -1515,7 +1529,7 @@ if $database_exists ; then
fi
elif [[ "$DB_TYPE" = "pgsql" ]]; then
echo -n " (PostgreSQL).."
su - postgres -c "pg_dump $DB_NAME" > ${WEBSITE_BASEDIR}/${DB_NAME}.$backup_date.sql 2> $log_file
su - postgres -c "pg_dump -c $DB_NAME" > ${WEBSITE_BASEDIR}/${DB_NAME}.$backup_date.sql 2> $log_file
if [[ $? -eq 0 ]]; then
echo_ok
else