Browse Source

Add repos

Ernesto Nicolás Carrea 5 years ago
parent
commit
c5ec552efb

+ 14 - 0
bin/module/apache/install.inc

@@ -13,6 +13,20 @@ hestia_module_apache_install() {
     osal_service_stop $OSAL_SERVICE_APACHE > /dev/null 2>&1
     osal_service_stop $OSAL_SERVICE_APACHE > /dev/null 2>&1
     hestia_config_backup 'apache-install' $OSAL_PATH_APACHE_CONF $OSAL_PATH_APACHE_CONF_D
     hestia_config_backup 'apache-install' $OSAL_PATH_APACHE_CONF $OSAL_PATH_APACHE_CONF_D
 
 
+    # Setup repos
+    if [ "$OS_BASE" = 'debian' ]; then
+        cat > /etc/apt/sources.list.d/apache2.list <<EOL
+# This file was added by Hestia Control Panel.
+deb https://packages.sury.org/apache2/ $OS_CODENAME main
+EOL
+        apt-key adv --fetch-keys 'https://packages.sury.org/apache2/apt.gpg' > /dev/null 2>&1
+    elif [ "$OS_BASE" = 'ubuntu' ]; then
+        cat > /etc/apt/sources.list.d/apache2.list <<EOL
+# This file was added by Hestia Control Panel.
+deb http://ppa.launchpad.net/ondrej/apache2/ubuntu $OS_CODENAME main
+EOL
+    fi
+
     osal_package_preinstall
     osal_package_preinstall
     osal_package_install $OSAL_PKG_APACHE $OSAL_PKG_APACHE_EXTRA
     osal_package_install $OSAL_PKG_APACHE $OSAL_PKG_APACHE_EXTRA
 
 

+ 20 - 14
bin/module/mariadb/install.inc

@@ -9,32 +9,38 @@ hestia_module_mariadb_install() {
     fi
     fi
 
 
     echo "Installing database (MariaDB) module..."
     echo "Installing database (MariaDB) module..."
-    local mariadb_v='10.4'
+    local hmd="$HESTIA_INSTALL_DIR/../modules/mariadb.hmd"
+    local mariadb_version=$(osal_kv_read $hmd 'version')
 
 
     osal_service_stop $OSAL_SERVICE_MARIADB > /dev/null 2>&1
     osal_service_stop $OSAL_SERVICE_MARIADB > /dev/null 2>&1
     hestia_config_backup 'mariadb-install' $OSAL_PATH_MARIADB_CONF $OSAL_DIR_MARIADB_CONF_D $OSAL_PATH_MARIADB_DATA
     hestia_config_backup 'mariadb-install' $OSAL_PATH_MARIADB_CONF $OSAL_DIR_MARIADB_CONF_D $OSAL_PATH_MARIADB_DATA
 
 
-    if [ "$OS_TYPE" == 'ubuntu' ]; then
-        echo "deb [arch=amd64] http://ams2.mirrors.digitalocean.com/mariadb/repo/$mariadb_v/$OS_TYPE $OS_CODENAME main" > $apt/mariadb.list
-        APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 > /dev/null 2>&1
-    elif [ "$OS_TYPE" == 'debian' ]; then
-        echo "deb [arch=amd64] http://ams2.mirrors.digitalocean.com/mariadb/repo/$mariadb_v/$OS_TYPE $OS_CODENAME main" > $apt/mariadb.list
-        if [ "$OS_VERSION" -eq 8 ]; then
-            APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com CBCB082A1BB943DB > /dev/null 2>&1
+    # Setup repos
+    if [ "$OS_BASE" = 'debian' ]; then
+        cat > /etc/apt/sources.list.d/mariadb.list <<EOL
+# This file was added by Hestia Control Panel.
+deb [arch=amd64] https://mirror.mva-n.net/mariadb/repo/$mariadb_version/debian $OS_CODENAME main
+EOL
+        apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
+    elif [ "$OS_BASE" = 'ubuntu' ]; then
+        cat > /etc/apt/sources.list.d/mariadb.list <<EOL
+# This file was added by Hestia Control Panel.
+deb [arch=amd64] https://mirror.mva-n.net/mariadb/repo/$mariadb_version/ubuntu $OS_CODENAME main
+EOL
+        if [ "$OS_VERSION" = '16.04' ]; then 
+            apt-key adv --fetch-keys 'http://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
         else
         else
-            APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com F1656F24C74CD1D8 > /dev/null 2>&1
+            apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
         fi
         fi
-    elif [ "$OS_TYPE" == 'centos' ]; then
+    elif [ "$OS_BASE" = 'rhel' ]; then
         # Remove conflicting OS-provided packages
         # Remove conflicting OS-provided packages
         osal_package_remove mariadb-server mariadb-gssapi-server
         osal_package_remove mariadb-server mariadb-gssapi-server
 
 
         cat > "/etc/yum.repos.d/mariadb.repo" <<EOL
         cat > "/etc/yum.repos.d/mariadb.repo" <<EOL
-# This file is auto generated. Do not edit this file. Changes will be overwriten
-# Run 'hestia module mariadb info' or visit http://hestiacp.com for more info.
-# http://downloads.mariadb.org/mariadb/repositories/
+# This file was added by Hestia Control Panel.
 [mariadb]
 [mariadb]
 name = MariaDB
 name = MariaDB
-baseurl = http://yum.mariadb.org/${mariadb_v}/${OS_TYPE}${OS_VERSION}-amd64
+baseurl = http://yum.mariadb.org/${mariadb_version}/${OS_TYPE}${OS_VERSION}-amd64
 module_hotfixes=1
 module_hotfixes=1
 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
 gpgcheck=1
 gpgcheck=1

+ 17 - 6
bin/module/nginx/install.inc

@@ -13,15 +13,26 @@ hestia_module_nginx_install() {
     osal_service_stop $OSAL_SERVICE_NGINX > /dev/null 2>&1
     osal_service_stop $OSAL_SERVICE_NGINX > /dev/null 2>&1
     hestia_config_backup 'nginx-install' $OSAL_PATH_NGINX_CONF
     hestia_config_backup 'nginx-install' $OSAL_PATH_NGINX_CONF
 
 
+    # Setup repos
     if [ "$OS_BASE" = 'debian' ]; then
     if [ "$OS_BASE" = 'debian' ]; then
-        # Add Nginx repo
-        echo "deb [arch=amd64] http://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
-        wget --quiet http://nginx.org/keys/nginx_signing.key -O /tmp/nginx_signing.key
-        APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/nginx_signing.key > /dev/null 2>&1
+        cat > /etc/apt/sources.list.d/nginx.list <<EOL
+# This file was added by Hestia Control Panel.
+deb [arch=amd64] https://nginx.org/packages/mainline/$VERSION/ $OS_CODENAME nginx
+EOL
+        apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1
+    elif [ "$OS_BASE" = 'ubuntu' ]; then
+        cat > /etc/apt/sources.list.d/nginx.list <<EOL
+# This file was added by Hestia Control Panel.
+deb [arch=amd64] https://nginx.org/packages/mainline/$VERSION/ $OS_CODENAME nginx
+EOL
+        if [ "$OS_VERSION" = '16.04' ]; then 
+            apt-key adv --fetch-keys 'http://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1
+        else
+            apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1    
+        fi
     elif [ "$OS_BASE" = 'rhel' ]; then
     elif [ "$OS_BASE" = 'rhel' ]; then
         cat > "/etc/yum.repos.d/nginx.repo" <<EOL
         cat > "/etc/yum.repos.d/nginx.repo" <<EOL
-# This file is auto generated. Do not edit this file. Changes will be overwriten
-# Run 'hestia module nginx info' or visit http://hestiacp.com for more info.
+# This file was added by Hestia Control Panel.
 [nginx-stable]
 [nginx-stable]
 name=nginx stable repo
 name=nginx stable repo
 baseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/
 baseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/

+ 13 - 0
bin/module/php-fpm/install.inc

@@ -11,6 +11,19 @@ hestia_module_php-fpm_install() {
 
 
     echo "Installing PHP (FPM) module..."
     echo "Installing PHP (FPM) module..."
 
 
+    if [ "$OS_BASE" = 'debian' ]; then
+        cat > /etc/apt/sources.list.d/php.list <<EOL
+# This file was added by Hestia Control Panel.
+deb https://packages.sury.org/php/ $OS_CODENAME main
+EOL
+        apt-key adv --fetch-keys 'https://packages.sury.org/php/apt.gpg' > /dev/null 2>&1
+    elif [ "$OS_BASE" = 'ubuntu' ]; then
+        LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php > /dev/null 2>&1
+    elif [ "$OS_BASE" = 'rhel' ]; then
+        dnf -y install http://rpms.remirepo.net/enterprise/remi-release-$OS_VERSION.rpm
+        dnf config-manager --set-enabled remi
+    fi
+
     local pool_d=$(osal_php_fpm_pool_d $PHP_DEFAULT_VERSION)
     local pool_d=$(osal_php_fpm_pool_d $PHP_DEFAULT_VERSION)
     mkdir -p $pool_d
     mkdir -p $pool_d
 
 

+ 25 - 0
bin/setup/init.inc

@@ -21,6 +21,31 @@ hestia_setup_init() {
         ln -s $HESTIA/log /var/log/hestia
         ln -s $HESTIA/log /var/log/hestia
     fi
     fi
 
 
+    # Setup repos
+    if [ "$OS_BASE" = 'debian' ]; then
+        cat > /etc/apt/sources.list.d/hestia.list <<EOL
+# This file was added by Hestia Control Panel.
+deb https://apt.hestiacp.com/ $codename main
+EOL
+        apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
+    elif [ "$OS_BASE" = 'ubuntu' ]; then
+        cat > /etc/apt/sources.list.d/hestia.list <<EOL
+# This file was added by Hestia Control Panel.
+deb https://apt.hestiacp.com/ $codename main
+EOL
+        apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
+    elif [ "$OS_BASE" = 'rhel' ]; then
+        cat > "/etc/yum.repos.d/hestia.repo" <<EOL
+# This file was added by Hestia Control Panel.
+#[hestia]
+#name=Hestia Control Panel
+#baseurl=http://rpm.hestiacp.com/packages/centos/\$releasever/\$basearch/
+#gpgcheck=0
+#enabled=1
+#gpgkey=https://rpm.hestiacp.com/keys/hestia.key
+EOL
+    fi
+
     HESTIA_VERSION=$(osal_package_getversion 'hestia')
     HESTIA_VERSION=$(osal_package_getversion 'hestia')
     osal_kv_write $HESTIA/conf/hestia.conf 'VERSION' $HESTIA_VERSION
     osal_kv_write $HESTIA/conf/hestia.conf 'VERSION' $HESTIA_VERSION