Commit 7c83f68b authored by w4t's avatar w4t

wtserver 0.26

parent 4db1d3b4
......@@ -5,7 +5,7 @@
InstallLetsEncrypt() {
local START_TIME=$SECONDS
echo -n -e "$IDENTATION_LVL_1 ${BWhite}Installing LetsEncrypt Certbot${NC}\n"
echo -n -e "$IDENTATION_LVL_1 Installing LetsEncrypt Certbot\n"
if [ $CFG_CERTBOT_VERSION == "Certbot" ]; then
if [ $CFG_WEBSERVER == "apache" ]; then
......
......@@ -80,12 +80,22 @@ InstallMTA() {
# Set the location where we'll store user mailboxes. '%d' is the domain name and '%n' is the
# username part of the user's email address. We'll ensure that no bad domains or email addresses
# are created within the management daemon.
#mail_location = mbox:~/mail:INBOX=/var/mail/%u
#mail_privileged_group = mail
#first_valid_uid = 500
#sed -i -E \
#-e "s/^mail_location\s*=\s*.*/mail_location = maildir:$STORAGE_ROOT\/mail\/mailboxes\/%d\/%n/" \
#-e "s/^mail_privileged_group\s*=\s*.*/mail_privileged_group = mail/" \
#-e "s/^#first_valid_uid\s*=\s*.*/first_valid_uid = 0/" \
#/etc/dovecot/conf.d/10-mail.conf
sed -E \
-e "s|^mail_location[[:space:]]*=[[:space:]]*.*|mail_location = maildir:$STORAGE_ROOT/mail/mailboxes/%d/%n|" \
-e "s|^mail_privileged_group[[:space:]]*=[[:space:]]*.*|mail_privileged_group = mail|" \
-e "s|^#first_valid_uid[[:space:]]*=[[:space:]]*.*|first_valid_uid = 0|" \
/etc/dovecot/conf.d/10-mail.conf
# Create, subscribe, and mark as special folders: INBOX, Drafts, Sent, Trash, Spam and Archive.
cp $APWD/conf/dovecot-mailboxes.conf /etc/dovecot/conf.d/15-mailboxes.conf
sed -i "s/#mail_plugins =\(.*\)/mail_plugins =\1 \$mail_plugins quota/" /etc/dovecot/conf.d/10-mail.conf
......@@ -128,6 +138,7 @@ EOF
# Enable SSL, specify the location of the SSL certificate and private key files.
# Use Mozilla's "Intermediate" recommendations at https://ssl-config.mozilla.org/#server=dovecot&server-version=2.3.7.2&config=intermediate&openssl-version=1.1.1,
# except that the current version of Dovecot does not have a TLSv1.3 setting, so we only use TLSv1.2.
#openssl dhparam -out $STORAGE_ROOT/ssl/dh4096.pem 4096
sed -i -E \
-e "s/^ssl\s*=\s*.*/ssl = required/" \
-e "s|^ssl_cert\s*=\s*<.*|ssl_cert = <$STORAGE_ROOT/ssl/ssl_certificate.pem|" \
......
......@@ -56,6 +56,73 @@ InstallNextcloud() {
echo -n -e "$IDENTATION_LVL_0 ${BWhite}Installing Nextcloud${NC}"
echo -n -e "$IDENTATION_LVL_1 Installing required packages... "
# Install required PHP packages
apt_install php8.2 php8.2-fpm php8.2-cli php8.2-sqlite php8.2-gd php8.2-imap php8.2-curl php-pear curl \
php8.2-dev memcached php-memcached php8.2-xml php8.2-mbstring php8.2-zip php8.2-apcu \
php8.2-fpm php8.2-mysql php8.2-xsl php8.2-gmp php8.2-bcmath php8.2-cgi php-gettext libxml2-dev \
php8.2-json php8.2-intl php8.2-imagick php8.2-common php8.2-opcache php8.2-readline php8.2
# Enable APC before Nextcloud tools are run
sed -i '1i apc.enabled=1\napc.enable_cli=1' /etc/php/8.2/mods-available/apcu.ini
# Get current Nextcloud version if config.php exists
if [ -f "$CLOUD_DIR/config.php" ]; then
CURRENT_NEXTCLOUD_VER=$(php8.2 -r "include(\"$CLOUD_DIR/config.php\"); echo(\$CONFIG['version']);")
else
CURRENT_NEXTCLOUD_VER=""
fi
# Install or upgrade Nextcloud if necessary
if [ ! -d $CLOUD_DIR ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextcloud_ver ]]; then
# Stop php-fpm if running. If theyre not running (which happens on a previously failed install), dont bail
systemctl restart php8.2-fpm stop &> /dev/null || /bin/true
# Backup existing Nextcloud installation
# Create a backup directory to store the current installation and database to
BACKUP_DIRECTORY=$CLOUD_DIR-backup/`date +"%Y-%m-%d-%T"`
mkdir -p "$BACKUP_DIRECTORY"
if [ -d $CLOUD_DIR/ ]; then
echo "Upgrading Nextcloud --- backing up existing installation, configuration, and database to $BACKUP_DIRECTORY..."
cp -r $CLOUD_DIR "$BACKUP_DIRECTORY/nextcloud-install"
fi
if [ -e "$STORAGE_ROOT/nextcloud/nextcloud.db" ]; then
cp "$STORAGE_ROOT/nextcloud/owncloud.db" "$BACKUP_DIRECTORY"
fi
if [ -e "$STORAGE_ROOT/nextcloud/config.php" ]; then
cp "$STORAGE_ROOT/nextcloud/config.php" "$BACKUP_DIRECTORY"
fi
# Perform version-specific upgrades
if [ -n "${CURRENT_NEXTCLOUD_VER}" ]; then
if [ -e "$CLOUD_DIR/config.php" ]; then
# Remove the read-onlyness of the config, which is needed for migrations, especially for v24
sed -i -e '/config_is_read_only/d' "$CLOUD_DIR/config.php"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^27 ]]; then
InstallNextcloudVer 28.0.14 8a9edcfd26d318eb7d1cfa44d69796f2d1098a80
CURRENT_NEXTCLOUD_VER="28.0.14"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^28 ]]; then
InstallNextcloudVer 29.0.12 6cd53db7a8d730ebd5972081344db41eb2b174a8
CURRENT_NEXTCLOUD_VER="29.0.12"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^29 ]]; then
InstallNextcloudVer 30.0.6 c7171b03f9904a2051e765fe09ab3e95e2e564e6
CURRENT_NEXTCLOUD_VER="30.0.6"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^30 ]]; then
InstallNextcloudVer 31.0.0 545584d128e3242337548ac2cdf31e6019b738f4
CURRENT_NEXTCLOUD_VER="31.0.0"
fi
fi
else
InstallNextcloudVer $owncloud_ver $owncloud_hash
fi
}
#---------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment