Compare commits

...

4 Commits

Author SHA1 Message Date
Paolo Asperti cc60775ad7
added popos 20.04
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-05-02 22:49:49 +02:00
Paolo Asperti 9a425b1007
fix wrong copypaste 2020-05-02 22:47:41 +02:00
Paolo Asperti 91811347d8
added default image for all clients (known and unkown)
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-04-28 22:44:40 +02:00
Paolo Asperti df17c93e76
added ubuntu 20.04 flavors
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-04-25 21:09:28 +02:00
90 changed files with 264 additions and 28 deletions

View File

@ -29,6 +29,17 @@ db hosts setprop lab01 \
By running the above command, the **memtest** image will be used for one boot only.
## default image ##
When there's no specific setting for the host, the host is not in the hosts db, or the image specified for the host is not available, the *default image* is used.
To set the default image, you can use this command:
```bash
db configuration setprop pxeserver-httpd \
defaultimage memtest
```
## TODO / ideas ##
* Create a menu, for interactive selection

View File

@ -1,6 +1,6 @@
Summary: LibreSchool PXE server
Name: libreschool-pxeserver
Version: 1.1.2
Version: 1.1.5
Release: 1.ns7
License: GPL
BuildArch: noarch
@ -112,6 +112,20 @@ if [ "$1" = 0 ]; then
fi
%changelog
* Sat May 2 2020 Paolo Asperti <paolo@asperti.com> - 1.1.5-1.ns7
- Added pop!OS 20.04
- Fixed some copypaste errors
* Tue Apr 28 2020 Paolo Asperti <paolo@asperti.com> - 1.1.4-1.ns7
- Added default image setting
* Sat Apr 25 2020 Paolo Asperti <paolo@asperti.com> - 1.1.3-1.ns7
- Added KUbuntu 20.04 (live only)
- Added LUbuntu 20.04 (live only)
- Added Ubuntu Budgie 20.04
- Added Ubuntu Mate 20.04
- Added XUbuntu 20.04
* Fri Apr 24 2020 Paolo Asperti <paolo@asperti.com> - 1.1.2-1.ns7
- Added Ubuntu 20.04

View File

@ -0,0 +1 @@
localhd

View File

@ -5,7 +5,7 @@
*
* This script manages the loading of the PXE image, based on specific
* host preferences.
*
*
* php version 5.4.16
*
* @category Client_Management
@ -21,15 +21,16 @@
require_once "EsmithDatabase.php";
$hosts_db = new EsmithDatabase('hosts');
$config_db = new EsmithDatabase('configuration');
/**
/**
* Check if specified mac address is valid
*
*
* We should've used filter_var($mac, FILTER_VALIDATE_MAC) but it's available
* from PHP 5.5.0 and we have 5.4.16. Too bad.
*
*
* @param string $mac the mac address to examine
*
*
* @return bool if the macaddress is valid or not
*/
function isValidMAC($mac) {
@ -50,11 +51,11 @@ function isValidMAC($mac) {
}
}
/**
/**
* Get the client corresponding a specific mac address
*
*
* @param string $mac the mac address of the client
*
*
* @return host||boolean client if found, false otherwise
*/
function getClientFromMAC($mac=false) {
@ -67,11 +68,11 @@ function getClientFromMAC($mac=false) {
}
}
/**
/**
* Default exit string
* This string will instruct to reload the script
* This string will instruct to reload the script
* passing the mac address of the calling machine
*
*
* @return null
*/
function defaultExit() {
@ -83,23 +84,43 @@ chain http://".$_SERVER['HTTP_HOST'].$_SERVER["SCRIPT_NAME"]."?mac=\${mac}
}
/**
/**
* Check if specified PXE image exists
*
*
* @param string $i image name
*
*
* @return bool if the image exists or not
*/
function imageExists($i) {
$pwd = dirname(__FILE__);
$dir = $pwd . '/' . $i;
$bootfile = $dir . '/boot';
$iso_is_mounted = $dir . '/iso_is_mounted';
$iso_ok = ! file_exists($iso_is_mounted) ||
$bootfile = $dir . '/boot';
$iso_is_mounted = $dir . '/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;
}
/**
* Try to boot the default PXE Image
*
* @return void
*/
function try_defaultimage() {
global $config_db;
$defaultimage = $config_db->getProp('pxeserver-httpd','defaultimage');
if (imageExists($defaultimage)) {
print("#!ipxe
# Loading PXEImage
chain " . $defaultimage . "/boot
");
exit();
}
}
if (!isset($_REQUEST['mac'])) {
defaultExit();
}
@ -112,7 +133,7 @@ if (!isValidMAC($_REQUEST['mac'])) {
$mac = $_REQUEST['mac'];
$client = getClientFromMAC($mac);
if (!$client) {
// TODO: make up a default for unknown clients
try_defaultimage();
defaultExit();
}

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso elementaryos-5.1-stable.20200204.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -0,0 +1,9 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso kubuntu-20.04-desktop-amd64.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/kubuntu-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
ffddf52ad0122180a130f1d738a9a2cb77d87848a326a16cf830ac871a3c786f kubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/kubuntu-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1,2 @@
http://cdimage.ubuntu.com/kubuntu/releases/20.04/release/kubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/kubuntu-20.04-desktop-amd64.iso/casper/vmlinuz

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso linuxmint-19.3-cinnamon-32bit.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso linuxmint-19.3-cinnamon-64bit.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso linuxmint-19.3-mate-32bit.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso linuxmint-19.3-mate-64bit.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso linuxmint-19.3-xfce-32bit.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso linuxmint-19.3-xfce-64bit.iso||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -0,0 +1,9 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso lubuntu-20.04-desktop-amd64.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/lubuntu-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
cc18a581d2e4d86f3f29ef44c12a0c42b54cde93db9fc5f7c3f10db1aff3fa9a lubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/lubuntu-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1 @@
http://cdimage.ubuntu.com/lubuntu/releases/20.04/release/lubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/lubuntu-20.04-desktop-amd64.iso/casper/vmlinuz

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso pop-os_18.04_amd64_intel_59.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -2,7 +2,7 @@
chain --autofree ../common.ipxe.cfg ||
set iso Zorin-OS-15.2-Core-64-bit.iso ||
set iso pop-os_18.04_amd64_nvidia_59.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd

View File

@ -0,0 +1,9 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso pop-os_20.04_amd64_intel_5.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_intel_5.iso/casper/initrd.gz

View File

@ -0,0 +1 @@
5478241142930dbd95143773d53be079087024d3112614a901edc2829040f996 pop-os_20.04_amd64_intel_5.iso

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_intel_5.iso/.disk/info

View File

@ -0,0 +1 @@
https://pop-iso.sfo2.cdn.digitaloceanspaces.com/20.04/amd64/intel/5/pop-os_20.04_amd64_intel_5.iso

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_intel_5.iso/casper/vmlinuz.efi

View File

@ -0,0 +1,12 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso pop-os_20.04_amd64_intel_5.iso ||
set preseedurl ${base-url}/popos-20.04-5-intel-64bit-preseed/preseed.txt ||
set kernelparams locale=${locale} keyboard-configuration/modelcode=SKIP automatic-ubiquity url=${preseedurl} ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ -- ${kernelparams}
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_intel_5.iso/casper/initrd.gz

View File

@ -0,0 +1 @@
5478241142930dbd95143773d53be079087024d3112614a901edc2829040f996 pop-os_20.04_amd64_intel_5.iso

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_intel_5.iso/.disk/info

View File

@ -0,0 +1 @@
https://pop-iso.sfo2.cdn.digitaloceanspaces.com/20.04/amd64/intel/5/pop-os_20.04_amd64_intel_5.iso

View File

@ -0,0 +1 @@
../default_preseed.txt

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_intel_5.iso/casper/vmlinuz.efi

View File

@ -0,0 +1,9 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso pop-os_20.04_amd64_nvidia_5.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_nvidia_5.iso/casper/initrd.gz

View File

@ -0,0 +1 @@
a2e0ebc25999036dcd0b89fd21d49069438a529fd8c46ffc31053258b447f9e8 pop-os_20.04_amd64_nvidia_5.iso

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_nvidia_5.iso/.disk/info

View File

@ -0,0 +1 @@
https://pop-iso.sfo2.cdn.digitaloceanspaces.com/20.04/amd64/nvidia/5/pop-os_20.04_amd64_nvidia_5.iso

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_nvidia_5.iso/casper/vmlinuz.efi

View File

@ -0,0 +1,12 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso pop-os_20.04_amd64_nvidia_5.iso ||
set preseedurl ${base-url}/popos-20.04-5-nvidia-64bit-preseed/preseed.txt ||
set kernelparams locale=${locale} keyboard-configuration/modelcode=SKIP automatic-ubiquity url=${preseedurl} ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ -- ${kernelparams}
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_nvidia_5.iso/casper/initrd.gz

View File

@ -0,0 +1 @@
a2e0ebc25999036dcd0b89fd21d49069438a529fd8c46ffc31053258b447f9e8 pop-os_20.04_amd64_nvidia_5.iso

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_nvidia_5.iso/.disk/info

View File

@ -0,0 +1 @@
https://pop-iso.sfo2.cdn.digitaloceanspaces.com/20.04/amd64/nvidia/5/pop-os_20.04_amd64_nvidia_5.iso

View File

@ -0,0 +1 @@
../default_preseed.txt

View File

@ -0,0 +1 @@
../../mounts/pop-os_20.04_amd64_nvidia_5.iso/casper/vmlinuz.efi

View File

@ -0,0 +1,9 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso ubuntu-budgie-20.04-desktop-amd64.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/ubuntu-budgie-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
2d01868d394f0dbe06c94077accb48bfc9c4d4bcda4ea5a4ea3f5b0f68a30a81 ubuntu-budgie-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/ubuntu-budgie-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1 @@
http://cdimage.ubuntu.com/ubuntu-budgie/releases/20.04/release/ubuntu-budgie-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/ubuntu-budgie-20.04-desktop-amd64.iso/casper/vmlinuz

View File

@ -0,0 +1,12 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso ubuntu-budgie-20.04-desktop-amd64.iso ||
set preseedurl ${base-url}/ubuntu-budgie-20.04-64bit-preseed/preseed.txt ||
set kernelparams locale=${locale} keyboard-configuration/modelcode=SKIP automatic-ubiquity url=${preseedurl} ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ -- ${kernelparams}
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/ubuntu-budgie-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
2d01868d394f0dbe06c94077accb48bfc9c4d4bcda4ea5a4ea3f5b0f68a30a81 ubuntu-budgie-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/ubuntu-budgie-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1 @@
http://cdimage.ubuntu.com/ubuntu-budgie/releases/20.04/release/ubuntu-budgie-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../default_preseed.txt

View File

@ -0,0 +1 @@
../../mounts/ubuntu-budgie-20.04-desktop-amd64.iso/casper/vmlinuz

View File

@ -0,0 +1,9 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso ubuntu-mate-20.04-desktop-amd64.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/ubuntu-mate-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
a298764d9d2615c6fc5e99c7dddd9d7687f885821e6915c57daf9747b9c33445 ubuntu-mate-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/ubuntu-mate-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1 @@
http://cdimage.ubuntu.com/ubuntu-mate/releases/20.04/release/ubuntu-mate-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/ubuntu-mate-20.04-desktop-amd64.iso/casper/vmlinuz

View File

@ -0,0 +1,12 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso ubuntu-mate-20.04-desktop-amd64.iso ||
set preseedurl ${base-url}/ubuntu-mate-20.04-64bit-preseed/preseed.txt ||
set kernelparams locale=${locale} keyboard-configuration/modelcode=SKIP automatic-ubiquity url=${preseedurl} ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ -- ${kernelparams}
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/ubuntu-mate-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
a298764d9d2615c6fc5e99c7dddd9d7687f885821e6915c57daf9747b9c33445 ubuntu-mate-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/ubuntu-mate-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1 @@
http://cdimage.ubuntu.com/ubuntu-mate/releases/20.04/release/ubuntu-mate-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../default_preseed.txt

View File

@ -0,0 +1 @@
../../mounts/ubuntu-mate-20.04-desktop-amd64.iso/casper/vmlinuz

View File

@ -0,0 +1,9 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso xubuntu-20.04-desktop-amd64.iso ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ splash
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/xubuntu-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
005a9450d16fe885132be9368a96c73910096b57cc1a67f03a97fca7af95f4a3 xubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/xubuntu-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1 @@
http://cdimage.ubuntu.com/xubuntu/releases/20.04/release/xubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/xubuntu-20.04-desktop-amd64.iso/casper/vmlinuz

View File

@ -0,0 +1,12 @@
#!ipxe
chain --autofree ../common.ipxe.cfg ||
set iso xubuntu-20.04-desktop-amd64.iso ||
set preseedurl ${base-url}/xubuntu-20.04-64bit-preseed/preseed.txt ||
set kernelparams locale=${locale} keyboard-configuration/modelcode=SKIP automatic-ubiquity url=${preseedurl} ||
kernel vmlinuz ip=dhcp boot=casper netboot=nfs nfsroot=${dhcp-server}:/srv/mounts/${iso}/ -- ${kernelparams}
initrd initrd
boot

View File

@ -0,0 +1 @@
../../mounts/xubuntu-20.04-desktop-amd64.iso/casper/initrd

View File

@ -0,0 +1 @@
005a9450d16fe885132be9368a96c73910096b57cc1a67f03a97fca7af95f4a3 xubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../../mounts/xubuntu-20.04-desktop-amd64.iso/.disk/info

View File

@ -0,0 +1 @@
http://cdimage.ubuntu.com/xubuntu/releases/20.04/release/xubuntu-20.04-desktop-amd64.iso

View File

@ -0,0 +1 @@
../default_preseed.txt

View File

@ -0,0 +1 @@
../../mounts/xubuntu-20.04-desktop-amd64.iso/casper/vmlinuz