Initial commit

This commit is contained in:
billz 2023-11-23 07:44:46 +00:00
parent e2111fdf1f
commit d14040d3a7

View file

@ -0,0 +1,43 @@
<?php
$logFile = '/tmp/raspap_install.log';
$searchStrings = [
'Configure update' => 1,
'Updating sources' => 2,
'Installing required packages' => 3,
'Cloning latest files' => 4,
'Installing application' => 5,
'Installation completed' => 6,
'error' => 7
];
sleep(1);
if (file_exists($logFile)) {
$handle = fopen($logFile, 'r');
if ($handle) {
while (($line = fgets($handle)) !== false) {
foreach ($searchStrings as $searchString => $value) {
if (strpos($line, $searchString) !== false) {
echo $value .PHP_EOL;
flush();
ob_flush();
if ($value === 6) {
fclose($handle);
exit();
} elseif ($value === 7) {
echo $line .PHP_EOL;
fclose($handle);
exit();
}
}
}
}
fclose($handle);
} else {
echo json_encode("Unable to open file: $logFile");
}
} else {
echo json_encode("File does not exist: $logFile");
}