Kaynağa Gözat

Kolejne poprawki do instalatora

Mariusz Muszyński 9 yıl önce
ebeveyn
işleme
d327ec2454
1 değiştirilmiş dosya ile 11 ekleme ve 8 silme
  1. 11 8
      SE/superedit-INSTALL_SES_PROCESY_A.php

+ 11 - 8
SE/superedit-INSTALL_SES_PROCESY_A.php

@@ -2862,7 +2862,7 @@ function INSTALL_SES_PROCESY_A() {
             if ($h->SERVER_ADDRESS_IP == long2ip(ip2long($subnet) | ~ip2long($subnets[$subnet]["mask"]))) throw new Exception("Adres IP ".$h->SERVER_ADDRESS_IP." jest adresem rozgłoszeniowym dla podsieci ".$subnet."/".$subnets[$subnet]["mask"].". Należy wybrać inny adres IP z puli adresów.<br/>Dostępne pule: ".$availableSubnets);
             if ($h->SERVER_ADDRESS_IP == long2ip(ip2long($subnet) | ~ip2long($subnets[$subnet]["mask"]))) throw new Exception("Adres IP ".$h->SERVER_ADDRESS_IP." jest adresem rozgłoszeniowym dla podsieci ".$subnet."/".$subnets[$subnet]["mask"].". Należy wybrać inny adres IP z puli adresów.<br/>Dostępne pule: ".$availableSubnets);
             DEBUG_S(-3, 'Adres IP serwera należy do znanej puli adresów', 'OK');
             DEBUG_S(-3, 'Adres IP serwera należy do znanej puli adresów', 'OK');
             
             
-            exec("ping ".$h->SERVER_ADDRESS_IP." -i 0.2 -t 1", $output, $exit);
+            V::exec("ping ".$h->SERVER_ADDRESS_IP." -c 10 -i 0.2 -t 2", $output, $exit);
             if (!$exit) throw new Exception('Błąd - maszyna o adresie IP '.$h->SERVER_ADDRESS_IP.' już istnieje (odpowiada na "pingi").');
             if (!$exit) throw new Exception('Błąd - maszyna o adresie IP '.$h->SERVER_ADDRESS_IP.' już istnieje (odpowiada na "pingi").');
             DEBUG_S(-3, 'Brak maszyny w sieci o adresie IP '.$h->SERVER_ADDRESS_IP, 'OK');
             DEBUG_S(-3, 'Brak maszyny w sieci o adresie IP '.$h->SERVER_ADDRESS_IP, 'OK');
             
             
@@ -2930,18 +2930,19 @@ echo \''.$plist.'\' > /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.pl
             echo "<br/>Konfiguracja maszyny wirtualnej";
             echo "<br/>Konfiguracja maszyny wirtualnej";
             $result = execOnParallels('prlctl exec "'.$h->SERVER_ADDRESS.'" "networksetup -setmanual Ethernet '.$h->SERVER_ADDRESS_IP.' '.$subnets[$subnet]["mask"].' '.$subnets[$subnet]["gw"].'"');
             $result = execOnParallels('prlctl exec "'.$h->SERVER_ADDRESS.'" "networksetup -setmanual Ethernet '.$h->SERVER_ADDRESS_IP.' '.$subnets[$subnet]["mask"].' '.$subnets[$subnet]["gw"].'"');
             DEBUG_S(-3, 'Ustawienie adresu IP/maskę oraz bramy domyślnej', $result);
             DEBUG_S(-3, 'Ustawienie adresu IP/maskę oraz bramy domyślnej', $result);
+            sleep(2);
             
             
             $result = execOnParallels('prlctl exec "'.$h->SERVER_ADDRESS.'" "networksetup -setdnsservers Ethernet '.$subnets[$subnet]["dns"].'"');
             $result = execOnParallels('prlctl exec "'.$h->SERVER_ADDRESS.'" "networksetup -setdnsservers Ethernet '.$subnets[$subnet]["dns"].'"');
             DEBUG_S(-3, 'Ustawienie serwera DNS', $result);
             DEBUG_S(-3, 'Ustawienie serwera DNS', $result);
             sleep(2);
             sleep(2);
 
 
-            exec("ping ".$h->SERVER_ADDRESS_IP." -i 0.2 -t 1", $output, $exit);
+            V::exec("ping ".$h->SERVER_ADDRESS_IP." -c 5 -t 20", $output, $exit);
             DEBUG_S(-3, 'Weryfikacja czy maszyna wirtualna odpowiada na "pingi"', $output);
             DEBUG_S(-3, 'Weryfikacja czy maszyna wirtualna odpowiada na "pingi"', $output);
             if ($exit) {
             if ($exit) {
-                execOnParallels('sudo launchctl unload /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.plist');
+/*                execOnParallels('sudo launchctl unload /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.plist');
                 execOnParallels('sudo rm -f /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.plist');
                 execOnParallels('sudo rm -f /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.plist');
                 execOnParallels('prlctl stop "'.$h->SERVER_ADDRESS.'" --kill');
                 execOnParallels('prlctl stop "'.$h->SERVER_ADDRESS.'" --kill');
-                execOnParallels('prlctl delete "'.$h->SERVER_ADDRESS.'"');
+                execOnParallels('prlctl delete "'.$h->SERVER_ADDRESS.'"');*/
                 throw new Exception('Błąd - maszyna wirtualna nie odpowiada na pingi, usuwam maszynę i przerywam...');
                 throw new Exception('Błąd - maszyna wirtualna nie odpowiada na pingi, usuwam maszynę i przerywam...');
             }
             }
             
             
@@ -2985,7 +2986,9 @@ echo \''.$plist.'\' > /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.pl
             DEBUG_S(-3, $cmd, $result);
             DEBUG_S(-3, $cmd, $result);
             
             
             echo "<br/>Instalowanie Procesy5";
             echo "<br/>Instalowanie Procesy5";
-            $cmd = 'screen -d -m prlctl exec "'.$h->SERVER_ADDRESS.'" \'touch /var/root/procesy5_install.started; installer -package "/Users/server/Downloads/'.$package.'" -target "/" -verboseR > /var/root/procesy5_install.log; touch /var/root/procesy5_install.completed\'';
+            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'mkdir /var/root/.procesy5_install; touch /var/root/.procesy5_install/started\'';
+            $result = execOnParallels($cmd);
+            $cmd = 'screen -d -m prlctl exec "'.$h->SERVER_ADDRESS.'" \'installer -package "/Users/server/Downloads/'.$package.'" -target "/" -verboseR > /var/root/.procesy5_install/log && touch /var/root/.procesy5_install/completed\'';
             $result = execOnParallels($cmd);
             $result = execOnParallels($cmd);
             DEBUG_S(-3, $cmd, $result);
             DEBUG_S(-3, $cmd, $result);
             
             
@@ -2997,11 +3000,11 @@ echo \''.$plist.'\' > /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.pl
         
         
     } else if(!empty($_REQUEST['STATUS_INSTALACJI_NA_PARALLELS'])) {
     } else if(!empty($_REQUEST['STATUS_INSTALACJI_NA_PARALLELS'])) {
         try {
         try {
-            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'[ -f "/var/root/procesy5_install.started" ] && echo 1\' 2>/dev/null';
+            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'[ -f "/var/root/.procesy5_install/started" ] && echo 1\' 2>/dev/null';
             $result = execOnParallels($cmd);
             $result = execOnParallels($cmd);
             if (!$result) throw new Exception("Błąd - automatyczna instalacja Procesy5 na wirtualnej maszynie ".$h->SERVER_ADDRESS." nie została uruchomiona.");
             if (!$result) throw new Exception("Błąd - automatyczna instalacja Procesy5 na wirtualnej maszynie ".$h->SERVER_ADDRESS." nie została uruchomiona.");
             
             
-            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'[ -f "/var/root/procesy5_install.completed" ] && echo 1\'';
+            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'[ -f "/var/root/.procesy5_install/completed" ] && echo 1\'';
             $result = execOnParallels($cmd);
             $result = execOnParallels($cmd);
             if ($result) {
             if ($result) {
                 echo "<br/><font size=4 color=green><b>Potencjalnie zainstalowano Procesy5 na ".$h->SERVER_ADDRESS."<br/>";
                 echo "<br/><font size=4 color=green><b>Potencjalnie zainstalowano Procesy5 na ".$h->SERVER_ADDRESS."<br/>";
@@ -3026,7 +3029,7 @@ echo \''.$plist.'\' > /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.pl
                 }
                 }
                 else echo "<br/><font size=4 color=red><b>Instalacja Procesy5 na ".$h->SERVER_ADDRESS." zakończyła się niepowodzeniem.</b></font><br/><br/>";
                 else echo "<br/><font size=4 color=red><b>Instalacja Procesy5 na ".$h->SERVER_ADDRESS." zakończyła się niepowodzeniem.</b></font><br/><br/>";
             }
             }
-            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'cat /var/root/procesy5_install.log\'';
+            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'cat /var/root/.procesy5_install/log\'';
             $result = execOnParallels($cmd);
             $result = execOnParallels($cmd);
             DEBUG_S(-3, "Log z instalatora", "<pre>".$result."</pre>");
             DEBUG_S(-3, "Log z instalatora", "<pre>".$result."</pre>");
             echo "<br/>";
             echo "<br/>";