Browse Source

Don't fail on already installed/removed

Ernesto Nicolás Carrea 5 years ago
parent
commit
c18a57bcb5

+ 1 - 1
bin/module/apache/install.inc

@@ -5,7 +5,7 @@ hestia_module_apache_install() {
 
     if hestia_module_isinstalled 'apache' && [ ! "$param_force" ]; then
         echo "Apache module is already installed. See 'hestia module info apache'."
-        return 1
+        return 0
     fi
 
     echo "Installing Apache module..."

+ 1 - 1
bin/module/apache/remove.inc

@@ -5,7 +5,7 @@ hestia_module_apache_remove() {
 
     if ! hestia_module_isinstalled 'apache' && [ ! "$param_force" ]; then
         echo "Apache module is not installed. See 'hestia module info apache'."
-        return 1
+        return 0
     fi
 
     echo "Removing Apache module..."

+ 1 - 1
bin/module/api/install.inc

@@ -5,7 +5,7 @@ hestia_module_api_install() {
 
     if hestia_module_isinstalled 'api' && [ ! "$param_force" ]; then
         echo "API module is already installed. See 'hestia module info api'."
-        return 1
+        return 0
     fi
 
     echo "Installing API module..."

+ 1 - 1
bin/module/api/remove.inc

@@ -5,7 +5,7 @@ hestia_module_api_remove() {
 
     if ! hestia_module_isinstalled 'api' && [ ! "$param_force" ]; then
         echo "API module is not installed. See 'hestia module info api'."
-        return 1
+        return 0
     fi
 
     echo "Removing API module..."

+ 1 - 1
bin/module/awstats/install.inc

@@ -5,7 +5,7 @@ hestia_module_awstats_install() {
 
     if hestia_module_isinstalled 'webstats' && [ ! "$param_force" ]; then
         echo "Stats module is already installed. See 'hestia module info webstats'."
-        return 1
+        return 0
     fi
 
     echo "Installing web stats (AWStats) module..."

+ 1 - 1
bin/module/awstats/remove.inc

@@ -5,7 +5,7 @@ hestia_module_awstats_remove() {
 
     if ! hestia_module_isinstalled 'webstats' && [ ! "$param_force" ]; then
         echo "Web stats module is not installed. See 'hestia module info webstats'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant 'webstats')

+ 1 - 1
bin/module/clamav/install.inc

@@ -5,7 +5,7 @@ hestia_module_clamav_install() {
 
     if hestia_module_isinstalled 'antivirus' && [ ! "$param_force" ]; then
         echo "Antivirus module is already installed. See 'hestia module info antivirus'."
-        return 1
+        return 0
     fi
 
     echo "Installing antivirus (ClamAV) module..."

+ 1 - 1
bin/module/clamav/remove.inc

@@ -5,7 +5,7 @@ hestia_module_clamav_remove() {
 
     if ! hestia_module_isinstalled 'antivirus' && [ ! "$param_force" ]; then
         echo "antivirus module is not installed. See 'hestia module info antivirus'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant antivirus)

+ 1 - 1
bin/module/dovecot/install.inc

@@ -5,7 +5,7 @@ hestia_module_dovecot_install() {
 
     if hestia_module_isinstalled 'imap' && [ ! "$param_force" ]; then
         echo "IMAP module is already installed. See 'hestia module info imap'."
-        return 1
+        return 0
     fi
 
     echo "Installing IMAP (Dovecot) module..."

+ 1 - 1
bin/module/dovecot/remove.inc

@@ -5,7 +5,7 @@ hestia_module_dovecot_remove() {
 
     if ! hestia_module_isinstalled 'imap' && [ ! "$param_force" ]; then
         echo "IMAP module is not installed. See 'hestia module info imap'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant imap)

+ 1 - 1
bin/module/exim/install.inc

@@ -5,7 +5,7 @@ hestia_module_exim_install() {
 
     if hestia_module_isinstalled 'mta' && [ ! "$param_force" ]; then
         echo "MTA module is already installed. See 'hestia module info mta'."
-        return 1
+        return 0
     fi
 
     echo "Installing MTA (Exim) module..."

+ 1 - 1
bin/module/exim/remove.inc

@@ -5,7 +5,7 @@ hestia_module_exim_remove() {
 
     if ! hestia_module_isinstalled 'mta' && [ ! "$param_force" ]; then
         echo "MTA module is not installed. See 'hestia module info mta'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant mta)

+ 1 - 1
bin/module/install.inc

@@ -12,7 +12,7 @@ hestia_module_install() {
             echo "Module '${mod_provider}' selected as provider of '${mod_name}'"
         fi
 
-        local hmd="$HESTIA/data/modules/${mod_provider}.hmd"
+        local hmd="$HESTIA_INSTALL_DIR/../modules/${mod_provider}.hmd"
 
         local mod_conflicts=$(osal_kv_read $hmd 'conflicts')
         if [ "$mod_conflicts" ] && ! hestia_module_install_check_conflicts "$mod_provider" "$mod_conflicts"; then

+ 7 - 0
bin/module/mariadb/help.inc

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+hestia_module_mariadb_help() {
+    echo "Usage:"
+    echo "  hestia module mariadb reset-password"
+    echo ""
+}

+ 1 - 1
bin/module/mariadb/install.inc

@@ -5,7 +5,7 @@ hestia_module_mariadb_install() {
 
     if hestia_module_isinstalled 'mydb' && [ ! "$param_force" ]; then
         echo "MySQL/MariaDB database module is already installed. See 'hestia module info mydb'."
-        return 1
+        return 0
     fi
 
     echo "Installing database (MariaDB) module..."

+ 5 - 0
bin/module/mariadb/integrate.inc

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+hestia_module_mariadb_integrate() {
+    return 0
+}

+ 1 - 1
bin/module/mariadb/remove.inc

@@ -5,7 +5,7 @@ hestia_module_mariadb_remove() {
 
     if ! hestia_module_isinstalled 'mydb' && [ ! "$param_force" ]; then
         echo "MySQL/MariaDB database module is not installed. See 'hestia module info mydb'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant mydb)

+ 1 - 1
bin/module/nginx/install.inc

@@ -5,7 +5,7 @@ hestia_module_nginx_install() {
 
     if hestia_module_isinstalled 'nginx' && [ ! "$param_force" ]; then
         echo "Nginx module is already installed. See 'hestia module info nginx'."
-        return 1
+        return 0
     fi
 
     echo "Installing Nginx module..."

+ 1 - 1
bin/module/nginx/remove.inc

@@ -5,7 +5,7 @@ hestia_module_nginx_remove() {
 
     if ! hestia_module_isinstalled 'nginx' && [ ! "$param_force" ]; then
         echo "Nginx module is not installed. See 'hestia module info nginx'."
-        return 1
+        return 0
     fi
 
     echo "Removing Nginx module..."

+ 1 - 1
bin/module/php-fpm/add.inc

@@ -41,7 +41,7 @@ hestia_module_php-fpm_add() {
 
     if [ "$php_version_present" ] && [ ! "$param_force" ]; then
         echo "PHP version ${php_version} is already present. See 'hestia module php-fpm list'."
-        return 1
+        return 0
     fi
 
     # Check if php version is supported

+ 1 - 1
bin/module/php-fpm/del.inc

@@ -41,7 +41,7 @@ hestia_module_php-fpm_del() {
     php_version_present=$(osal_kv_read_bool $HESTIA_CONF_MODULES/php-fpm.conf "php${php_withoutdot}_present" && echo 1)
     if [ ! "$php_version_present" ] && [ ! "$param_force" ]; then
         echo "PHP (FPM) version ${php_version} is not present. See 'hestia module php-fpm list'."
-        return 1
+        return 0
     fi
 
     # Perform verification if read-only mode is enabled

+ 1 - 1
bin/module/php-fpm/install.inc

@@ -6,7 +6,7 @@ hestia_module_php-fpm_install() {
 
     if hestia_module_isinstalled 'php-fpm' && [ ! "$param_force" ]; then
         echo "PHP (FPM) module is already installed. See 'hestia module info php-fpm'."
-        return 1
+        return 0
     fi
 
     echo "Installing PHP (FPM) module..."

+ 1 - 1
bin/module/php-fpm/remove.inc

@@ -6,7 +6,7 @@ hestia_module_php-fpm_remove() {
 
     if ! hestia_module_isinstalled 'php-fpm' && [ ! "$param_force" ]; then
         echo "PHP (FPM) module is not installed. See 'hestia module info php-fpm'."
-        return 1
+        return 0
     fi
 
     echo "Removing PHP (FPM) module..."

+ 7 - 1
bin/module/phpmyadmin/install.inc

@@ -3,12 +3,18 @@
 hestia_module_phpmyadmin_install() {
     source $HESTIA/bin/module/func.inc
 
+    if hestia_module_isinstalled 'phpmyadmin' && [ ! "$param_force" ]; then
+        echo "phpMyAdmin module is already installed. See 'hestia module info phpmyadmin'."
+        return 0
+    fi
+
     if hestia_module_isinstalled 'phpmyadmin' && [ ! "$param_force" ]; then
         echo "phpMyAdmin module is already installed. See 'hestia module info phpmyadmin'."
         return 1
     fi
 
-    local pma_version='5.0.2'
+    local hmd="$HESTIA_INSTALL_DIR/../modules/phpmyadmin.hmd"
+    local pma_version=$(osal_kv_read $hmd 'version')
     echo "Installing phpMyAdmin module..."
     
     hestia_config_backup 'phpmyadmin-remove' $OSAL_PATH_NGINX_CONF_D/phpmyadmin.inc \

+ 1 - 15
bin/module/phpmyadmin/integrate.inc

@@ -1,19 +1,5 @@
 #!/bin/bash
 
 hestia_module_phpmyadmin_integrate() {
-    source $HESTIA/bin/module/func.inc
-    
-    # FIXME: use Nginx-web config when using Nginx proxy (ignore apache in that case)
-    if [ "$WEB_SYSTEM" = 'nginx' ]; then
-        # Setup Nginx config
-        cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc $OSAL_PATH_NGINX_CONF_D/
-        # Remove apache support        
-        hestia_safe_rm $OSAL_PATH_APACHE_CONF_D/phpmyadmin.conf
-    elif [ "$WEB_SYSTEM" = 'apache2' ] || [ "$WEB_SYSTEM" = 'httpd' ]; then
-        # Setup Apache config
-        cp -f $HESTIA_INSTALL_DIR/pma/apache.conf /etc/phpmyadmin/
-        ln -sf /etc/phpmyadmin/apache.conf $OSAL_PATH_APACHE_CONF_D/phpmyadmin.conf
-        # Remove Nginx support
-        hestia_safe_rm $OSAL_PATH_NGINX_CONF_D/phpmyadmin.inc
-    fi
+    hestia package web-server integrate
 }

+ 1 - 1
bin/module/phpmyadmin/remove.inc

@@ -5,7 +5,7 @@ hestia_module_phpmyadmin_remove() {
 
     if ! hestia_module_isinstalled 'phpmyadmin' && [ ! "$param_force" ]; then
         echo "phpMyAdmin module is not installed. See 'hestia module info phpmyadmin'."
-        return 1
+        return 0
     fi
 
     echo "Removing phpMyAdmin module..."

+ 2 - 2
bin/module/remove.inc

@@ -11,7 +11,7 @@ hestia_module_remove() {
         #echo "$mod_providers" equals "$mod_name"
         if [ "$mod_providers" == "$mod_name" ]; then
             # It's a final module name, remove immediately
-            local hmd="$HESTIA/data/modules/${mod_provider}.hmd"
+            local hmd="$HESTIA_INSTALL_DIR/../modules/${mod_provider}.hmd"
             local requiredby=$(hestia_module_remove_check_requiredby $mod_name)
             if [ "$requiredby" ]; then
                 if [ "$param_force" ]; then
@@ -73,7 +73,7 @@ hestia_module_remove_check_requiredby() {
     shift
 
     local requiredby=''
-    for mod_conf in $HESTIA_CONF_MODULES/*.conf; do
+    for mod_conf in $HESTIA_INSTALL_DIR/../modules/*.conf; do
         local mod_hmd=$(osal_kv_read $mod_conf 'hmd')
         if [ "$mod_hmd" ]; then
             # This module is a provider. Check it isn't needed

+ 1 - 1
bin/module/spamassassin/exim-integration/disable.inc

@@ -5,7 +5,7 @@ hestia_module_spamassassin_exim-integration_disable() {
 
     if ! hestia_module_isinstalled 'mta' && [ ! "$param_force" ]; then
         echo "MTA module is not installed. See 'hestia module info mta'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant mta)

+ 1 - 1
bin/module/spamassassin/install.inc

@@ -5,7 +5,7 @@ hestia_module_spamassassin_install() {
 
     if hestia_module_isinstalled 'antispam' && [ ! "$param_force" ]; then
         echo "Antispam module is already installed. See 'hestia module info antispam'."
-        return 1
+        return 0
     fi
 
     echo "Installing Antispam (SpamAssassin) module..."

+ 1 - 1
bin/module/spamassassin/remove.inc

@@ -5,7 +5,7 @@ hestia_module_spamassassin_remove() {
 
     if ! hestia_module_isinstalled 'antispam' && [ ! "$param_force" ]; then
         echo "Antispam module is not installed. See 'hestia module info antispam'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant antispam)

+ 1 - 1
bin/module/vsftpd/install.inc

@@ -5,7 +5,7 @@ hestia_module_vsftpd_install() {
 
     if hestia_module_isinstalled 'ftp' && [ ! "$param_force" ]; then
         echo "FTP module is already installed. See 'hestia module info ftp'."
-        return 1
+        return 0
     fi
 
     echo "Installing FTP (vsftpd) module..."

+ 1 - 1
bin/module/vsftpd/remove.inc

@@ -5,7 +5,7 @@ hestia_module_vsftpd_remove() {
 
     if ! hestia_module_isinstalled 'ftp' && [ ! "$param_force" ]; then
         echo "FTP module is not installed. See 'hestia module info ftp'."
-        return 1
+        return 0
     fi
 
     module_variant=$(hestia_module_getvariant ftp)