Fixed boot.php script
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Paolo Asperti 2020-04-03 21:45:30 +02:00
parent ef4e30b324
commit 53370f6adf
Signed by: paspo
GPG Key ID: 06D46905D19D5182
2 changed files with 15 additions and 7 deletions

View File

@ -1,6 +1,6 @@
Summary: LibreSchool PXE server
Name: libreschool-pxeserver
Version: 1.1.0
Version: 1.1.1
Release: 1.ns7
License: GPL
BuildArch: noarch
@ -112,6 +112,9 @@ if [ "$1" = 0 ]; then
fi
%changelog
* Fri Apr 3 2020 Paolo Asperti <paolo@asperti.com> - 1.1.1-1.ns7
- Fixed boot.php script
* Wed Apr 1 2020 Paolo Asperti <paolo@asperti.com> - 1.1.0-1.ns7
- Added a lot of PXE images
- Added iso download and check script

View File

@ -76,7 +76,8 @@ function getClientFromMAC($mac=false) {
*/
function defaultExit() {
print("#!ipxe
chain http://".$_SERVER['HTTP_HOST'].$_SERVER["SCRIPT_NAME"]."?mac=\${mac}
# reload with mac address
chain http://".$_SERVER['HTTP_HOST'].$_SERVER["SCRIPT_NAME"]."?mac=\${mac}
");
exit();
}
@ -94,8 +95,9 @@ function imageExists($i) {
$dir = $pwd . '/' . $i;
$bootfile = $dir . '/boot';
$iso_is_mounted = $dir . '/iso_is_mounted';
return is_dir($dir) && is_readable($bootfile) &&
is_link($iso_is_mounted) && is_readable($iso_is_mounted);
$iso_ok = ! file_exists($iso_is_mounted) ||
(is_link($iso_is_mounted) && is_readable($iso_is_mounted));
return is_dir($dir) && is_readable($bootfile) && $iso_ok;
}
if (!isset($_REQUEST['mac'])) {
@ -118,7 +120,8 @@ if (isset($client['PXEImageOneTime']) && !empty($client['PXEImageOneTime'])) {
// try to boot the OneTime image
if (imageExists($client['PXEImageOneTime'])) {
print("#!ipxe
chain " . $client['PXEImageOneTime'] . "/boot
# Loading PXEImageOneTime
chain " . $client['PXEImageOneTime'] . "/boot
");
$props = array(
'PXEImageOneTime' => ''
@ -132,12 +135,14 @@ if (isset($client['PXEImage']) && !empty($client['PXEImage'])) {
// try to boot the standard image
if (imageExists($client['PXEImage'])) {
print("#!ipxe
chain " . $client['PXEImage'] . "/boot
# Loading PXEImage
chain " . $client['PXEImage'] . "/boot
");
exit();
}
}
print("#!ipxe
chain localhd/boot
# catchall
chain localhd/boot
");