Просмотр исходного кода

Update unassigned IP address configuration

Kristan Kenney 6 лет назад
Родитель
Сommit
d7f2deebb6
3 измененных файлов с 36 добавлено и 48 удалено
  1. 12 16
      install/hst-install-debian.sh
  2. 12 16
      install/hst-install-ubuntu.sh
  3. 12 16
      install/upgrade/0.10.0-190430.sh

+ 12 - 16
install/hst-install-debian.sh

@@ -1117,14 +1117,12 @@ if [ "$nginx" = 'yes' ]; then
     fi
 
     # Redirect unassigned hosts to default "Success" page
-    if [ -f /usr/local/hestia/data/ips/* ]; then
-        for ip in /usr/local/hestia/data/ips/*; do
-            ipaddr=${ip##*/}
-            rm -f /etc/nginx/conf.d/$ip.conf
-            cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
-            sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
-        done
-    fi
+    for ip in /usr/local/hestia/data/ips/*; do
+        ipaddr=${ip##*/}
+        rm -f /etc/nginx/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
+        sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
+    done
 
     # Install dhparam.
     cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
@@ -1181,14 +1179,12 @@ if [ "$apache" = 'yes' ]; then
     fi
 
     # Add unassigned hosts configuration to apache2
-    if [ -f /usr/local/hestia/data/ips/* ]; then
-        for ip in /usr/local/hestia/data/ips/*; do
-            ipaddr=${ip##*/}
-            rm -f /etc/apache2/conf.d/$ip.conf
-            cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
-            sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
-        done
-    fi
+    for ip in /usr/local/hestia/data/ips/*; do
+        ipaddr=${ip##*/}
+        rm -f /etc/apache2/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
+        sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
+    done
 
     update-rc.d apache2 defaults > /dev/null 2>&1
     service apache2 start >> $LOG

+ 12 - 16
install/hst-install-ubuntu.sh

@@ -1084,14 +1084,12 @@ if [ "$nginx" = 'yes' ]; then
     fi
 
     # Redirect unassigned hosts to default "Success" page
-    if [ -f /usr/local/hestia/data/ips/* ]; then
-        for ip in /usr/local/hestia/data/ips/*; do
-            ipaddr=${ip##*/}
-            rm -f /etc/nginx/conf.d/$ip.conf
-            cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
-            sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
-        done
-    fi
+    for ip in /usr/local/hestia/data/ips/*; do
+        ipaddr=${ip##*/}
+        rm -f /etc/nginx/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
+        sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
+    done
 
     # Install dhparam.
     cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
@@ -1144,14 +1142,12 @@ if [ "$apache" = 'yes' ]; then
     fi
 
     # Add unassigned hosts configuration to apache2
-    if [ -f /usr/local/hestia/data/ips/* ]; then
-        for ip in /usr/local/hestia/data/ips/*; do
-            ipaddr=${ip##*/}
-            rm -f /etc/apache2/conf.d/$ip.conf
-            cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
-            sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
-        done
-    fi
+    for ip in /usr/local/hestia/data/ips/*; do
+        ipaddr=${ip##*/}
+        rm -f /etc/apache2/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
+        sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
+    done
 
     update-rc.d apache2 defaults > /dev/null 2>&1
     service apache2 start >> $LOG

+ 12 - 16
install/upgrade/0.10.0-190430.sh

@@ -156,25 +156,21 @@ fi
 # Add unassigned hosts configuration to Nginx and Apache
 if [ "$WEB_SYSTEM" = "apache2" ]; then
     echo "(*) Adding unassigned hosts configuration to Apache..."
-    if [ -f /usr/local/hestia/data/ips/* ]; then
-        for ip in /usr/local/hestia/data/ips/*; do
-            ipaddr=${ip##*/}
-            rm -f /etc/apache2/conf.d/$ip.conf
-            cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
-            sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
-        done
-    fi
+    for ip in /usr/local/hestia/data/ips/*; do
+        ipaddr=${ip##*/}
+        rm -f /etc/apache2/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr.conf
+        sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
+    done
 fi
 if [ "$PROXY_SYSTEM" = "nginx" ]; then
     echo "(*) Adding unassigned hosts configuration to Nginx..."
-    if [ -f /usr/local/hestia/data/ips/* ]; then
-        for ip in /usr/local/hestia/data/ips/*; do
-            ipaddr=${ip##*/}
-            rm -f /etc/nginx/conf.d/$ip.conf
-            cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
-            sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
-        done
-    fi
+    for ip in /usr/local/hestia/data/ips/*; do
+        ipaddr=${ip##*/}
+        rm -f /etc/nginx/conf.d/$ip.conf
+        cp -f $HESTIA/install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr.conf
+        sed -i 's/directIP/'$ipaddr'/g' /etc/nginx/conf.d/$ipaddr.conf
+    done
 fi
 
 # Fix empty pool error message for MultiPHP