diff --git a/build.php b/build.php index b5260174f016c6238bef4aafdf01c17ddeee1ef6..938f0d4e521b203939357dd4e08039f8ae380b5a 100755 --- a/build.php +++ b/build.php @@ -17,7 +17,6 @@ echo " B U I L D E R - "; _chdir($selfdir); diff --git a/inc_functions.php b/inc_functions.php index 21fdab7c564a6a944e39209f9de58b54804d89de..720062a15a9cb7bafdbd97310af70f71c3a32c65 100644 --- a/inc_functions.php +++ b/inc_functions.php @@ -78,7 +78,7 @@ function _exec($cmd): void $sTime= "... â±ï¸ Time: " . round($iEnd-$iStart, 3) . "s\n"; if ($rc != 0) { echo "rc=$rc $sTime"; - _abort("Error: Command failed. Aborting.", $rc); + _abort("Command failed. Aborting.", $rc); } _ok($sTime); } @@ -88,7 +88,7 @@ function _mkdir(string $sMyDir): void if (!is_dir($sMyDir)) { echo "DIR > '$sMyDir' "; if (!mkdir($sMyDir, 0755, true)) { - _abort("ERROR: mkdir failed."); + _abort("mkdir('$sMyDir') failed."); } _ok(); echo "\n"; @@ -97,3 +97,18 @@ function _mkdir(string $sMyDir): void } } + +function _rm(string $sFileObj): void +{ + if (is_dir($sFileObj)) + { + _exec("rm -rf \"$sFileObj\""); + } else if (file_exists($sFileObj)) { + if (!unlink($sFileObj)) { + _abort("unlink('$sFileObj') failed."); + } + _ok("File was deleted"); + } else { + _skip("rm '$sFileObj' - does not exist"); + } +} \ No newline at end of file diff --git a/installer.php b/installer.php index b4ba2f2df8a822282435267f0b12e78721cb6148..85bd8bb473e7f89a3bfed2efed12387ca7be10e6 100755 --- a/installer.php +++ b/installer.php @@ -34,17 +34,41 @@ spc-windows-x64.exe 2025-02-15 17:30:46 3.9M // ---------------------------------------------------------------------- echo " - I N S T A L L E R + I N S T A L L E R * U P D A T E R - - gets appmonitor sources + - gets appmonitor sources or updates it - gets spc binary - spc downloads PHP and libs - - spc builds micro (~2 min) + - spc builds micro + +"; + +// ---------------------------------------------------------------------- + +if ($argc > 1) { + parse_str(implode('&', array_slice($argv, 1)), $ARGS); +} +if(isset($ARGS['-h']) || isset($ARGS['--help'])){ + echo " + HELP + + -h, --help Show this help + -r, --reset Reset; delete created folders of installer or build "; + exit(0); +} + _chdir($selfdir); +if(isset($ARGS['-r']) || isset($ARGS['--reset'])){ + _h1("Reset data"); + _rm($dirBuild); + _rm($dirExternal); + _rm($dirPackages); +} + // ---------------------------------------------------------------------- _h1("Create directories"); @@ -144,9 +168,11 @@ if(file_exists($doneBuild)){ if ($bDoBild){ _exec("$SPC --no-interaction doctor"); + + echo "💡 Hint: this can take a minute on a fresh install ...\n"; _exec("$SPC download --no-interaction --with-php=$php_version --for-extensions \"$php_libs\""); - echo "💡 Hint: this can take 2 minutes ...\n"; + echo "💡 Hint: this can take 4 minutes on a fresh install or less on module changes ...\n"; _exec("$SPC build --no-interaction --build-micro \"$php_libs\""); file_put_contents("$doneBuild", date("Y-m-d H:i:s") . "\n$sDoneData\n"); } else {