Skip to content
Snippets Groups Projects
Commit bb5bfd9f authored by Axel Hahn's avatar Axel Hahn
Browse files

installer: add params and reset installation

parent 5f809446
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,6 @@ echo "
B U I L D E R
";
_chdir($selfdir);
......
......@@ -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
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment