Browse Source

Package mail-server

Ernesto Nicolás Carrea 5 years ago
parent
commit
7d70587098
2 changed files with 46 additions and 0 deletions
  1. 36 0
      bin/package/install/mail-server.inc
  2. 10 0
      bin/package/remove/mail-server.inc

+ 36 - 0
bin/package/install/mail-server.inc

@@ -0,0 +1,36 @@
+#!/bin/bash
+
+hestia_package_install_mail-server() {
+    memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
+
+    if [ "$param_help" ]; then
+        usage
+        exit 0
+    fi
+
+    echo "Installing mail server package..."
+
+    $BIN/hestia module install exim
+    $BIN/hestia module install dovecot
+    if [ $memory -ge 1572864 ] || [ "$param_withantivirus" ]; then
+        if [ ! "$param_withoutantivirus" ]; then
+            $BIN/hestia module install clamav
+        fi
+    fi
+
+    if [ $memory -ge 1572864 ] || [ "$param_withantispam" ]; then
+        if [ ! "$param_withoutantispam" ]; then
+            $BIN/hestia module install spamassassin
+        fi
+    fi
+}
+
+usage() {
+    echo "Hestia mail server package."
+    echo "Usage:"
+    echo "  hestia package install mail-server \\"
+    echo "    [--withantivirus|--withoutantivirus] [--withantispam|--withoutantispam]"
+    echo ""
+    echo "Antivirus and antispam packages will install on systems"
+    echo "with at least 1.5 GB of RAM, unless otherwise specified."
+}

+ 10 - 0
bin/package/remove/mail-server.inc

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+hestia_package_remove() {
+    echo "Installing mail server package..."
+
+    $BIN/hestia module remove exim
+    $BIN/hestia module remove dovecot
+    $BIN/hestia module remove clamav
+    $BIN/hestia module remove spamassassin
+}