diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d87cdfd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.run_last
+backup.tar.xz
diff --git a/README.md b/README.md
index 01c13c1..154dd6b 100644
--- a/README.md
+++ b/README.md
@@ -1,30 +1,34 @@
# install-pxe-server
-setup a Raspberry Pi as an PXE-Server.
+setup a Raspberry Pi as a PXE-Server.
+it is a private project i have made for myself.
+i did not keep an eye on network security.
-it is a private project i have made for myself.
-
-i did not keeped an eye on network security.
+**the script will override some existing configurations**
+(a backup of the changed configuration files will be stored to **backup.tar.xz** in the script folder)
+(to extract all versions of all files to /tmp: `tar --backup=numbered -xavf backup.tar.xz -C /tmp`, some files will be hidden)
**USE IT AT YOUR OWN RISK.**
## what is it good for?
-the scripts installs necessary packages to let your RPi act as a DHCP, TFTP, Samba, NFS, PXE server.
+the scripts installs necessary packages to let your RPi act as a DHCP, TFTP, Samba, NFS, HTML, NTP, VBLADE, PXE server.
and it will download LiveDVD ISOs you can boot your PXE client (Desktop PC) to.
-the script can easely be modified to add additional ISOs or update ISOs if updated ones are available.
+the script can easily be modified to add additional ISOs or update ISOs if updated ones are available.
it also is able to act as server for NETWORK BOOTING for a Raspberry Pi 3 (see **note4**)
+**Please give me a '_Star_', if you find that project useful.**
+
### overview schematic:
```
╔══════════╗ ╔═══╗ ╔══════╗╔═════════╗
WAN───╢DSL router╟───╢ s ║ ║RPi- ╠╣USB-stick║
╚══════════╝ ║ w ║ ║PXE- ║╚═════════╝
- ║ i ║ ║server║
- ╔══════╗ ║ t ╟───eth0╢ ║
- ║ RPi3 ╟──────╢ c ║ ║ ║
- ╚══════╝ ┌──╢ h ╟──┐ ║ ║
- │ ╚═══╝ │ ╚══════╝
+ ║ i ║ ║server║ ╔═══════════════════════╗
+ ╔══════╗ ║ t ╟───eth0╢──┬───╟wlan0───╢ PC4 IP:192.168.251.100║
+ ║ RPi3 ╟──────╢ c ║ ║ │NAT║ ╔╩══════════════════════╗╝
+ ╚══════╝ ┌──╢ h ╟──┐ ║ └───╟eth1───╢ PC3 IP:192.168.250.100║
+ │ ╚═══╝ │ ╚══════╝ ╚═══════════════════════╝
╔══╧══╗ ╔══╧══╗
║ PC1 ║ ║ PC2 ║
╚═════╝ ╚═════╝
@@ -34,27 +38,31 @@ WAN───╢DSL router╟───╢ s ║ ║RPi- ╠╣USB-stick║
### hardware:
- Raspberry Pi (with LAN)
- SD card (big enough to hold entire ISO images of desired Live DVDs), (e.g. 64GByte)
-- USB memory stick (for preloaded iso images), (e.g. 64GByte)
+- USB memory stick (optional, to store preloaded iso images), (e.g. 64GByte)
- working network environment with a connection to internet
+- optional: second Ethernet interface (via USB)
+- optional: built-in WLAN interface (as that one of RPi3, or an external one via USB)
-optional, if your SD card is too small or you dont want to have all the server content on the SD card, you can use the USB memory stick to hold all content. for that you have to do small tiny changes on the scripts.
+optional, if your SD card is too small or you don't want to have all the server content on the SD card, you can use the USB memory stick to hold all content. for that you have to do small tiny changes on the '**p2-include-var-sh**' script, by changing '**DST_ROOT=/srv**' to something else.
### software:
-- **Raspbian Stretch** or **Raspbina Stretch Lite** (2017-08-16), https://www.raspberrypi.org/downloads/raspbian/)
+- **Raspberry Pi OS Bullseye** or **Raspberry Pi OS Bullseye Lite**, https://www.raspberrypi.org/downloads/raspbian/)
## installation:
assuming,
-- your Raspberry Pi is running Raspbian Stretch (or Lite) from 2017-08-16,
+- your Raspberry Pi is running Raspberry Pi OS Bullseye (or Lite),
- and has a proper connection to the internet via LAN (eth0).
-- and your SD card can hold all the iso images (41GB when you use unmodified script),
-- and you have plugged an USB-memory-stick that has the has a label **PXE-Server**
-- and the folowing folder structure on the USB memory stick:
+- and your SD card can hold all the iso images (16GB when you use unmodified script)
+
+and optional:
+- you have plugged an USB-memory-stick that is mounted at /media/server (SRC_MOUNT=/media/server)
+- and the following folder structure on the USB memory stick:
```
└── backup
├── img
└── iso
-
+
mkdir -p /backup/img
mkdir -p /backup/iso
```
@@ -64,158 +72,235 @@ optional structure for win-pe pxe boot
└── backup
└── tftp
- ├── boot
- └── efi
+ ├── Boot
+ └── EFI
-mkdir -p /backup/tftp/boot
-mkdir -p /backup/tftp/efi
+mkdir -p /backup/tftp/Boot
+mkdir -p /backup/tftp/EFI
```
replace **** with the path, where you mounted your USB stick.
-1. run `bash install-pxe-server_pass1.sh` to install necessary packages
+1. run `bash run.sh` the first time, to install necessary packages
(use **_bash_** and do not run it from **_sudo_**)
2. reboot your RPi with `sudo reboot`
-3. run `bash install-pxe-server_pass2.sh` to copy/download iso images of LiveDVDs, mount and export them and setup PXE menu according installed images.
-(use **_bash_** and do not run it from **_sudo_**)
+3. run `bash run.sh` the second time to setup everything required for PXE server.
4. reboot your RPi with `sudo reboot`
+5. run `bash run.sh` the third time to copy/download iso images of LiveDVDs, mount and export them and setup PXE menu according installed images.
+6. reboot your RPi with `sudo reboot`
done.
## update:
-to update your images, update the url in the **install-pxe-server_pass2.sh** file and re-run `bash install-pxe-server_pass2.sh`.
-this will download all updated iso files.
+to update your images, update the url in the **p2-include-url** and **c2-custom-url** file
+and re-run `bash run.sh`.
+this will download all updated iso files and menu entries.
## modifying the script:
-what you should know, when you make modification to the script...
-there are three importent locations for the pxe boot and the pxe menu that must fit. otherwise the pxe menu and the following boot process can not find required files.
-1. the ISO or NSF path relative to the TFTP root path.
-(on disk `/srv/tftp/iso`, `/srv/tftp/nfs` as symbolik link).
-2. the ISO or NFS path relative to the pxe boot menu root path
+### p2-include-var / c2-custom-var
+includes all important variables like source and destination directories, ip-addresses, and so on.
+e.g.: by changing '**DST_ROOT=/srv**' you can tell the script to download and store all iso to an external storage, instead of storing to the internal SD card.
+
+### p2-include-url / c2-custom-url
+includes all url and name of images
+```
+e.g.
+DEBIAN_X64=debian-x64
+DEBIAN_X64_URL=https://...
+```
+
+### p2-include-menu / c2-custom-menu
+includes all pxe-menu entries and kernel parameters
+in the script, for each image there is a pxe-menu entry enclosed by
+`#========== BEGIN ==========`
+and
+`#=========== END ===========`
+comments.
+
+### p2-include-handle / c2-custom-handle
+includes all handler to control what image to download and expose to the pxe-server
+if you don't want some iso images getting downloaded and mounted, you can disable images from handling '#'.
+or '-' to uninstall the previous downloaded image and undo all mounting stuff for that image to free disk space.
+e.g.:
+```
+handle_item '+' iso UBUNTU_X64;
+handle_item '-' iso UBUNTU_LTS_X64;
+handle_item '#' iso UBUNTU_DAILY_X64 timestamping;
+...
+```
+**_action:_**
+
+ **'+'** = add image to PXE service
+ download if not there
+ update if new version is available
+
+ **'-'** = remove image from PXE service
+ free resources on server
+ if backup exist, keep updating backup
+
+ **'#'** = skip image handling
+ keep everything untouched
+ does not updating backup
+ good, when timestamping option is set but want to keep the current version and you don't want to download each daily update
+
+**_type:_**
+
+ **iso** = iso image (ISO, UDF, ISO_HYBRID)
+
+ **img** = hard drive image (MPT, GPT)
+
+ **kernel** = kernel
+
+ **zip_img** = zip file containing a hard drive image (zip -> img -> MTP/GPT)
+
+ **rpi_pxe** = only if you want to pxe boot a RPi3.
+ copies files from its selected image boot & root partition to PXE server directories
+ requires an already mounted hard drive image (img or zip_img)
+ note: Action '-' does nothing for rpi_pxe. It is not implemented.
+ You have to free resources for rpi_pxe by hand
+
+note:
+ do not put the $ in fornt of the VARIABLE name !!!
+ the handle_item functions do need the NAME of the VARIABLE (without _URL)
+
+## what else you should know, when you make modification to the script...
+there are three important locations for the pxe boot and the pxe menu that must fit. otherwise the pxe menu and the following boot process can not find required files.
+1. the ISO or NFS path relative to the pxe boot menu root path
(on disk `/srv/tftp/menu-bios/iso`, `/srv/tftp/menu-bios/iso` as symbolic link).
-3. the ISO or NFS path repative to the nfs root path
+2. the ISO or NFS path relative to the nfs root path
(on disk `/srv/iso`, `/srv/nfs`).
+3. the ISO, IMG or NFS path located at /var/www/html
+(on disk `/var/www/html/srv/iso`, `/var/www/html/srv/img`, `/var/www/html/srv/nfs`).
```
/
-└── srv
- ├── iso (the real physical location of ISO files)
- ├── nfs (the real physical location of NFS files or mountpoints)
- |
- └── tftp (TFTP root)
- ├── iso (only a symbolic link to ISO files)
- ├── nfs (only a symbolic link to NFS files)
- |
- └── menu-bios (PXE boot menu root for BIOS)
- ├── iso (only a symbolic link to ISO files)
- └── nfs (only a symbolic link to NFS files)
-```
-if you make any changes to your script and/or file stcructure on disk, keep an eye to changes you made and adapt everything to match
+├── srv
+| ├── img (the real physical location of IMG files)
+| ├── iso (the real physical location of ISO files)
+| ├── nfs (the real physical location of NFS files or mountpoints)
+| |
+| └── tftp (TFTP root)
+| |
+| └── menu-bios (PXE boot menu root for BIOS)
+| ├── iso (only a symbolic link to ISO files)
+| └── nfs (only a symbolic link to NFS files)
+|
+└── var
+ └── www
+ └── html (HTML root)
+ └── srv (only a symbolic link to /srv)
+ ├── img (only a symbolic link to IMG files)
+ ├── iso (only a symbolic link to ISO files)
+ └── nfs (only a symbolic link to NFS files)
+```
+
+if you make any changes to your script and/or file structure on disk, keep an eye to changes you made and adapt everything to match
pxe menu entries to file structure on disk.
what the root of TFTP and PXE boot menu are, is defined in the **_dnsmasq_** configuration file `/etc/dnsmasq.d/pxe-server`.
-the root for NFS are defined in `/etc/exports`.
-
-
-## note:
-the script will copy/download/mount following ISOs:
-```
-win-pe-x86.iso # Microsoft Windows PE, can not be downloaded, you have to create by yourself
-ubuntu-lts-x64.iso # Ubuntu LTS
-ubuntu-lts-x86.iso
-ubuntu-x64.iso # Ubuntu
-ubuntu-x86.iso
-ubuntu-nopae.iso # an old Ubuntu with non-PAE for old PCs
-debian-x64.iso # Debian
-debian-x86.iso
-gnuradio-x64.iso # GNU Radio
-deft-x64.iso # DEFT
-kali-x64.iso # Kali Linux
-pentoo-x64.iso # Pentoo Linux
-systemrescue-x86.iso # System Rescue
-desinfect-x86.iso # c't desinfect, is not downloadable, you have to get by yourself
-tinycore-x86.iso # tiny core ~16MB minimal linux.
-tinycore-x64.iso # tiny core ~16MB minimal linux.
-rpdesktop-x86.iso # Raspberry Pi Desktop for x86 PC
-clonezilla-x64.iso # clonezilla
-clonezilla-x86.iso
-```
-
-the following url files will contain the url of the iso image, where to download, to compare if you have the requested iso already downloaded, to prevent downloading an iso newly, when it is done already.
-```
-win-pe-x86.url
-ubuntu-lts-x64.url
-ubuntu-lts-x86.url
-ubuntu-x64.url
-ubuntu-x86.url
-ubuntu-nopae.url
-debian-x64.url
-debian-x86.url
-gnuradio-x64.url
-deft-x64.url
-kali-x64.url
-pentoo-x64.url
-systemrescue-x86.url
-desinfect-x86.url
-tinycore-x86.url
-tinycore-x64.url
-rpdesktop-x86.url
-clonezilla-x64.url
-clonezilla-x86.url
-```
-
-there is a complete new section, that contains download url for disk images, that contains partitions.
+the root for NFS is defined in `/etc/exports`.
+the root for HTML is defined in the **_lighttpd_** configuration file `/etc/lighttpd/lighttpd.conf`.
+## mount scenarios for pxe boot:
+### direct read-only mounting content of ISO:
+e.g. ubuntu-lts-x64 iso image
+no problems. pxe boot job can access to required content.
```
-e.g.
-RPD_LITE=rpi-raspbian-lite
-RPD_LITE_URL=https://.../...zip
-```
-
-**if you don't want some iso images getting downloaded and mounted, you can comment out lines
-e.g.:**
-```
-######################################################################
-# handle_iso $WIN_PE_X86 $WIN_PE_X86_URL;
-# handle_iso $UBUNTU_LTS_X64 $UBUNTU_LTS_X64_URL;
-# handle_iso $UBUNTU_LTS_X86 $UBUNTU_LTS_X86_URL;
-# handle_iso $UBUNTU_X64 $UBUNTU_X64_URL;
-# handle_iso $UBUNTU_X86 $UBUNTU_X86_URL;
-# handle_iso $UBUNTU_NONPAE $UBUNTU_NONPAE_URL;
-# handle_iso $DEBIAN_X64 $DEBIAN_X64_URL;
-# handle_iso $DEBIAN_X86 $DEBIAN_X86_URL;
-# handle_iso $GNURADIO_X64 $GNURADIO_X64_URL;
-# handle_iso $DEFT_X64 $DEFT_X64_URL;
-# handle_iso $KALI_X64 $KALI_X64_URL;
-# handle_iso $PENTOO_X64 $PENTOO_X64_URL;
-# handle_iso $SYSTEMRESCTUE_X86 $SYSTEMRESCTUE_X86_URL;
-# handle_iso $DESINFECT_X86 $DESINFECT_X86_URL;
-handle_iso $TINYCORE_x64 $TINYCORE_x64_URL;
-handle_iso $TINYCORE_x86 $TINYCORE_x86_URL;
-handle_iso $RPDESKTOP_X86 $RPDESKTOP_X86_URL;
-...
+╔═════════════╗
+║iso-file ║
+║ ║
+║ ┌───────────╨─┐
+║ │mount loop │
+║ │ │
+║ │ ├───┤nfs*
+║ │ │
+║ └───────────╥─┘
+╚═════════════╝
```
-**same procedure, if you dont want some disk images getting downloaded and mountet, you can comment out those lines
-e.g.:**
+### mounting content of disk image and make content read/writable by overlayfs:
+e.g. rpi-raspbian-full
+this disk image contains two partitions. the first is the boot partition and the second is the root partition.
+to make the images read/writable, there is an overlayfs putted on top.
+(lowerdir is the read-only source, upperdir is the writable difference, workdir is an temporarily workfolder for internal use. the mergeddir is the sum of lower + upper. write access happens only on the upperdir with white-out and write-on-modify capability)
+but unfortunately overlayfs can't get exported directly for nfs. so putting a bindfs on top of the overlayfs makes it possible to get exported for nfs.
+and another issue is, overlayfs can't handle **vfat** partitions as source (lowerdir). putting bindfs between makes overlayfs happy.
+**note: this overlayfs+bindfs construction does NOT work reliably - data loss!**
```
-######################################################################
-handle_zip_img $RPD_LITE $RPD_LITE_URL;
-# handle_zip_img $RPD_FULL $RPD_FULL_URL;
+╔═════════════╗
+║img-file ║
+║ ║
+║ ┌───────────╨─┐ ┌─────────────┐ ┌─────────────────┐ ┌─────────────┐
+║ │mount loop │ │mount bindfs │ │mount overlayfs │ │mount bindfs │
+║ │ vfat │ │ prepare to │ ├───────┐ ┌───────┴─┐ │ prepage to │
+║ │ boot ├─┼ overlayfs ├─┼ lower │ │merged ├─┼ export nfs ├───┤nfs*
+║ │ │ └─────────────┘ ├───────┘ └───────┬─┘ └─────────────┘
+║ │ │ │ ┌───────┴─┐
+║ │ vfat │ │ │upper ├─┤diff*
+║ │ can't be │ │can't be └───────┬─┘
+║ │ handled │ │handled ┌───────┴─┐
+║ │ by │ │by │work ├─┤tmp*
+║ │ overlayfs │ │exportfs └───────┬─┘
+║ └───────────╥─┘ └─────────────────┘
+║ ┌───────────╨─┐ ┌─────────────────┐ ┌─────────────┐
+║ │mount loop │ │mount overlayfs │ │mount bindfs │
+║ │ ext4 │ ├───────┐ ┌───────┴─┐ │ prepare to │
+║ │ root ├─────────────────┼ lower │ │merged ├─┼ export nfs ├───┤nfs*
+║ │ │ ├───────┘ └───────┬─┘ └─────────────┘
+║ │ │ │ ┌───────┴─┐
+║ │ │ │ │upper ├─┤diff*
+║ │ │ │can't be └───────┬─┘
+║ │ │ │handled ┌───────┴─┐
+║ │ │ │by │work ├─┤tmp*
+║ │ │ │exportfs └───────┬─┘
+║ └───────────╥─┘ └─────────────────┘
+╚═════════════╝
```
## note2:
-some of the PXE-menu entries has additional parameters, that lets the Live systems boot with german language (keyboard layout).
-if you dont like or want, remove those additional parameters just behind the ' --' in the menu entries
+some of the PXE-menu entries has additional parameters, that lets the Live systems boot with German language (keyboard layout).
+if you don't like or want, remove those additional parameters just behind the ' --' in the menu entries
+
+to easily change the language to your favorite ones, there are variables in the **c2-custom-var** file to set those variables with your values.
+```
+CUSTOM_COUNTRY=DE
+CUSTOM_KEYMAP=de-latin1-nodeadkeys
+CUSTOM_KMAP=qwertz/de-latin1
+CUSTOM_LANGUAGE=de
+CUSTOM_LAYOUTCODE=de
+CUSTOM_LOCALE=de_DE.UTF-8
+CUSTOM_TIMEZONE=Europe/Berlin
+CUSTOM_VARIANT=German
+```
## note3:
-it is prepared for BIOS, UEFI 32bit and UEFI 64bit boot, but UEFI is not tested yet, because of lack of hardware for UEFI boot
+it is prepared for BIOS, UEFI 32bit and UEFI 64bit boot, but UEFI is not tested yet by me, because of lack of hardware for UEFI boot.
+IPv4 UEFI 64bit boot with SecureBoot enabled is tested and working on my computer (with Asus board and latest Fedora, Debian and Ubuntu distro).
+but tested with an other computer it wont work - it depends on the UEFI firmware.
-## note4: NETWORK BOOTING for Raspberry Pi 3
-the server is prepared for to boot a Raspberry Pi 3 via network.
-in the script ```install-pxe-server_pass2.sh```, there is a ```RPI_SN=12345678``` line, change the ```12345678``` to the serial number of the RPi3, that will boot from network. if you have more than one RPi3 for network booting you have to add them by hand to the ```/srv/tftp``` folder.
+## note4: NETWORK BOOTING for Raspberry Pi 3 client
+the server is prepared for to boot a Raspberry Pi 3 client via network.
+in the script ```p2-include-var```, there is a ```RPI_SN0=--------``` line, change the ```--------``` to the serial number of the RPi3-**client**, that will boot from network later on.
+skip the leading '00000000'. take only the last 8 digits!
+e.g.
+```
+pi@raspberry-$ cat /proc/cpuinfo | grep Serial
+Serial : 0000000087654321
+```
+then take ```RPI_SN0=87654321```.
+if you have more than one RPi3-client for network booting you have to add them by hand to the ```/srv/tftp``` folder on the PXE-server.
-the script will download Raspbian-Stretch-Lite and prepare it for the RPi3 with the given serial number.
+the script will download Raspberry Pi OS Lite and prepare it for the RPi3-client with the given serial number.
-by default, a RPi3 is not enabled for network booting. you have to enable it once.
+by default, a RPi3-client is not enabled for network booting. you have to enable it once.
for more information,
see: [Network Booting](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net.md)
see: [Network Boot Your Raspberry Pi](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net_tutorial.md)
+
+## note4:
+optional use alterative wifi firmware: `sudo update-alternatives --config cyfmac43455-sdio.bin`
+
+The file cyfmac43455-sdio-minimal.bin is an alternative firmware that has been
+tuned to maximise the number of clients in AP mode while still supporting STA
+mode.
+
+see: [cyfmac43455-sdio-minimal.bin, Bullseye](https://github.com/RPi-Distro/firmware-nonfree/tree/bullseye/debian/config/brcm80211/cypress)
+see: [cyfmac43455-sdio-minimal.bin, Bookworm](https://github.com/RPi-Distro/firmware-nonfree/tree/bookworm/debian/config/brcm80211/cypress)
diff --git a/c2-custom-handle b/c2-custom-handle
new file mode 100644
index 0000000..aae43af
--- /dev/null
+++ b/c2-custom-handle
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+# Add your custom entries to this file.
+#
+# Example:
+# handle_item '+' iso CUSTOM_ENTRY1;
+# handle_item '+' iso CUSTOM_ENTRY2;
+#
+# Ensure your CUSTOM_ENTRY name is unique
+# and the same name as in c2-custom-url and c2-custom-menu
+
+
+########################################################################
+#
+# Action:
+# '+' = Add image to PXE service
+# Download if not there
+# Update if new version is available
+#
+# '-' = Remove image from PXE service
+# Free resources on server
+# If backup exist, keep updating backup
+#
+# '#' = Skip image handling
+# Keep everything untouched
+# Does not updating backup
+# Good, when timestamping option is set but want to keep the current version and you don't want to download each daily update
+#
+# Type:
+# iso = Iso image (ISO, UDF, ISO_HYBRID)
+#
+# img = Hard drive image (MPT, GPT)
+#
+# kernel = Kernel
+#
+# zip_img = Zip file containing a hard drive image (zip -> img -> MTP/GPT)
+#
+# rpi_pxe = Only if you want to pxe boot a RPi3.
+# Copies files from its selected image boot & root partition to PXE server directories
+# Requires an already mounted hard drive image (img or zip_img)
+# Note: Action '-' does nothing for rpi_pxe. It is not implemented.
+# You have to free resources for rpi_pxe by hand
+#
+#
+# Note:
+# Do not put the $ in fornt of the VARIABLE name !!!
+# the handle_item functions do need the NAME of the VARIABLE (without _URL)
+
+########################################################################
+##-----------+----+-----+------------------------+----------------------
+##exec |act.|type |VAR. name of item |optional options
+#handle_item '+' iso CUSTOM_ENTRY1 timestamping ,custom_fstab_options;
+#handle_item '+' iso CUSTOM_ENTRY2 ,custom_fstab_options vbladed 1 1;
diff --git a/c2-custom-menu b/c2-custom-menu
new file mode 100644
index 0000000..0e7b35a
--- /dev/null
+++ b/c2-custom-menu
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+# Add your custom entries to this file.
+#
+# Ensure your $CUSTOM_ENTRY name is unique
+# and the same name as in handle_custom and url_custom
+
+#========== BEGIN Example ==========
+# if [[ -f "$FILE_MENU" ]] \ # This line is needed on ALL entries
+# && [[ -f "$DST_ISO/$CUSTOM_ENTRY.iso" ]]; then # This file may be the iso itself, or any file in the iso. It just verifies the file exists
+# echo -e "\e[36m add $CUSTOM_ENTRY\e[0m"; # Use your $custom_entry name
+# cat << EOF | sudo tee -a $FILE_MENU &>/dev/null # This line is needed on ALL entries
+# ########################################
+# LABEL $CUSTOM_ENTRY # This is best to use your $CUSTOM_ENTRY name, but can be any unique name with no whitespace
+# MENU LABEL My Customized Linux x64 # This can be anything. This is what will be displayed on the Menu
+# KERNEL $FILE_BASE$NFS_ETH0/$CUSTOM_ENTRY/live/vmlinuz-5.7.7 # This entry and entries below are what loads the OS. You'll have to determine these yourself
+# INITRD $FILE_BASE$NFS_ETH0/$CUSTOM_ENTRY/live/initrd-5.7.7.lz # Look at other entries in the main p2-include-menu for a similar distro and try those/similar settings
+# APPEND nfsroot=$IP_ETH0:$DST_NFS_ETH0/$CUSTOM_ENTRY ro netboot=nfs ip=dhcp boot=live union=overlay livecd-installer console=tty splash --
+# TEXT HELP
+# Boot into My Custom Linux version x64 # This can be anything. This is what will be displayed when the menu entry is selected
+# ENDTEXT
+# EOF
+# fi
+#=========== END Example===========
diff --git a/c2-custom-url b/c2-custom-url
new file mode 100644
index 0000000..2cf49e5
--- /dev/null
+++ b/c2-custom-url
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+# Add your custom entry URLs to this file
+#
+# Example:
+# CUSTOM_ENTRY1=my-custom-linux-x64
+# CUSTOM_ENTRY1_URL=https://isos.my-live-os.org/my_customized_linux-super-cool.iso
+# CUSTOM_ENTRY1_SUM=https://isos.my-live-os.org/my_customized_linux-super-cool.sum
+# CUSTOM_ENTRY1_SUM_TYPE=sha256
+#
+# For local files, use the full path starting from the root directory - /
+# Example:
+# CUSTOM_ENTRY2=my-custom-linux-x64
+# CUSTOM_ENTRY2_URL=/home/pi/Downloads/my_customized_linux-super-cool.iso
+# CUSTOM_ENTRY2_SUM=/home/pi/Downloads/my_customized_linux-super-cool.sum
+# CUSTOM_ENTRY2_SUM_TYPE=sha256
+#
+# Note:
+# ..._SUM= Optional. Url to a file that contains somewhere the hash value of the image file
+# ..._SUM_TYPE= Optional. Hash function used to calculate the hash value of the image file
+#
+# Ensure your CUSTOM_ENTRY name is unique
+# and the same name as in c2-custom-handle and c2-custom-menu
diff --git a/c2-custom-var b/c2-custom-var
new file mode 100644
index 0000000..cd6bb38
--- /dev/null
+++ b/c2-custom-var
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+# Add your custom entries to this file.
+#
+# You can override existing variables here:
+# Example:
+# CUSTOM_COUNTRY=DE
+# CUSTOM_KEYMAP=de-latin1-nodeadkeys
+# CUSTOM_KMAP=qwertz/de-latin1
+# CUSTOM_LANGUAGE=de
+# CUSTOM_LAYOUTCODE=de
+# CUSTOM_LOCALE=de_DE.UTF-8
+# CUSTOM_TIMEZONE=Europe/Berlin
+# CUSTOM_VARIANT=German
+#
+# Or add additional variables you want to use in your other custom files e.g.: c2-custom-menu
+# Example:
+# MY_CUSTOM_VARIABLE=my custom value
diff --git a/install-pxe-server_pass1.sh b/install-pxe-server_pass1.sh
deleted file mode 100644
index a3c5905..0000000
--- a/install-pxe-server_pass1.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/bash
-
-######################################################################
-#
-# v2017-11-28
-#
-# known issues:
-#
-
-#bridge#
-
-
-######################################################################
-echo -e "\e[32msetup variables\e[0m";
-SRC_MOUNT=/media/server
-
-
-######################################################################
-## optional
-grep mod_install_server /etc/fstab > /dev/null || ( \
-echo -e "\e[32madd usb-stick to fstab\e[0m";
-[ -d "$SRC_MOUNT/" ] || sudo mkdir -p $SRC_MOUNT;
-sudo sh -c "echo '
-## mod_install_server
-LABEL=PXE-Server $SRC_MOUNT auto noatime,nofail,auto,x-systemd.automount,x-systemd.device-timeout=5,x-systemd.mount-timeout=5 0 0
-' >> /etc/fstab"
-sudo mount -a;
-)
-
-
-######################################################################
-grep -q max_loop /boot/cmdline.txt 2> /dev/null || {
- echo -e "\e[32msetup cmdline.txt for more loop devices\e[0m";
- sudo sed -i '1 s/$/ max_loop=64/' /boot/cmdline.txt;
-}
-
-
-######################################################################
-grep -q net.ifnames /boot/cmdline.txt 2> /dev/null || {
- echo -e "\e[32msetup cmdline.txt for old style network interface names\e[0m";
- sudo sed -i '1 s/$/ net.ifnames=0/' /boot/cmdline.txt;
-}
-
-
-######################################################################
-sudo sync \
-&& echo -e "\e[32mupdate...\e[0m" && sudo apt-get -y update \
-&& echo -e "\e[32mupgrade...\e[0m" && sudo apt-get -y upgrade \
-&& echo -e "\e[32mautoremove...\e[0m" && sudo apt-get -y --purge autoremove \
-&& echo -e "\e[32mautoclean...\e[0m" && sudo apt-get autoclean \
-&& echo -e "\e[32mDone.\e[0m" \
-&& sudo sync
-
-
-######################################################################
-echo -e "\e[32minstall nfs-kernel-server for pxe\e[0m";
-sudo apt-get -y install nfs-kernel-server;
-sudo systemctl enable nfs-kernel-server.service;
-sudo systemctl restart nfs-kernel-server.service;
-
-######################################################################
-echo -e "\e[32menable port mapping\e[0m";
-sudo systemctl enable rpcbind.service;
-sudo systemctl restart rpcbind.service;
-
-
-######################################################################
-echo -e "\e[32minstall dnsmasq for pxe\e[0m";
-sudo apt-get -y install dnsmasq
-sudo systemctl enable dnsmasq.service;
-sudo systemctl restart dnsmasq.service;
-
-
-######################################################################
-echo -e "\e[32minstall samba\e[0m";
-sudo apt-get -y install samba;
-
-
-######################################################################
-echo -e "\e[32minstall rsync\e[0m";
-sudo apt-get -y install rsync;
-
-
-######################################################################
-echo -e "\e[32minstall syslinux-common for pxe\e[0m";
-sudo apt-get -y install pxelinux syslinux-common;
-
-
-######################################################################
-#bridge#echo -e "\e[32minstall network bridge\e[0m";
-#bridge#sudo apt-get -y install bridge-utils hostapd dnsmasq iptables iptables-persistent
-
-
-######################################################################
-## optional
-#bridge#echo -e "\e[32minstall wireshark\e[0m";
-#bridge#sudo apt-get -y install wireshark
-#bridge#sudo usermod -a -G wireshark $USER
-
-
-######################################################################
-sync
-echo -e "\e[32mDone.\e[0m";
-echo -e "\e[1;31mPlease reboot\e[0m";
diff --git a/install-pxe-server_pass2.sh b/install-pxe-server_pass2.sh
deleted file mode 100644
index c7b74f3..0000000
--- a/install-pxe-server_pass2.sh
+++ /dev/null
@@ -1,1357 +0,0 @@
-#!/bin/bash
-
-######################################################################
-# ubuntu, http://releases.ubuntu.com/
-# https://help.ubuntu.com/community/Installation/MinimalCD
-# debian, http://cdimage.debian.org/debian-cd/
-# gnuradio, https://wiki.gnuradio.org/index.php/GNU_Radio_Live_SDR_Environment
-# kali, http://www.kali.org/kali-linux-releases/
-# deft, http://www.deftlinux.net/
-# pentoo, http://www.pentoo.ch/download/
-# sysrescue, http://sourceforge.net/projects/systemrescuecd/ (http://www.sysresccd.org/Download/)
-# knoppix, http://www.knopper.net/knoppix-mirrors/index-en.html
-# tails https://tails.boum.org/install/download/openpgp/index.en.html
-# winpe, https://msdn.microsoft.com/en-us/windows/hardware/dn913721.aspx
-# nonpae, ftp://ftp.heise.de/pub/ct/projekte/ubuntu-nonpae/ubuntu-12.04.4-nonpae.iso
-# tinycore, http://tinycorelinux.net/downloads.html
-# rpdesktop, http://downloads.raspberrypi.org/rpd_x86/images/ (https://www.raspberrypi.org/blog/a-raspbian-desktop-update-with-some-new-programming-tools/)
-#
-# rpi-raspbian http://downloads.raspberrypi.org/raspbian/images/
-# piCore http://tinycorelinux.net/9.x/armv6/releases/RPi/
-# http://tinycorelinux.net/9.x/armv7/releases/RPi/
-# clonezilla http://clonezilla.org/
-#
-# v2017-12-01
-#
-# known issues:
-#
-
-#bridge#
-
-
-######################################################################
-echo -e "\e[36msetup variables\e[0m";
-
-######################################################################
-######################################################################
-## variables, you have to customize
-## e.g.:
-## RPI_SN0 : serial number
-## of the raspberry pi 3 for network booting
-## and other variables...
-######################################################################
-######################################################################
-RPI_SN0=12345678
-RPI_SN0_BOOT=rpi-$RPI_SN0-boot
-RPI_SN0_ROOT=rpi-$RPI_SN0-root
-######################################################################
-INTERFACE_ETH0=$(ls /sys/devices/platform/soc/*.usb/usb1/1-1/1-1.1/1-1.1:1.0/net)
-INTERFACE_BR0=br0
-######################################################################
-IP_ETH0=$(ip -4 address show dev $INTERFACE_ETH0 | grep -o -E '(([0-9]{1,3}[\.]){3}[0-9]{1,3})' | sed '1!d')
-IP_ETH0_=$(echo $IP_ETH0 | grep -E -o "([0-9]{1,3}[\.]){3}")
-IP_ETH0_0=$(echo $(echo $IP_ETH0_)0)
-IP_ETH0_START=$(echo $(echo $IP_ETH0_)200)
-IP_ETH0_END=$(echo $(echo $IP_ETH0_)250)
-IP_ETH0_ROUTER=$(echo $(ip rout show dev $INTERFACE_ETH0 | grep default | cut -d' ' -f3))
-IP_ETH0_DNS=$IP_ETH0_ROUTER
-IP_ETH0_MASK=255.255.255.0
-IP_BR0=192.168.250.1
-IP_BR0_START=192.168.250.200
-IP_BR0_END=192.168.250.250
-IP_BR0_MASK=255.255.255.0
-######################################################################
-ISO=/iso
-IMG=/img
-TFTP_ETH0=/tftp
-NFS_ETH0=/nfs
-SRC_MOUNT=/media/server
-SRC_BACKUP=$SRC_MOUNT/backup
-SRC_ISO=$SRC_BACKUP$ISO
-SRC_IMG=$SRC_BACKUP$IMG
-SRC_TFTP_ETH0=$SRC_BACKUP$TFTP_ETH0
-SRC_NFS_ETH0=$SRC_BACKUP$NFS_ETH0
-DST_ROOT=/srv
-DST_ISO=$DST_ROOT$ISO
-DST_IMG=$DST_ROOT$IMG
-DST_TFTP_ETH0=$DST_ROOT$TFTP_ETH0
-DST_NFS_ETH0=$DST_ROOT$NFS_ETH0
-######################################################################
-DST_PXE_BIOS=menu-bios
-DST_PXE_EFI32=menu-efi32
-DST_PXE_EFI64=menu-efi64
-
-
-echo
-echo -e "$INTERFACE_ETH0 \e[36mis used as primary networkadapter for PXE\e[0m";
-echo -e "$IP_ETH0 \e[36mis used as primary IP address for PXE\e[0m";
-echo -e "$RPI_SN0 \e[36mis used as SN for RPi3 network booting\e[0m";
-echo
-
-if [ "$IP_ETH0" == "" ]; then
- echo -e "\e[1;31mIP address not found. please check your ethernet cable.\e[0m";
- exit 1
-fi
-
-if [ "$IP_ETH0_ROUTER" == "" ]; then
- echo -e "\e[1;31mrouter IP address not found. please check your router settings.\e[0m";
- exit 1
-fi
-
-sudo umount -f $SRC_MOUNT
-sudo mount $SRC_MOUNT
-
-######################################################################
-######################################################################
-## url to iso images, with LiveDVD systems
-## note:
-## update the url, if iso is outdated
-######################################################################
-######################################################################
-WIN_PE_X86=win-pe-x86
-WIN_PE_X86_URL=
-
-UBUNTU_LTS_X64=ubuntu-lts-x64
-UBUNTU_LTS_X64_URL=http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso
-
-UBUNTU_LTS_X86=ubuntu-lts-x86
-UBUNTU_LTS_X86_URL=http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-i386.iso
-
-UBUNTU_X64=ubuntu-x64
-UBUNTU_X64_URL=http://releases.ubuntu.com/17.10/ubuntu-17.10-desktop-amd64.iso
-
-UBUNTU_X86=ubuntu-x86
-UBUNTU_X86_URL=http://releases.ubuntu.com/17.04/ubuntu-17.04-desktop-i386.iso
-
-UBUNTU_NONPAE=ubuntu-nopae
-UBUNTU_NONPAE_URL=
-
-DEBIAN_X64=debian-x64
-DEBIAN_X64_URL=http://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-9.2.0-amd64-lxde.iso
-
-DEBIAN_X86=debian-x86
-DEBIAN_X86_URL=http://cdimage.debian.org/debian-cd/current-live/i386/iso-hybrid/debian-live-9.2.0-i386-lxde.iso
-
-GNURADIO_X64=gnuradio-x64
-GNURADIO_X64_URL=http://s3-dist.gnuradio.org/ubuntu-16.04.2-desktop-amd64-gnuradio-3.7.11.iso
-
-DEFT_X64=deft-x64
-DEFT_X64_URL=http://na.mirror.garr.it/mirrors/deft/deft-8.2.iso
-
-KALI_X64=kali-x64
-KALI_X64_URL=http://cdimage.kali.org/kali-2017.3/kali-linux-2017.3-amd64.iso
-
-PENTOO_X64=pentoo-x64
-PENTOO_X64_URL=http://mirror.switch.ch/ftp/mirror/pentoo/Pentoo_amd64_default/pentoo-amd64-default-2015.0_RC5.iso
-
-SYSTEMRESCTUE_X86=systemrescue-x86
-SYSTEMRESCTUE_X86_URL=https://downloads.sourceforge.net/project/systemrescuecd/sysresccd-x86/5.1.2/systemrescuecd-x86-5.1.2.iso
-
-DESINFECT_X86=desinfect-x86
-DESINFECT_X86_URL=
-
-TINYCORE_x64=tinycore-x64
-TINYCORE_x64_URL=http://tinycorelinux.net/8.x/x86_64/release/TinyCorePure64-8.2.1.iso
-
-TINYCORE_x86=tinycore-x86
-TINYCORE_x86_URL=http://tinycorelinux.net/8.x/x86/release/TinyCore-8.2.1.iso
-
-RPDESKTOP_X86=rpdesktop-x86
-RPDESKTOP_X86_URL=https://downloads.raspberrypi.org/rpd_x86/images/rpd_x86-2017-12-01/2017-11-16-rpd-x86-stretch.iso
-
-CLONEZILLA_X64=clonezilla-x64
-CLONEZILLA_X64_URL=https://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable/2.5.2-31/clonezilla-live-2.5.2-31-amd64.iso
-
-CLONEZILLA_X86=clonezilla-x86
-CLONEZILLA_X86_URL=https://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable/2.5.2-31/clonezilla-live-2.5.2-31-i686.iso
-
-FEDORA_X64=fedora-x64
-FEDORA_X64_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/26/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-26-1.5.iso
-
-TAILS_X64=tails-x64
-TAILS_X64_URL=https://mirrors.kernel.org/tails/stable/tails-amd64-3.3/tails-amd64-3.3.iso
-
-
-######################################################################
-######################################################################
-## url to zip files,
-## that contains disk images
-## for raspbarry pi 3 network booting
-## note:
-## update the url, if disk image is outdated
-######################################################################
-######################################################################
-PI_CORE=pi-core
-PI_CORE_URL=http://tinycorelinux.net/9.x/armv7/releases/RPi/piCore-9.0.3.zip
-
-RPD_LITE=rpi-raspbian-lite
-RPD_LITE_URL=https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-12-01/2017-11-29-raspbian-stretch-lite.zip
-
-RPD_FULL=rpi-raspbian-full
-RPD_FULL_URL=https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-12-01/2017-11-29-raspbian-stretch.zip
-
-
-######################################################################
-handle_dhcpcd() {
- echo -e "\e[32mhandle_dhcpcd()\e[0m";
-
- ######################################################################
- if grep -q stretch /etc/*-release; then
- echo -e "\e[36m a stretch os detected\e[0m";
- ######################################################################
- grep -q $INTERFACE_ETH0 /etc/dhcpcd.conf || {
- echo -e "\e[36m setup dhcpcd.conf\e[0m";
- sudo sh -c "cat << EOF >> /etc/dhcpcd.conf
-########################################
-## mod_install_server
-interface $INTERFACE_ETH0
-static ip_address=$IP_ETH0/24
-static routers=$IP_ETH0_ROUTER
-static domain_name_servers=$IP_ETH0_ROUTER
-EOF";
- sudo systemctl daemon-reload;
- sudo systemctl restart dhcpcd.service;
- }
- else
- echo -e "\e[36m a non-stretch os detected\e[0m";
- ######################################################################
- grep -q mod_install_server /etc/network/interfaces || {
- echo -e "\e[36m setup networking, disable dhcpcd\e[0m";
- sudo sh -c "cat << EOF > /etc/network/interfaces
-########################################
-# interfaces(5) file used by ifup(8) and ifdown(8)
-
-# Please note that this file is written to be used with dhcpcd
-# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
-
-# Include files from /etc/network/interfaces.d:
-source-directory /etc/network/interfaces.d
-
-auto lo
-iface lo inet loopback
-
-allow-hotplug wlan0
-iface wlan0 inet manual
- wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
-
-allow-hotplug wlan1
-iface wlan1 inet manual
- wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
-
-## mod_install_server
-auto $INTERFACE_ETH0
-iface $INTERFACE_ETH0 inet static
- address $IP_ETH0
- netmask $IP_ETH0_MASK
- gateway $IP_ETH0_ROUTER
-
-#bridge#auto eth1
-#bridge#iface eth1 inet static
-#bridge# hwaddress 88:88:88:11:11:11
-#bridge# address 169.254.11.11
-#bridge# netmask 255.255.0.0
-#bridge#
-#bridge#auto br0
-#bridge#iface br0 inet static
-#bridge# bridge_ports eth1 wlan0 wlan1
-#bridge# hwaddress 88:88:88:88:88:88
-#bridge# address $IP_BR0
-#bridge# netmask $IP_BR0_MASK
-#bridge# bridge_stp off # disable Spanning Tree Protocol
-#bridge# bridge_waitport 0 # no delay before a port becomes available
-#bridge# bridge_fd 0 # no forwarding delay
-EOF";
-
- echo "nameserver $IP_ETH0_DNS" | sudo tee -a /etc/resolv.conf
- sudo chattr +i /etc/resolv.conf
- sudo rm /etc/resolvconf/update.d/dnsmasq
- sudo systemctl disable dhcpcd.service;
- sudo systemctl enable networking.service;
- }
- fi
-}
-
-
-######################################################################
-handle_dnsmasq() {
- echo -e "\e[32mhandle_dnsmasq()\e[0m";
-
- ######################################################################
- [ -f /etc/dnsmasq.d/pxe-server ] || {
- echo -e "\e[36m setup dnsmasq for pxe\e[0m";
- sudo sh -c "cat << EOF >> /etc/dnsmasq.d/pxe-server
-########################################
-#/etc/dnsmasq.d/pxeboot
-
-## mod_install_server
-
-log-dhcp
-log-queries
-
-# interface selection
-interface=$INTERFACE_ETH0
-#bridge#interface=$INTERFACE_BR0
-
-# TFTP_ETH0 (enabled)
-enable-tftp
-tftp-lowercase
-tftp-root=$DST_TFTP_ETH0/, $INTERFACE_ETH0
-#bridge#tftp-root=$DST_TFTP_ETH0_BR0/, $INTERFACE_BR0
-
-# DHCP
-# do not give IPs that are in pool of DSL routers DHCP
-dhcp-range=$INTERFACE_ETH0, $IP_ETH0_START, $IP_ETH0_END, 24h
-#bridge#dhcp-range=$INTERFACE_BR0, $IP_BR0_START, $IP_BR0_END, 24h
-dhcp-option=$INTERFACE_ETH0, option:tftp-server, $IP_ETH0
-#bridge#dhcp-option=$INTERFACE_BR0, option:tftp-server, $IP_BR0
-
-# DNS (enabled)
-port=53
-dns-loop-detect
-
-# PXE (enabled)
-# warning: unfortunately, a RPi3 identifies itself as of architecture x86PC (x86PC=0)
-# luckily the RPi3 seems to use always the same UUID 44444444-4444-4444-4444-444444444444
-dhcp-match=set:UUID_RPI3, option:client-machine-id, 00:44:44:44:44:44:44:44:44:44:44:44:44:44:44:44:44
-dhcp-match=set:ARCH_0, option:client-arch, 0
-dhcp-match=set:x86_UEFI, option:client-arch, 6
-dhcp-match=set:x64_UEFI, option:client-arch, 7
-dhcp-match=set:x64_UEFI, option:client-arch, 9
-
-# test if it is a RPi3 or a regular x86PC
-tag-if=set:ARM_RPI3, tag:ARCH_0, tag:UUID_RPI3
-tag-if=set:x86_BIOS, tag:ARCH_0, tag:!UUID_RPI3
-
-pxe-service=tag:ARM_RPI3,0, \"Raspberry Pi Boot \", bootcode.bin
-pxe-service=tag:x86_BIOS,x86PC, \"PXE Boot Menu (BIOS 00:00)\", $DST_PXE_BIOS/pxelinux
-pxe-service=6, \"PXE Boot Menu (UEFI 00:06)\", $DST_PXE_EFI32/syslinux
-pxe-service=x86-64_EFI, \"PXE Boot Menu (UEFI 00:07)\", $DST_PXE_EFI64/syslinux
-pxe-service=9, \"PXE Boot Menu (UEFI 00:09)\", $DST_PXE_EFI64/syslinux
-
-dhcp-boot=tag:ARM_RPI3, bootcode.bin
-dhcp-boot=tag:x86_BIOS, $DST_PXE_BIOS/pxelinux.0
-dhcp-boot=tag:x86_UEFI, $DST_PXE_EFI32/syslinux.0
-dhcp-boot=tag:x64_UEFI, $DST_PXE_EFI64/syslinux.0
-EOF";
- sudo systemctl restart dnsmasq.service;
- }
-}
-
-
-######################################################################
-handle_samba() {
- echo -e "\e[32mhandle_samba()\e[0m";
-
- ######################################################################
- grep -q mod_install_server /etc/samba/smb.conf 2> /dev/null || ( \
- echo -e "\e[36m setup samba\e[0m";
- sudo sed -i /etc/samba/smb.conf -n -e "1,/#======================= Share Definitions =======================/p";
- sudo sh -c "cat << EOF >> /etc/samba/smb.conf
-########################################
-## mod_install_server
-
-[srv]
- comment = /srv folder of pxe-server
- path = $DST_ROOT/
- public = yes
- only guest = yes
- browseable = yes
- read only = no
- writeable = yes
- create mask = 0644
- directory mask = 0755
- force create mask = 0644
- force directory mask = 0755
- force user = root
- force group = root
-
-[media]
- comment = /media folder of pxe-server
- path = /media/
- public = yes
- only guest = yes
- browseable = yes
- read only = no
- writeable = yes
- create mask = 0644
- directory mask = 0755
- force create mask = 0644
- force directory mask = 0755
- force user = root
- force group = root
-EOF"
- sudo systemctl restart smbd.service;
- )
-}
-
-
-##########################################################################
-handle_pxe_menu() {
- # $1 : menu short name
- # $2 : menu file name
- ######################################################################
- local FILE_MENU=$DST_TFTP_ETH0/$1/pxelinux.cfg/$2
- ######################################################################
- ## INFO:
- ## The entry before -- means that it will be used by the live system / the installer
- ## The entry after -- means that it will be carried to and used by the installed system
- ## https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/kernel-parameters.txt
- ######################################################################
- echo -e "\e[32mhandle_pxe_menu(\e[0m$1\e[32m)\e[0m";
- echo -e "\e[36m setup sys menu for pxe\e[0m";
- if ! [ -d "$DST_TFTP_ETH0/$1/pxelinux.cfg" ]; then sudo mkdir -p $DST_TFTP_ETH0/$1/pxelinux.cfg; fi
- if [ -d "$DST_TFTP_ETH0/$1/pxelinux.cfg" ]; then
- sudo sh -c "cat << EOF > $FILE_MENU
-########################################
-# $FILE_MENU
-
-# http://www.syslinux.org/wiki/index.php?title=Menu
-
-DEFAULT /vesamenu.c32
-TIMEOUT 600
-ONTIMEOUT Boot Local
-PROMPT 0
-NOESCAPE 1
-ALLOWOPTIONS 1
-
-menu color title * #FFFFFFFF *
-menu title PXE Boot Menu (menu-bios)
-menu rows 20
-menu tabmsgrow 24
-menu tabmsg [Enter]=boot, [Tab]=edit, [Esc]=return
-menu cmdlinerow 24
-menu timeoutrow 25
-menu color help 1;37;40 #FFFFFFFF *
-menu helpmsgrow 26
-
-LABEL Boot Local
- localboot 0
- TEXT HELP
- Boot to local hard disk
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_TFTP_ETH0/$1/pxeboot.0" ]; then
- echo -e "\e[36m add $WIN_PE_X86 (PXE)\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Windows PE x86 (PXE)
- PXE /pxeboot.0
- TEXT HELP
- Boot to Windows PE 32bit
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_ISO/$WIN_PE_X86.iso" ]; then
- echo -e "\e[36m add $WIN_PE_X86 (ISO)\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Windows PE x86 (ISO)
- KERNEL /memdisk
- APPEND iso
- INITRD $ISO/$WIN_PE_X86.iso
- TEXT HELP
- Boot to Windows PE 32bit ISO ~400MB
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$UBUNTU_LTS_X64/casper/vmlinuz.efi" ]; then
- echo -e "\e[36m add $UBUNTU_LTS_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Ubuntu LTS x64
- KERNEL $NFS_ETH0/$UBUNTU_LTS_X64/casper/vmlinuz.efi
- APPEND initrd=$NFS_ETH0/$UBUNTU_LTS_X64/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_LTS_X64 ro file=/cdrom/preseed/ubuntu.seed boot=casper -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to Ubuntu LTS x64 Live
- User: ubuntu
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$UBUNTU_LTS_X86/casper/vmlinuz" ]; then
- echo -e "\e[36m add $UBUNTU_LTS_X86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Ubuntu LTS x86
- KERNEL $NFS_ETH0/$UBUNTU_LTS_X86/casper/vmlinuz
- APPEND initrd=$NFS_ETH0/$UBUNTU_LTS_X86/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_LTS_X86 ro file=/cdrom/preseed/ubuntu.seed boot=casper -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to Ubuntu LTS x86 Live
- User: ubuntu
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$UBUNTU_X64/casper/vmlinuz.efi" ]; then
- echo -e "\e[36m add $UBUNTU_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Ubuntu x64
- KERNEL $NFS_ETH0/$UBUNTU_X64/casper/vmlinuz.efi
- APPEND initrd=$NFS_ETH0/$UBUNTU_X64/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_X64 ro file=/cdrom/preseed/ubuntu.seed boot=casper -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to Ubuntu x64 Live
- User: ubuntu
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$UBUNTU_X86/casper/vmlinuz" ]; then
- echo -e "\e[36m add $UBUNTU_X86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Ubuntu x86
- KERNEL $NFS_ETH0/$UBUNTU_X86/casper/vmlinuz
- APPEND initrd=$NFS_ETH0/$UBUNTU_X86/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_X86 ro file=/cdrom/preseed/ubuntu.seed boot=casper -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to Ubuntu x86 Live
- User: ubuntu
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$UBUNTU_NONPAE/casper/vmlinuz" ]; then
- echo -e "\e[36m add $UBUNTU_NONPAE\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Ubuntu non-PAE x86
- KERNEL $NFS_ETH0/$UBUNTU_NONPAE/casper/vmlinuz
- APPEND initrd=$NFS_ETH0/$UBUNTU_NONPAE/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_NONPAE ro file=/cdrom/preseed/ubuntu.seed boot=casper -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to Ubuntu non-PAE x86 Live
- User: ubuntu
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$DEBIAN_X64/live/vmlinuz-4.9.0-3-amd64" ]; then
- echo -e "\e[36m add $DEBIAN_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Debian x64
- KERNEL $NFS_ETH0/$DEBIAN_X64/live/vmlinuz-4.9.0-3-amd64
- APPEND initrd=$NFS_ETH0/$DEBIAN_X64/live/initrd.img-4.9.0-3-amd64 netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEBIAN_X64 ro boot=live config -- locales=de_DE.UTF-8 keyboard-layouts=de utc=no timezone=Europe/Berlin
- TEXT HELP
- Boot to Debian x64 Live LXDE
- User: user, Password: live
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$DEBIAN_X86/live/vmlinuz-4.9.0-3-686" ]; then
- echo -e "\e[36m add $DEBIAN_X86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Debian x86
- KERNEL $NFS_ETH0/$DEBIAN_X86/live/vmlinuz-4.9.0-3-686
- APPEND initrd=$NFS_ETH0/$DEBIAN_X86/live/initrd.img-4.9.0-3-686 netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEBIAN_X86 ro boot=live config -- locales=de_DE.UTF-8 keyboard-layouts=de utc=no timezone=Europe/Berlin
- TEXT HELP
- Boot to Debian x86 Live LXDE
- User: user, Password: live
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$GNURADIO_X64/casper/vmlinuz.efi" ]; then
- echo -e "\e[36m add $GNURADIO_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL GNU Radio x64
- KERNEL $NFS_ETH0/$GNURADIO_X64/casper/vmlinuz.efi
- APPEND initrd=$NFS_ETH0/$GNURADIO_X64/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$GNURADIO_X64 ro file=/cdrom/preseed/ubuntu.seed boot=casper -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to GNU Radio x64 Live
- User: ubuntu
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$KALI_X64/live/vmlinuz" ]; then
- echo -e "\e[36m add $KALI_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Kali x64
- KERNEL $NFS_ETH0/$KALI_X64/live/vmlinuz
- APPEND initrd=$NFS_ETH0/$KALI_X64/live/initrd.img netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$KALI_X64 ro boot=live noconfig=sudo username=root hostname=kali -- locales=de_DE.UTF-8 keyboard-layouts=de utc=no timezone=Europe/Berlin
- TEXT HELP
- Boot to Kali x64 Live
- User: root, Password: toor
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$DEFT_X64/casper/vmlinuz" ]; then
- echo -e "\e[36m add $DEFT_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL DEFT x64
- KERNEL $NFS_ETH0/$DEFT_X64/casper/vmlinuz
- APPEND initrd=$NFS_ETH0/$DEFT_X64/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEFT_X64 ro file=/cdrom/preseed/ubuntu.seed boot=casper memtest=4 -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to DEFT x64 Live
- User: root, Password: toor
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$PENTOO_X64/isolinux/pentoo" ]; then
- echo -e "\e[36m add $PENTOO_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Pentoo x64
- KERNEL $NFS_ETH0/$PENTOO_X64/isolinux/pentoo
- APPEND initrd=$NFS_ETH0/$PENTOO_X64/isolinux/pentoo.igz nfsroot=$IP_ETH0:$DST_NFS_ETH0/$PENTOO_X64 ro real_root=/dev/nfs root=/dev/ram0 init=/linuxrc aufs looptype=squashfs loop=/image.squashfs cdroot nox --
- TEXT HELP
- Boot to Pentoo x64 Live
- User: pentoo
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$SYSTEMRESCTUE_X86/isolinux/rescue32" ]; then
- echo -e "\e[36m add $SYSTEMRESCTUE_X86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL System Rescue x86
- KERNEL $NFS_ETH0/$SYSTEMRESCTUE_X86/isolinux/rescue32
- APPEND initrd=$NFS_ETH0/$SYSTEMRESCTUE_X86/isolinux/initram.igz netboot=nfs://$IP_ETH0:$DST_NFS_ETH0/$SYSTEMRESCTUE_X86 ro dodhcp -- setkmap=de
- TEXT HELP
- Boot to System Rescue x86 Live
- User: root
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$DESINFECT_X86/casper/vmlinuz" ]; then
- echo -e "\e[36m add $DESINFECT_X86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL desinfect x86
- KERNEL $NFS_ETH0/$DESINFECT_X86/casper/vmlinuz
- APPEND initrd=$NFS_ETH0/$DESINFECT_X86/casper/initrd.lz netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DESINFECT_X86 ro file=/cdrom/preseed/ubuntu.seed boot=casper memtest=4 rmdns -- debian-installer/language=de console-setup/layoutcode=de keyboard-configuration/layoutcode=de keyboard-configuration/variant=German
- TEXT HELP
- Boot to ct desinfect x86
- User: desinfect
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$TINYCORE_x64/boot/vmlinuz64" ]; then
- echo -e "\e[36m add $TINYCORE_x64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-# INFO: http://wiki.tinycorelinux.net/wiki:boot_options
-LABEL tiny core x64
- KERNEL $NFS_ETH0/$TINYCORE_x64/boot/vmlinuz64
- APPEND initrd=$NFS_ETH0/$TINYCORE_x64/boot/corepure64.gz nfsmount=$IP_ETH0:$DST_NFS_ETH0/$TINYCORE_x64 ro tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 -- lang=en kmap=us
- TEXT HELP
- Boot to tiny core x64
- User: tc
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$TINYCORE_x86/boot/vmlinuz" ]; then
- echo -e "\e[36m add $TINYCORE_x86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-# INFO: http://wiki.tinycorelinux.net/wiki:boot_options
-LABEL tiny core x86
- KERNEL $NFS_ETH0/$TINYCORE_x86/boot/vmlinuz
- APPEND initrd=$NFS_ETH0/$TINYCORE_x86/boot/core.gz nfsmount=$IP_ETH0:$DST_NFS_ETH0/$TINYCORE_x86 ro tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 -- lang=en kmap=us
- TEXT HELP
- Boot to tiny core x86
- User: tc
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$RPDESKTOP_X86/live/vmlinuz2" ]; then
- echo -e "\e[36m add $RPDESKTOP_X86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Raspberry Pi Desktop
- KERNEL $NFS_ETH0/$RPDESKTOP_X86/live/vmlinuz2
- APPEND initrd=$NFS_ETH0/$RPDESKTOP_X86/live/initrd2.img netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$RPDESKTOP_X86 ro boot=live config -- locales=de_DE.UTF-8 keyboard-layouts=de utc=no timezone=Europe/Berlin
- TEXT HELP
- Boot to Raspberry Pi Desktop
- User: pi, Password: raspberry
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$CLONEZILLA_X64/live/vmlinuz" ]; then
- echo -e "\e[36m add $CLONEZILLA_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Clonezilla x64
- KERNEL $NFS_ETH0/$CLONEZILLA_X64/live/vmlinuz
- APPEND initrd=$NFS_ETH0/$CLONEZILLA_X64/live/initrd.img netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$CLONEZILLA_X64 ro boot=live config username=user hostname=clonezilla union=overlay components noswap edd=on nomodeset nodmraid ocs_live_run=ocs-live-general ocs_live_extra_param= ocs_live_batch=no net.ifnames=0 nosplash noprompt -- locales=de_DE.UTF-8 keyboard-layouts=de utc=no timezone=Europe/Berlin
- TEXT HELP
- Boot to Clonezilla x64
- User: user, Password: live
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$CLONEZILLA_X86/live/vmlinuz" ]; then
- echo -e "\e[36m add $CLONEZILLA_X86\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-LABEL Clonezilla x86
- KERNEL $NFS_ETH0/$CLONEZILLA_X86/live/vmlinuz
- APPEND initrd=$NFS_ETH0/$CLONEZILLA_X86/live/initrd.img netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$CLONEZILLA_X86 ro boot=live config username=user hostname=clonezilla union=overlay components noswap edd=on nomodeset nodmraid ocs_live_run=ocs-live-general ocs_live_extra_param= ocs_live_batch=no net.ifnames=0 nosplash noprompt -- locales=de_DE.UTF-8 keyboard-layouts=de utc=no timezone=Europe/Berlin
- TEXT HELP
- Boot to Clonezilla x86
- User: user, Password: live
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$FEDORA_X64/isolinux/vmlinuz" ]; then
- echo -e "\e[36m add $FEDORA_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-## INFO: http://people.redhat.com/harald/dracut.html#dracut.kernel
-## NOT WORKING
-LABEL Fedora x64
- KERNEL $NFS_ETH0/$FEDORA_X64/images/pxeboot/vmlinuz
-# APPEND initrd=$NFS_ETH0/$FEDORA_X64/images/pxeboot/initrd.img root=$IP_ETH0:$DST_NFS_ETH0/$FEDORA_X64/LiveOS/squashfs.img ro rd.live.image rd.lvm=0 rd.luks=0 rd.md=0 rd.dm=0 rd.shell rd.break console=tty0 loglevel=7 vga=794 -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8
- APPEND initrd=$NFS_ETH0/$FEDORA_X64/images/pxeboot/initrd.img root=live:tftp://$IP_ETH0/menu-bios/nfs/$FEDORA_X64/LiveOS/squashfs.img ro rd.live.image rd.lvm=0 rd.luks=0 rd.md=0 rd.dm=0 rd.shell rd.break console=tty0 loglevel=7 vga=794 -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8
- TEXT HELP
- Boot to Fedora Workstation Live
- User: liveuser
- ENDTEXT
-EOF";
- fi
-
- if [ -f "$FILE_MENU" ] \
- && [ -f "$DST_NFS_ETH0/$TAILS_X64/live/vmlinuz" ]; then
- echo -e "\e[36m add $TAILS_X64\e[0m";
- sudo sh -c "cat << EOF >> $FILE_MENU
-########################################
-## NOT WORKING
-LABEL Tails x64
- KERNEL $NFS_ETH0/$TAILS_X64/live/vmlinuz
- APPEND initrd=$NFS_ETH0/$TAILS_X64/live/initrd.img netboot=nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$TAILS_X64 ro boot=live config loglevel=7 -- break locales=de_DE.UTF-8 keyboard-layouts=de
- TEXT HELP
- Boot to Tails x64 Live (modprobe r8169; exit)
- ENDTEXT
-EOF";
- fi
-}
-
-
-######################################################################
-handle_iso() {
- # $1 : short name
- # $2 : download url
- ##############################################################
- local NAME=$1
- local URL=$2
- local FILE_URL=$NAME.url
- local FILE_ISO=$NAME.iso
- ##############################################################
- echo -e "\e[32mhandle_iso(\e[0m$NAME\e[32m)\e[0m";
- if ! [ -d "$DST_ISO/" ]; then sudo mkdir -p $DST_ISO/; fi
- if ! [ -d "$DST_NFS_ETH0/" ]; then sudo mkdir -p $DST_NFS_ETH0/; fi
-
- sudo exportfs -u *:$DST_NFS_ETH0/$NAME 2> /dev/null;
- sudo umount -f $DST_NFS_ETH0/$NAME 2> /dev/null;
-
- if [ "$URL" == "" ]; then
- if ! [ -f "$DST_ISO/$FILE_ISO" ] \
- && [ -f "$SRC_ISO/$FILE_ISO" ] \
- && [ -f "$SRC_ISO/$FILE_URL" ]; \
- then
- echo -e "\e[36m copy iso from usb-stick\e[0m";
- sudo rm -f $DST_ISO/$FILE_URL;
- sudo rsync -xa --info=progress2 $SRC_ISO/$FILE_ISO $DST_ISO;
- sudo rsync -xa --info=progress2 $SRC_ISO/$FILE_URL $DST_ISO;
- fi
- else
- if [ -f "$SRC_ISO/$FILE_ISO" ] \
- && [ -f "$SRC_ISO/$FILE_URL" ] \
- && grep -q "$URL" $SRC_ISO/$FILE_URL 2> /dev/null \
- && ! grep -q "$URL" $DST_ISO/$FILE_URL 2> /dev/null; \
- then
- echo -e "\e[36m copy iso from usb-stick\e[0m";
- sudo rm -f $DST_ISO/$FILE_URL;
- sudo rsync -xa --info=progress2 $SRC_ISO/$FILE_ISO $DST_ISO;
- sudo rsync -xa --info=progress2 $SRC_ISO/$FILE_URL $DST_ISO;
- fi
-
- if ! [ -f "$DST_ISO/$FILE_ISO" ] \
- || ! grep -q "$URL" $DST_ISO/$FILE_URL 2> /dev/null; \
- then
- echo -e "\e[36m download iso image\e[0m";
- sudo rm -f $DST_ISO/$FILE_URL;
- sudo rm -f $DST_ISO/$FILE_ISO;
- sudo wget -O $DST_ISO/$FILE_ISO $URL;
-
- sudo sh -c "echo '$URL' > $DST_ISO/$FILE_URL";
- sudo touch -r $DST_ISO/$FILE_ISO $DST_ISO/$FILE_URL;
- fi
- fi
-
- if [ -f "$DST_ISO/$FILE_ISO" ]; then
- if ! [ -d "$DST_NFS_ETH0/$NAME" ]; then
- echo -e "\e[36m create nfs folder\e[0m";
- sudo mkdir -p $DST_NFS_ETH0/$NAME;
- fi
-
- if ! grep -q "$DST_NFS_ETH0/$NAME" /etc/fstab; then
- echo -e "\e[36m add iso image to fstab\e[0m";
- sudo sh -c "echo '$DST_ISO/$FILE_ISO $DST_NFS_ETH0/$NAME auto ro,nofail,auto,loop 0 0' >> /etc/fstab";
- fi
-
- if ! grep -q "$DST_NFS_ETH0/$NAME" /etc/exports; then
- echo -e "\e[36m add nfs folder to exports\e[0m";
- sudo sh -c "echo '$DST_NFS_ETH0/$NAME *(ro,async,no_subtree_check,root_squash,mp)' >> /etc/exports";
- fi
-
- sudo mount $DST_NFS_ETH0/$NAME;
- sudo exportfs *:$DST_NFS_ETH0/$NAME;
- else
- sudo sed /etc/fstab -i -e "/$NAME/d"
- sudo sed /etc/exports -i -e "/$NAME/d"
- fi
-}
-
-
-######################################################################
-handle_zip_img() {
- # $1 : short name
- # $2 : download url
- ##############################################################
- local NAME=$1
- local URL=$2
- local RAW_FILENAME=$(basename $URL .zip)
- local RAW_FILENAME_IMG=$RAW_FILENAME.img
- local RAW_FILENAME_ZIP=$RAW_FILENAME.zip
- local NAME_BOOT=$NAME-boot
- local NAME_ROOT=$NAME-root
- local DST_BOOT=$DST_NFS_ETH0/$NAME_BOOT
- local DST_ROOT=$DST_NFS_ETH0/$NAME_ROOT
- local FILE_URL=$NAME.url
- local FILE_IMG=$NAME.img
- ##############################################################
- echo -e "\e[32mhandle_zip_img(\e[0m$NAME\e[32m)\e[0m";
- if ! [ -d "$DST_IMG/" ]; then sudo mkdir -p $DST_IMG/; fi
- if ! [ -d "$DST_NFS_ETH0/" ]; then sudo mkdir -p $DST_NFS_ETH0/; fi
-
- sudo exportfs -u *:$DST_BOOT 2> /dev/null;
- sudo umount -f $DST_BOOT 2> /dev/null;
-
- sudo exportfs -u *:$DST_ROOT 2> /dev/null;
- sudo umount -f $DST_ROOT 2> /dev/null;
-
- if [ "$URL" == "" ]; then
- if ! [ -f "$DST_IMG/$FILE_IMG" ] \
- && [ -f "$SRC_IMG/$FILE_IMG" ] \
- && [ -f "$SRC_IMG/$FILE_URL" ]; \
- then
- echo -e "\e[36m copy img from usb-stick\e[0m";
- sudo rm -f $FILE_IMG/$FILE_URL;
- sudo rsync -xa --info=progress2 $SRC_IMG/$FILE_IMG $DST_IMG;
- sudo rsync -xa --info=progress2 $SRC_IMG/$FILE_URL $DST_IMG;
- fi
- else
- if [ -f "$SRC_IMG/$FILE_IMG" ] \
- && [ -f "$SRC_IMG/$FILE_URL" ] \
- && grep -q "$URL" $SRC_IMG/$FILE_URL 2> /dev/null \
- && ! grep -q "$URL" $DST_IMG/$FILE_URL 2> /dev/null; \
- then
- echo -e "\e[36m copy img from usb-stick\e[0m";
- sudo rm -f $FILE_IMG/$FILE_URL;
- sudo rsync -xa --info=progress2 $SRC_IMG/$FILE_IMG $DST_IMG;
- sudo rsync -xa --info=progress2 $SRC_IMG/$FILE_URL $DST_IMG;
- fi
-
- if ! [ -f "$DST_IMG/$FILE_IMG" ] \
- || ! grep -q "$URL" $DST_IMG/$FILE_URL 2> /dev/null; \
- then
- echo -e "\e[36m download image\e[0m";
- sudo rm -f $DST_IMG/$FILE_IMG;
- sudo rm -f $DST_IMG/$FILE_URL;
- sudo wget -O $DST_IMG/$RAW_FILENAME_ZIP $URL;
- echo -e "\e[36m extract image\e[0m";
- sudo unzip $DST_IMG/$RAW_FILENAME_ZIP -d $DST_IMG;
- sudo rm -f $DST_IMG/$RAW_FILENAME_ZIP;
- sudo mv $DST_IMG/$RAW_FILENAME_IMG $DST_IMG/$FILE_IMG;
-
- sudo sh -c "echo '$URL' > $DST_IMG/$FILE_URL";
- sudo touch -r $DST_IMG/$FILE_IMG $DST_IMG/$FILE_URL;
- fi
- fi
-
- if [ -f "$DST_IMG/$FILE_IMG" ]; then
- local OFFSET_BOOT=$((512*$(sfdisk -d $DST_IMG/$FILE_IMG | grep $DST_IMG/$FILE_IMG\1 | awk '{print $4}' | sed 's/,//')))
- local SIZE_BOOT=$((512*$(sfdisk -d $DST_IMG/$FILE_IMG | grep $DST_IMG/$FILE_IMG\1 | awk '{print $6}' | sed 's/,//')))
- local OFFSET_ROOT=$((512*$(sfdisk -d $DST_IMG/$FILE_IMG | grep $DST_IMG/$FILE_IMG\2 | awk '{print $4}' | sed 's/,//')))
- local SIZE_ROOT=$((512*$(sfdisk -d $DST_IMG/$FILE_IMG | grep $DST_IMG/$FILE_IMG\2 | awk '{print $6}' | sed 's/,//')))
- #sfdisk -d $DST_IMG/$FILE_IMG
-
- sudo sed /etc/fstab -i -e "/$NAME_BOOT/d"
- sudo sed /etc/fstab -i -e "/$NAME_ROOT/d"
-
- ## boot
- if ! [ -d "$DST_BOOT" ]; then
- echo -e "\e[36m create image-boot folder\e[0m";
- sudo mkdir -p $DST_BOOT;
- fi
-
- if ! grep -q "$DST_BOOT" /etc/fstab; then
- echo -e "\e[36m add image-boot to fstab\e[0m";
- sudo sh -c "echo '$DST_IMG/$FILE_IMG $DST_BOOT auto ro,nofail,auto,loop,offset=$OFFSET_BOOT,sizelimit=$SIZE_BOOT 0 0' >> /etc/fstab";
- fi
-
- if ! grep -q "$DST_BOOT" /etc/exports; then
- echo -e "\e[36m add image-boot folder to exports\e[0m";
- sudo sh -c "echo '$DST_BOOT *(ro,async,no_subtree_check,root_squash,mp)' >> /etc/exports";
- fi
-
- ## root
- if ! [ -d "$DST_ROOT" ]; then
- echo -e "\e[36m create image-root folder\e[0m";
- sudo mkdir -p $DST_ROOT;
- fi
-
- if ! grep -q "$DST_ROOT" /etc/fstab; then
- echo -e "\e[36m add image-root to fstab\e[0m";
- sudo sh -c "echo '$DST_IMG/$FILE_IMG $DST_ROOT auto ro,nofail,auto,loop,offset=$OFFSET_ROOT,sizelimit=$SIZE_ROOT 0 0' >> /etc/fstab";
- fi
-
- if ! grep -q "$DST_ROOT" /etc/exports; then
- echo -e "\e[36m add image-root folder to exports\e[0m";
- sudo sh -c "echo '$DST_ROOT *(ro,async,no_subtree_check,root_squash,mp)' >> /etc/exports";
- fi
-
- sudo mount $DST_BOOT;
- sudo exportfs *:$DST_BOOT;
-
- sudo mount $DST_ROOT;
- sudo exportfs *:$DST_ROOT;
- else
- ## boot
- sudo sed /etc/fstab -i -e "/$NAME_BOOT/d"
- sudo sed /etc/exports -i -e "/$NAME_BOOT/d"
- ## root
- sudo sed /etc/fstab -i -e "/$NAME_ROOT/d"
- sudo sed /etc/exports -i -e "/$NAME_ROOT/d"
- fi
-}
-
-
-######################################################################
-handle_network_booting() {
- # $1 : short name
- # $2 : flags (redo,bootcode,cmdline,config,ssh,root,fstab,wpa,history)
- ##############################################################
- local NAME=$1
- local FLAGS=$2
- local NAME_BOOT=$NAME-boot
- local NAME_ROOT=$NAME-root
- local SRC_BOOT=$DST_NFS_ETH0/$NAME_BOOT
- local SRC_ROOT=$DST_NFS_ETH0/$NAME_ROOT
- local DST_BOOT=$DST_NFS_ETH0/$RPI_SN0_BOOT
- local DST_ROOT=$DST_NFS_ETH0/$RPI_SN0_ROOT
- local FILE_URL=$NAME.url
- ##############################################################
- echo -e "\e[32mhandle_network_booting(\e[0m$NAME\e[32m)\e[0m";
- if [ "$RPI_SN0" == "" ] \
- || [ "$RPI_SN0" == "12345678" ]; then
- echo -e "\e[36m skipped: no serial number setted at RPI_SN0.\e[0m";
- return 1;
- fi
- sudo exportfs -u *:$DST_BOOT 2> /dev/null;
- sudo exportfs -u *:$DST_ROOT 2> /dev/null;
-
- ######################################################################
- if ! [ -d "$DST_BOOT" ]; then sudo mkdir -p $DST_BOOT; fi
- if ! [ -d "$DST_ROOT" ]; then sudo mkdir -p $DST_ROOT; fi
-
- ######################################################################
- if ! [ -h "$DST_TFTP_ETH0/$RPI_SN0" ]; then sudo ln -s $DST_BOOT/ $DST_TFTP_ETH0/$RPI_SN0; fi
-
- ######################################################################
- if (echo $FLAGS | grep -q redo) \
- || ! grep -q $(cat $DST_IMG/$FILE_URL) $DST_BOOT/$FILE_URL 2> /dev/null; then
- echo -e "\e[36m delete old boot files\e[0m";
- sudo rm -rf $DST_BOOT/*;
- echo -e "\e[36m delete old root files\e[0m";
- sudo rm -rf $DST_ROOT/*;
-
- ##################################################################
- if ! [ -f "$DST_BOOT/bootcode.bin" ]; then
- echo -e "\e[36m copy boot files\e[0m";
- sudo rsync -xa --info=progress2 $SRC_BOOT/* $DST_BOOT/
- fi
-
- ##################################################################
- if (echo $FLAGS | grep -q cmdline); then
- echo -e "\e[36m add cmdline file\e[0m";
- sudo sh -c "echo 'dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 plymouth.ignore-serial-consoles root=/dev/nfs nfsroot=$IP_ETH0:$DST_NFS_ETH0/$RPI_SN0_ROOT,vers=3 rw ip=dhcp rootwait net.ifnames=0 elevator=deadline' > $DST_BOOT/cmdline.txt";
- fi
-
- ##################################################################
- if (echo $FLAGS | grep -q config); then
- echo -e "\e[36m add config file\e[0m";
- sudo sh -c "cat << EOF > $DST_BOOT/config.txt
-########################################
-dtparam=audio=on
-
-max_usb_current=1
-#force_turbo=1
-
-disable_overscan=1
-hdmi_force_hotplug=1
-config_hdmi_boost=4
-hdmi_drive=2
-cec_osd_name=NetBoot
-
-########################################
-##4k@15Hz custom DMT - mode
-#gpu_mem=128
-#hdmi_group=2
-#hdmi_mode=87
-#hdmi_cvt 3840 2160 15
-#max_framebuffer_width=3840
-#max_framebuffer_height=2160
-#hdmi_pixel_freq_limit=400000000
-EOF";
- fi
-
- ##################################################################
- if (echo $FLAGS | grep -q ssh); then
- echo -e "\e[36m add ssh file\e[0m";
- sudo touch $DST_BOOT/ssh;
- fi
-
- ##################################################################
- if (echo $FLAGS | grep -q root); then
- if ! [ -d "$DST_ROOT/etc" ]; then
- echo -e "\e[36m copy root files\e[0m";
- sudo rsync -xa --info=progress2 $SRC_ROOT/* $DST_ROOT/
- fi
-
- ##############################################################
- if (echo $FLAGS | grep -q fstab); then
- echo -e "\e[36m add fstab file\e[0m";
- sudo sh -c "cat << EOF > $DST_ROOT/etc/fstab
-########################################
-proc /proc proc defaults 0 0
-$IP_ETH0:$DST_NFS_ETH0/$RPI_SN0_BOOT /boot nfs defaults,nofail,noatime 0 2
-$IP_ETH0:$DST_NFS_ETH0/$RPI_SN0_ROOT / nfs defaults,nofail,noatime 0 1
-EOF";
- fi
-
- ##############################################################
- if (echo $FLAGS | grep -q wpa); then
- echo -e "\e[36m add wpa_supplicant template file\e[0m";
- sudo sh -c "cat << EOF > $DST_ROOT/etc/wpa_supplicant/wpa_supplicant.conf
-########################################
-country=DE
-ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
-update_config=1
-
-network={
- # wpa_passphrase
- #ssid=
- #psk=
-
- # sudo iwlist wlan0 scan [essid ]
- #bssid=
-
- scan_ssid=1
- key_mgmt=WPA-PSK
-}
-EOF";
- if [ -f "$SRC_BACKUP/wpa_supplicant.conf" ]; then
- echo -e "\e[36m add wpa_supplicant file from backup\e[0m";
- sudo rsync -xa --info=progress2 $SRC_BACKUP/wpa_supplicant.conf $DST_ROOT/etc/wpa_supplicant/
- fi
- fi
-
- ##############################################################
- if (echo $FLAGS | grep -q history); then
- echo -e "\e[36m add .bash_history file\e[0m";
- sudo sh -c "cat << EOF > $DST_ROOT/home/pi/.bash_history
-sudo poweroff
-sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y --purge autoremove && sudo apt-get -y autoclean && sync && echo Done.
-ip route
-sudo ip route del default dev eth0
-sudo reboot
-sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
-wpa_passphrase
-sudo iwlist wlan0 scan [essid ]
-sudo raspi-config
-EOF";
- sudo chown 1000:1000 $DST_ROOT/home/pi/.bash_history;
- fi
- fi
-
- ##################################################################
- sudo cp $DST_IMG/$FILE_URL $DST_BOOT/$FILE_URL;
- fi
-
- ######################################################################
- if ! grep -q "$DST_BOOT" /etc/exports; then
- echo -e "\e[36m add $DST_BOOT to exports\e[0m";
- sudo sh -c "echo '$DST_BOOT *(rw,sync,no_subtree_check,no_root_squash)' >> /etc/exports";
- fi
- sudo exportfs *:$DST_BOOT;
-
- ######################################################################
- if (echo $FLAGS | grep -q root); then
- if ! grep -q "$DST_ROOT" /etc/exports; then
- echo -e "\e[36m add $DST_ROOT to exports\e[0m";
- sudo sh -c "echo '$DST_ROOT *(rw,sync,no_subtree_check,no_root_squash)' >> /etc/exports";
- fi
- sudo exportfs *:$DST_ROOT;
- else
- sudo sed /etc/exports -i -e "/$NAME_ROOT/d"
- fi
-
- ######################################################################
- if (echo $FLAGS | grep -q bootcode); then
- if [ -f "$DST_BOOT/bootcode.bin" ]; then
- echo -e "\e[36m copy bootcode.bin for RPi3 NETWORK BOOTING\e[0m";
- sudo cp $DST_BOOT/bootcode.bin $DST_TFTP_ETH0/bootcode.bin;
- fi
- fi
-
- ######################################################################
- if ! [ -f "$DST_TFTP_ETH0/bootcode.bin" ]; then
- echo -e "\e[36m download bootcode.bin for RPi3 NETWORK BOOTING\e[0m";
- sudo wget -O $DST_TFTP_ETH0/bootcode.bin https://github.com/raspberrypi/firmware/raw/stable/boot/bootcode.bin;
- fi
-}
-
-
-######################################################################
-handle_pxe() {
- echo -e "\e[32mhandle_pxe()\e[0m";
-
- ######################################################################
- [ -d "$DST_TFTP_ETH0/$DST_PXE_BIOS" ] || sudo mkdir -p $DST_TFTP_ETH0/$DST_PXE_BIOS;
- if [ -d "$SRC_TFTP_ETH0" ]; then
- echo -e "\e[36m copy win-pe stuff\e[0m";
- [ -f "$DST_TFTP_ETH0/$DST_PXE_BIOS/pxeboot.0" ] || sudo rsync -xa --info=progress2 $SRC_TFTP_ETH0/pxeboot.0 $DST_TFTP_ETH0/$DST_PXE_BIOS/;
- [ -f "$DST_TFTP_ETH0/bootmgr.exe" ] || sudo rsync -xa --info=progress2 $SRC_TFTP_ETH0/bootmgr.exe $DST_TFTP_ETH0/;
- [ -d "$DST_TFTP_ETH0/boot" ] || sudo rsync -xa --info=progress2 $SRC_TFTP_ETH0/boot $DST_TFTP_ETH0/;
- fi
- [ -h "$DST_TFTP_ETH0/sources" ] || sudo ln -s $DST_NFS_ETH0/$WIN_PE_X86/sources/ $DST_TFTP_ETH0/sources;
- #for SRC in `find /srv/tftp/Boot -depth`
- #do
- # DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'`
- # if [ "${SRC}" != "${DST}" ]
- # then
- # [ ! -e "${DST}" ] && sudo mv -T "${SRC}" "${DST}" || echo "${SRC} was not renamed"
- # fi
- #done
-
-
- ######################################################################
- echo -e "\e[36m setup sys menu files for pxe bios\e[0m";
- [ -d "$DST_TFTP_ETH0/$DST_PXE_BIOS" ] || sudo mkdir -p $DST_TFTP_ETH0/$DST_PXE_BIOS;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/pxelinux.0" ] || sudo ln -s /usr/lib/PXELINUX/pxelinux.0 $DST_TFTP_ETH0/$DST_PXE_BIOS/pxelinux.0;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/ldlinux.c32" ] || sudo ln -s /usr/lib/syslinux/modules/bios/ldlinux.c32 $DST_TFTP_ETH0/$DST_PXE_BIOS/;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/vesamenu.c32" ] || sudo ln -s /usr/lib/syslinux/modules/bios/vesamenu.c32 $DST_TFTP_ETH0/$DST_PXE_BIOS/;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/libcom32.c32" ] || sudo ln -s /usr/lib/syslinux/modules/bios/libcom32.c32 $DST_TFTP_ETH0/$DST_PXE_BIOS/;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/libutil.c32" ] || sudo ln -s /usr/lib/syslinux/modules/bios/libutil.c32 $DST_TFTP_ETH0/$DST_PXE_BIOS/;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/memdisk" ] || sudo ln -s /usr/lib/syslinux/memdisk $DST_TFTP_ETH0/$DST_PXE_BIOS/;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/nfs" ] || sudo ln -s $DST_NFS_ETH0/ $DST_TFTP_ETH0/$DST_PXE_BIOS/nfs;
- [ -h "$DST_TFTP_ETH0/$DST_PXE_BIOS/iso" ] || sudo ln -s $DST_ISO/ $DST_TFTP_ETH0/$DST_PXE_BIOS/iso;
- handle_pxe_menu $DST_PXE_BIOS default;
-
- ######################################################################
- #echo -e "\e[36m setup sys menu files for pxe efi32\e[0m";
- #[ -d "$DST_TFTP_ETH0/$DST_PXE_EFI32" ] || sudo mkdir -p $DST_TFTP_ETH0/$DST_PXE_EFI32;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI32/syslinux.0" ] || sudo ln -s /usr/lib/syslinux/modules/efi32/syslinux.c32 $DST_TFTP_ETH0/$DST_PXE_EFI32/syslinux.0;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI32/ldlinux.e32" ] || sudo ln -s /usr/lib/syslinux/modules/efi32/ldlinux.e32 $DST_TFTP_ETH0/$DST_PXE_EFI32/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI32/vesamenu.c32" ] || sudo ln -s /usr/lib/syslinux/modules/efi32/vesamenu.c32 $DST_TFTP_ETH0/$DST_PXE_EFI32/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI32/libcom32.c32" ] || sudo ln -s /usr/lib/syslinux/modules/efi32/libcom32.c32 $DST_TFTP_ETH0/$DST_PXE_EFI32/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI32/libutil.c32" ] || sudo ln -s /usr/lib/syslinux/modules/efi32/libutil.c32 $DST_TFTP_ETH0/$DST_PXE_EFI32/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI32/nfs" ] || sudo ln -s $DST_NFS_ETH0/ $DST_TFTP_ETH0/$DST_PXE_EFI32/nfs;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI32/iso" ] || sudo ln -s $DST_ISO/ $DST_TFTP_ETH0/$DST_PXE_EFI32/iso;
- #handle_pxe_menu $DST_PXE_EFI32 efidefault;
-
- ######################################################################
- #echo -e "\e[36m setup sys menu files for pxe efi64\e[0m";
- #[ -d "$DST_TFTP_ETH0/$DST_PXE_EFI64" ] || sudo mkdir -p $DST_TFTP_ETH0/$DST_PXE_EFI64;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI64/syslinux.0" ] || sudo ln -s /usr/lib/syslinux/modules/efi64/syslinux.c32 $DST_TFTP_ETH0/$DST_PXE_EFI64/syslinux.0;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI64/ldlinux.e64" ] || sudo ln -s /usr/lib/syslinux/modules/efi64/ldlinux.e64 $DST_TFTP_ETH0/$DST_PXE_EFI64/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI64/vesamenu.c32" ] || sudo ln -s /usr/lib/syslinux/modules/efi64/vesamenu.c32 $DST_TFTP_ETH0/$DST_PXE_EFI64/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI64/libcom32.c32" ] || sudo ln -s /usr/lib/syslinux/modules/efi64/libcom32.c32 $DST_TFTP_ETH0/$DST_PXE_EFI64/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI64/libutil.c32" ] || sudo ln -s /usr/lib/syslinux/modules/efi64/libutil.c32 $DST_TFTP_ETH0/$DST_PXE_EFI64/;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI64/nfs" ] || sudo ln -s $DST_NFS_ETH0/ $DST_TFTP_ETH0/$DST_PXE_EFI64/nfs;
- #[ -h "$DST_TFTP_ETH0/$DST_PXE_EFI64/iso" ] || sudo ln -s $DST_ISO/ $DST_TFTP_ETH0/$DST_PXE_EFI64/iso;
- #handle_pxe_menu $DST_PXE_EFI64 efidefault;
-}
-
-
-######################################################################
-handle_optional() {
- echo -e "\e[32mhandle_optional()\e[0m";
-
- ######################################################################
- #sudo chmod 755 $(find $DST_TFTP_ETH0/ -type d) 2>/dev/null
- #sudo chmod 644 $(find $DST_TFTP_ETH0/ -type f) 2>/dev/null
- #sudo chmod 755 $(find $DST_TFTP_ETH0/ -type l) 2>/dev/null
- #sudo chown -R root:root /srv/ 2>/dev/null
- #sudo chown -R root:root $DST_TFTP_ETH0 2>/dev/null
- #sudo chown -R root:root $DST_TFTP_ETH0/ 2>/dev/null
-
-
- ######################################################################
- ## network bridge
- #bridge#grep -q mod_install_server /etc/sysctrl.conf 2> /dev/null || {
- #bridge#echo -e "\e[36m setup sysctrl for bridging\e[0m";
- #bridge#sudo sh -c "cat << EOF >> /etc/sysctl.conf
-#bridge#########################################
-#bridge### mod_install_server
-#bridge#net.ipv4.ip_forward=1
-#bridge#net.ipv6.conf.all.forwarding=1
-#bridge##net.ipv6.conf.all.disable_ipv6 = 1
-#bridge#EOF";
- #bridge#}
-
-
- ######################################################################
- ## network bridge
- #bridge#sudo iptables -t nat --list | grep -q MASQUERADE 2> /dev/null || {
- #bridge#echo -e "\e[36m setup iptables for bridging\e[0m";
- #bridge#sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- #bridge#sudo dpkg-reconfigure iptables-persistent
- #bridge#}
-}
-
-
-######################################################################
-######################################################################
-######################################################################
-######################################################################
-
-
-######################################################################
-sudo mkdir -p $DST_ISO;
-sudo mkdir -p $DST_IMG;
-sudo mkdir -p $DST_TFTP_ETH0;
-sudo mkdir -p $DST_NFS_ETH0;
-
-######################################################################
-handle_dnsmasq
-handle_samba
-handle_optional
-handle_dhcpcd
-
-
-##########################################################################
-# ########### ########### ########### ########### ###########
-# ######### ######### ######### ######### #########
-# ####### ####### ####### ####### #######
-# ##### ##### ##### ##### #####
-# ### ### ### ### ###
-# # # # # #
-
-
-######################################################################
-######################################################################
-## comment out those entries,
-## you don't want to download/mount/export/install for PXE boot
-######################################################################
-######################################################################
-## handle_iso $WIN_PE_X86 $WIN_PE_X86_URL;
-# handle_iso $UBUNTU_LTS_X64 $UBUNTU_LTS_X64_URL;
-# handle_iso $UBUNTU_LTS_X86 $UBUNTU_LTS_X86_URL;
-handle_iso $UBUNTU_X64 $UBUNTU_X64_URL;
-# handle_iso $UBUNTU_X86 $UBUNTU_X86_URL;
-## handle_iso $UBUNTU_NONPAE $UBUNTU_NONPAE_URL;
-handle_iso $DEBIAN_X64 $DEBIAN_X64_URL;
-# handle_iso $DEBIAN_X86 $DEBIAN_X86_URL;
-# handle_iso $GNURADIO_X64 $GNURADIO_X64_URL;
-# handle_iso $DEFT_X64 $DEFT_X64_URL;
-# handle_iso $KALI_X64 $KALI_X64_URL;
-# handle_iso $PENTOO_X64 $PENTOO_X64_URL;
-# handle_iso $SYSTEMRESCTUE_X86 $SYSTEMRESCTUE_X86_URL;
-## handle_iso $DESINFECT_X86 $DESINFECT_X86_URL;
-# handle_iso $TINYCORE_x64 $TINYCORE_x64_URL;
-handle_iso $TINYCORE_x86 $TINYCORE_x86_URL;
-handle_iso $RPDESKTOP_X86 $RPDESKTOP_X86_URL;
-#handle_iso $CLONEZILLA_X64 $CLONEZILLA_X64_URL;
-handle_iso $CLONEZILLA_X86 $CLONEZILLA_X86_URL;
-## handle_iso $FEDORA_X64 $FEDORA_X64_URL;
-## handle_iso $TAILS_X64 $TAILS_X64_URL;
-######################################################################
-handle_pxe
-
-
-######################################################################
-######################################################################
-## comment out those entries,
-## you dont want to download/mount/export
-######################################################################
-######################################################################
-#handle_zip_img $PI_CORE $PI_CORE_URL;
-handle_zip_img $RPD_LITE $RPD_LITE_URL;
-#handle_zip_img $RPD_FULL $RPD_FULL_URL;
-######################################################################
-######################################################################
-## comment out those entries,
-## you dont want to have as RPi3 network booting
-######################################################################
-######################################################################
-#handle_network_booting $PI_CORE bootcode,config
-handle_network_booting $RPD_LITE bootcode,cmdline,config,ssh,root,fstab,wpa,history
-#handle_network_booting $RPD_FULL bootcode,cmdline,config,ssh,root,fstab,wpa,history
-
-
-# # # # # #
-# ### ### ### ### ###
-# ##### ##### ##### ##### #####
-# ####### ####### ####### ####### #######
-# ######### ######### ######### ######### #########
-# ########### ########### ########### ########### ###########
-##########################################################################
-
-
-######################################################################
-if [ -d "$SRC_ISO" ]; then
- echo -e "\e[32mbackup new iso images to usb-stick\e[0m";
- sudo rsync -xa --info=progress2 $DST_ISO/*.iso $DST_ISO/*.url $SRC_ISO/
-fi
-######################################################################
-if [ -d "$SRC_IMG" ]; then
- echo -e "\e[32mbackup new images to usb-stick\e[0m";
- sudo rsync -xa --info=progress2 $DST_IMG/*.img $DST_IMG/*.url $SRC_IMG/
-fi
-######################################################################
-sync
-echo -e "\e[32mDone.\e[0m";
-echo -e "\e[1;31mPlease reboot\e[0m";
diff --git a/p0-install b/p0-install
new file mode 100644
index 0000000..ede75bc
--- /dev/null
+++ b/p0-install
@@ -0,0 +1,217 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+BACKUP_FILE="${script_dir:?}/backup.tar.xz"
+BACKUP_TRANSFORM=s/^/$(date +%Y-%m-%dT%H_%M_%S)-pxe-server\\//
+
+do_backup() {
+ tar -ravf "${BACKUP_FILE:?}" --transform="${BACKUP_TRANSFORM:?}" -C / "${1:?}" &>/dev/null
+}
+
+
+########################################################################
+
+
+do_backup boot/cmdline.txt
+
+########################################################################
+grep -q max_loop /boot/cmdline.txt &>/dev/null || {
+ echo -e "\e[32msetup cmdline.txt for more loop devices\e[0m";
+ sudo sed -i '1 s/$/ max_loop=64/' /boot/cmdline.txt;
+}
+
+########################################################################
+grep -q net.ifnames /boot/cmdline.txt &>/dev/null || {
+ echo -e "\e[32msetup cmdline.txt for old style network interface names\e[0m";
+ sudo sed -i '1 s/$/ net.ifnames=0/' /boot/cmdline.txt;
+}
+
+########################################################################
+grep -q quiet /boot/cmdline.txt &>/dev/null && {
+ echo -e "\e[32msetup cmdline.txt for more boot output\e[0m";
+ sudo sed -i '1 s/ quiet//' /boot/cmdline.txt;
+}
+
+########################################################################
+grep -q splash /boot/cmdline.txt &>/dev/null && {
+ echo -e "\e[32msetup cmdline.txt for no splash screen\e[0m";
+ sudo sed -i '1 s/ splash//' /boot/cmdline.txt;
+}
+
+
+########################################################################
+echo -e "\e[32msync...\e[0m" && sudo sync \
+&& echo -e "\e[32mupdate...\e[0m" && sudo apt update \
+&& echo -e "\e[32mupgrade...\e[0m" && sudo apt full-upgrade -y \
+&& echo -e "\e[32mautoremove...\e[0m" && sudo apt autoremove -y --purge \
+&& echo -e "\e[32mautoclean...\e[0m" && sudo apt autoclean \
+&& echo -e "\e[32msync...\e[0m" && sudo sync \
+&& echo -e "\e[32mDone.\e[0m" \
+&& sync \
+;
+
+
+########################################################################
+echo -e "\e[32minstall debconf-utils\e[0m";
+sudo apt install -y --no-install-recommends debconf-utils;
+
+
+########################################################################
+echo -e "\e[32minstall uuid\e[0m";
+sudo apt install -y --no-install-recommends uuid;
+
+
+########################################################################
+echo -e "\e[32minstall nfs-kernel-server for pxe\e[0m";
+sudo apt install -y --no-install-recommends nfs-kernel-server;
+sudo systemctl enable nfs-kernel-server.service;
+sudo systemctl restart nfs-kernel-server.service;
+
+
+########################################################################
+echo -e "\e[32menable port mapping\e[0m";
+sudo systemctl enable rpcbind.service;
+sudo systemctl restart rpcbind.service;
+
+
+########################################################################
+echo -e "\e[32minstall dnsmasq for pxe\e[0m";
+sudo apt install -y --no-install-recommends dnsmasq
+sudo systemctl enable dnsmasq.service;
+sudo systemctl restart dnsmasq.service;
+
+
+########################################################################
+echo -e "\e[32minstall samba\e[0m";
+echo "samba-common samba-common/dhcp boolean false" | sudo debconf-set-selections;
+sudo apt install -y --no-install-recommends samba;
+
+
+########################################################################
+echo -e "\e[32minstall rsync\e[0m";
+sudo apt install -y --no-install-recommends rsync;
+
+
+########################################################################
+echo -e "\e[32minstall syslinux-common for pxe\e[0m";
+sudo apt install -y --no-install-recommends pxelinux syslinux-common syslinux-efi;
+
+
+########################################################################
+echo -e "\e[32minstall lighttpd\e[0m";
+sudo apt install -y --no-install-recommends lighttpd;
+grep -q mod_install_server /etc/lighttpd/lighttpd.conf &>/dev/null || {
+ do_backup etc/lighttpd/lighttpd.conf
+ cat << EOF | sudo tee -a /etc/lighttpd/lighttpd.conf &>/dev/null
+########################################
+## mod_install_server
+dir-listing.activate = "enable"
+dir-listing.external-css = ""
+dir-listing.external-js = ""
+dir-listing.set-footer = "
"
+dir-listing.exclude = ( "[.]*\.url" )
+EOF
+}
+do_backup var/www/html/index.lighttpd.html
+sudo rm /var/www/html/index.lighttpd.html
+
+
+########################################################################
+echo -e "\e[32minstall vblade\e[0m";
+sudo apt install -y --no-install-recommends vblade vblade-persist;
+
+
+########################################################################
+echo -e "\e[32minstall wlan access point\e[0m";
+sudo apt install -y --no-install-recommends hostapd
+
+
+########################################################################
+$(dpkg --get-selections | grep -q -E "^(ntp|ntpd)[[:blank:]]*install$") || {
+ echo -e "\e[32minstall chrony as ntp client and ntp server\e[0m";
+ sudo apt install -y --no-install-recommends chrony;
+ sudo systemctl enable chronyd.service;
+ sudo systemctl restart chronyd.service;
+}
+
+########################################################################
+########################################################################
+echo -e "\e[32minstall real-vnc-server\e[0m";
+#sudo apt install -y --no-install-recommends realvnc-vnc-server realvnc-vnc-viewer
+sudo apt install -y --no-install-recommends realvnc-vnc-viewer
+#sudo systemctl enable vncserver-x11-serviced.service;
+#sudo systemctl restart vncserver-x11-serviced.service;
+
+
+########################################################################
+## optional
+echo -e "\e[32minstall tools to create initrd images\e[0m";
+sudo apt install -y --no-install-recommends squashfs-tools initramfs-tools xz-utils;
+
+
+########################################################################
+## optional
+#echo -e "\e[32minstall apt-cacher-ng\e[0m";
+#sudo apt install -y --no-install-recommends apt-cacher-ng;
+
+
+########################################################################
+## optional
+#echo -e "\e[32minstall bindfs\e[0m";
+#sudo apt install -y --no-install-recommends fuse bindfs;
+
+
+########################################################################
+## optional
+#bridge#echo -e "\e[32minstall network bridge\e[0m";
+#bridge#sudo apt install -y --no-install-recommends bridge-utils
+
+
+#########################################################################
+### optional
+#echo -e "\e[32minstall wireshark\e[0m";
+#echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections;
+#sudo apt install -y --no-install-recommends tshark wireshark
+#sudo usermod -a -G wireshark "${USER:?}"
+#
+#echo -e "\e[32minstall other useful stuff\e[0m";
+#sudo apt install -y --no-install-recommends xterm transmission-gtk
+#
+#echo -e "\e[32mreduce annoying networktraffic\e[0m";
+#sudo systemctl stop avahi-daemon.service
+#sudo systemctl disable avahi-daemon.service
+#sudo systemctl stop minissdpd.service
+#sudo systemctl disable minissdpd.service
+
+
+########################################################################
+## optional
+grep -q logo.nologo /boot/cmdline.txt 2> /dev/null || {
+echo -e "\e[32msetup cmdline.txt for no logo\e[0m";
+sudo sed -i '1 s/$/ logo.nologo/' /boot/cmdline.txt;
+}
+
+
+#########################################################################
+### optional
+#echo -e "\e[32mchange hostname\e[0m";
+#do_backup etc/hostname
+#echo pxe-server | sudo tee /etc/hostname &>/dev/null
+#do_backup etc/hosts
+#sudo sed -i "s/127.0.1.1.*$(hostname)/127.0.1.1\tpxe-server/g" /etc/hosts
+
+
+########################################################################
+sync
+echo -e "\e[32mDone.\e[0m";
+echo -e "\e[1;31mPlease reboot\e[0m";
diff --git a/p1-setup b/p1-setup
new file mode 100644
index 0000000..00645aa
--- /dev/null
+++ b/p1-setup
@@ -0,0 +1,694 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+BACKUP_FILE="${script_dir:?}/backup.tar.xz"
+BACKUP_TRANSFORM=s/^/$(date +%Y-%m-%dT%H_%M_%S)-pxe-server\\//
+
+do_backup() {
+ tar -ravf "${BACKUP_FILE:?}" --transform="${BACKUP_TRANSFORM:?}" -C / "${1:?}" &>/dev/null
+}
+
+
+########################################################################
+echo -e "\e[36msetup variables\e[0m";
+
+
+########################################################################
+########################################################################
+. "${script_dir:?}/p2-include-var"
+. "${script_dir:?}/c2-custom-var"
+
+
+echo
+echo -e "${KERNEL_MAJOR}.${KERNEL_MINOR} \e[36mis kernel version\e[0m";
+echo -e "${INTERFACE_ETH0} \e[36mis used as primary networkadapter for PXE\e[0m";
+echo -e "${IP_ETH0} \e[36mis used as primary IP address for PXE\e[0m";
+echo -e "${RPI_SN0} \e[36mis used as SN for RPi3 network booting\e[0m";
+echo
+
+if [[ -z "${IP_ETH0}" ]]; then
+ echo -e "\e[1;31mIP address not found. please check your ethernet cable.\e[0m";
+ exit 1
+fi
+
+if [[ -z "${IP_ETH0_ROUTER}" ]]; then
+ echo -e "\e[1;31mrouter IP address not found. please check your router settings.\e[0m";
+ exit 1
+fi
+
+[[ -z "${SRC_MOUNT}" ]] && sudo umount -f "${SRC_MOUNT}" &>/dev/null;
+[[ -z "${SRC_MOUNT}" ]] && sudo mount "${SRC_MOUNT}" &>/dev/null;
+
+
+########################################################################
+handle_chrony() {
+ ####################################################################
+ ## chrony
+ grep -q mod_install_server /etc/chrony/chrony.conf 2> /dev/null || {
+ echo -e "\e[36m setup chrony\e[0m";
+ do_backup etc/chrony/chrony.conf
+ cat << EOF | sudo tee /etc/chrony/chrony.conf &>/dev/null
+########################################
+## mod_install_server
+allow
+
+server ptbtime1.ptb.de iburst
+server ptbtime2.ptb.de iburst
+server ptbtime3.ptb.de iburst
+server ntp1.oma.be iburst
+server ntp2.oma.be iburst
+
+pool pool.ntp.org iburst
+
+keyfile /etc/chrony/chrony.keys
+driftfile /var/lib/chrony/chrony.drift
+logdir /var/log/chrony
+maxupdateskew 100.0
+hwclockfile /etc/adjtime
+rtcsync
+makestep 1 5
+EOF
+ sudo systemctl restart chronyd.service;
+ }
+}
+
+
+########################################################################
+handle_dhcpcd() {
+ echo -e "\e[32mhandle_dhcpcd()\e[0m";
+
+ ####################################################################
+ grep -q mod_install_server /etc/dhcpcd.conf || {
+ echo -e "\e[36m setup dhcpcd.conf\e[0m";
+ do_backup etc/dhcpcd.conf
+ cat << EOF | sudo tee -a /etc/dhcpcd.conf &>/dev/null
+
+########################################
+## mod_install_server
+interface ${INTERFACE_ETH0:?}
+ slaac private
+ static ip_address=${IP_ETH0:?}/24
+ static ip6_address=fd80::${IP_ETH0:?}/120
+ static routers=${IP_ETH0_ROUTER}
+ static domain_name_servers=${IP_ETH0_ROUTER} 1.1.1.1 2606:4700:4700::1111
+
+########################################
+interface ${INTERFACE_ETH1:?}
+ slaac private
+ static ip_address=${IP_ETH1:?}/24
+ static ip6_address=fd80::${IP_ETH1:?}/120
+ static routers=${IP_ETH1_ROUTER}
+ static domain_name_servers=${IP_ETH1_ROUTER}
+ vendorclassid
+
+########################################
+interface ${INTERFACE_WLAN0:?}
+ slaac private
+ static ip_address=${IP_WLAN0:?}/24
+ static ip6_address=fd80::${IP_WLAN0:?}/120
+ static routers=${IP_WLAN0_ROUTER}
+ static domain_name_servers=${IP_WLAN0_ROUTER}
+ vendorclassid
+EOF
+ sudo systemctl daemon-reload;
+ sudo systemctl restart dhcpcd.service;
+ }
+}
+
+
+########################################################################
+handle_dnsmasq() {
+ echo -e "\e[32mhandle_dnsmasq()\e[0m";
+
+ ####################################################################
+ [[ -f /etc/dnsmasq.d/10-pxe-server ]] || {
+ echo -e "\e[36m setup dnsmasq for pxe\e[0m";
+ do_backup etc/dnsmasq.d/10-pxe-server
+ cat << EOF | sudo tee /etc/dnsmasq.d/10-pxe-server &>/dev/null
+########################################
+#/etc/dnsmasq.d/pxeboot
+## mod_install_server
+
+log-dhcp
+#log-queries
+
+# for local resolve
+interface=lo
+
+# interface selection
+interface=${INTERFACE_ETH0:?}
+interface=${INTERFACE_ETH1:?}
+interface=${INTERFACE_WLAN0:?}
+except-interface=wlan1mon
+except-interface=wlan2mon
+
+#
+bind-dynamic
+
+##########
+# TFTP_ETH0 (enabled)
+enable-tftp=${INTERFACE_ETH0:?}
+#tftp-lowercase
+tftp-root=${DST_TFTP_ETH0:?}/, ${INTERFACE_ETH0:?}
+dhcp-option=tag:${INTERFACE_ETH0:?}, option:tftp-server, 0.0.0.0
+
+#
+dhcp-option=tag:${INTERFACE_ETH1:?}, option:nis-domain, eth-nis
+dhcp-option=tag:${INTERFACE_ETH1:?}, option:domain-name, eth-domain.local
+dhcp-option=tag:${INTERFACE_WLAN0:?}, option:nis-domain, wlan-nis
+dhcp-option=tag:${INTERFACE_WLAN0:?}, option:domain-name, wlan-domain.local
+
+##########
+# Time Server
+dhcp-option=tag:${INTERFACE_ETH0:?}, option:ntp-server, 0.0.0.0
+dhcp-option=tag:${INTERFACE_ETH1:?}, option:ntp-server, 0.0.0.0
+dhcp-option=tag:${INTERFACE_WLAN0:?}, option:ntp-server, 0.0.0.0
+dhcp-option=tag:${INTERFACE_ETH0:?}, option6:ntp-server, [::]
+dhcp-option=tag:${INTERFACE_ETH1:?}, option6:ntp-server, [::]
+dhcp-option=tag:${INTERFACE_WLAN0:?}, option6:ntp-server, [::]
+
+##########
+# DHCP
+log-dhcp
+#enable-ra
+
+# block NETGEAR managed switch
+dhcp-mac=set:block, 28:c6:8e:*:*:*
+
+# static IP
+#dhcp-host=set:known_128, 08:08:08:08:08:08, 192.168.1.128, [fd80::192.168.1.128], infinite
+#dhcp-host=set:known_129, client_acb, 192.168.1.129, [fd80::192.168.1.129], infinite
+
+# dynamic IP
+dhcp-range=tag:${INTERFACE_ETH0:?}, tag:!block, fd80::${IP_ETH0_START:?}, fd80::${IP_ETH0_END:?}, 120, 1h
+dhcp-range=tag:${INTERFACE_ETH1:?}, fd80::${IP_ETH1_START:?}, fd80::${IP_ETH1_END:?}, 120, 1h
+dhcp-range=tag:${INTERFACE_WLAN0:?}, fd80::${IP_WLAN0_START:?}, fd80::${IP_WLAN0_END:?}, 120, 1h
+dhcp-range=tag:${INTERFACE_ETH0:?}, tag:!block, ${IP_ETH0_START:?}, ${IP_ETH0_END:?}, 255.255.255.0, 1h
+dhcp-range=tag:${INTERFACE_ETH1:?}, ${IP_ETH1_START:?}, ${IP_ETH1_END:?}, 255.255.255.0, 1h
+dhcp-range=tag:${INTERFACE_WLAN0:?}, ${IP_WLAN0_START:?}, ${IP_WLAN0_END:?}, 255.255.255.0, 1h
+
+##########
+# DNS (enabled)
+port=53
+#log-queries
+dns-loop-detect
+stop-dns-rebind
+bogus-priv
+domain-needed
+dhcp-option=tag:${INTERFACE_ETH0:?}, option:netbios-ns, 0.0.0.0
+dhcp-option=tag:${INTERFACE_ETH1:?}, option:netbios-ns, 0.0.0.0
+dhcp-option=tag:${INTERFACE_WLAN0:?}, option:netbios-ns, 0.0.0.0
+dhcp-option=tag:${INTERFACE_ETH0:?}, option:netbios-dd, 0.0.0.0
+dhcp-option=tag:${INTERFACE_ETH1:?}, option:netbios-dd, 0.0.0.0
+dhcp-option=tag:${INTERFACE_WLAN0:?}, option:netbios-dd, 0.0.0.0
+
+# PXE (enabled)
+# warning: unfortunately, a RPi3 identifies itself as of architecture x86PC (x86PC=0)
+dhcp-mac=set:IS_RPI3,B8:27:EB:*:*:*
+dhcp-mac=set:IS_RPI4,DC:A6:32:*:*:*
+dhcp-match=set:ARCH_0, option:client-arch, 0
+
+# test if it is a RPi or a regular x86PC
+tag-if=set:ARM_RPI, tag:ARCH_0, tag:IS_RPI3
+tag-if=set:ARM_RPI, tag:ARCH_0, tag:IS_RPI4
+
+##########
+# RPi 3
+pxe-service=tag:IS_RPI3,0, "Raspberry Pi Boot ", bootcode.bin
+dhcp-boot=tag:IS_RPI3, bootcode.bin
+
+
+##########
+# iPXE
+dhcp-match=set:iPXE, option:user-class, iPXE
+dhcp-match=set:ipxe.priority, 175, 1 #= signed integer 8;
+dhcp-match=set:ipxe.keep-san, 175, 8 #= unsigned integer 8;
+dhcp-match=set:ipxe.skip-san-boot, 175, 9 #= unsigned integer 8;
+dhcp-match=set:ipxe.syslogs, 175, 85 #= string;
+dhcp-match=set:ipxe.cert, 175, 91 #= string;
+dhcp-match=set:ipxe.privkey, 175, 92 #= string;
+dhcp-match=set:ipxe.crosscert, 175, 93 #= string;
+dhcp-match=set:ipxe.no-pxedhcp, 175, 176 #= unsigned integer 8;
+dhcp-match=set:ipxe.bus-id, 175, 177 #= string;
+dhcp-match=set:ipxe.san-filename, 175, 188 #= string;
+dhcp-match=set:ipxe.bios-drive, 175, 189 #= unsigned integer 8;
+dhcp-match=set:ipxe.username, 175, 190 #= string;
+dhcp-match=set:ipxe.password, 175, 191 #= string;
+dhcp-match=set:ipxe.reverse-username, 175, 192 #= string;
+dhcp-match=set:ipxe.reverse-password, 175, 193 #= string;
+dhcp-match=set:ipxe.version, 175, 235 #= string;
+dhcp-match=set:iscsi-initiator-iqn, 175, 203 #= string;
+# Feature indicators
+dhcp-match=set:ipxe.pxeext, 175, 16 #= unsigned integer 8;
+dhcp-match=set:ipxe.iscsi, 175, 17 #= unsigned integer 8;
+dhcp-match=set:ipxe.aoe, 175, 18 #= unsigned integer 8;
+dhcp-match=set:ipxe.http, 175, 19 #= unsigned integer 8;
+dhcp-match=set:ipxe.https, 175, 20 #= unsigned integer 8;
+dhcp-match=set:ipxe.tftp, 175, 21 #= unsigned integer 8;
+dhcp-match=set:ipxe.ftp, 175, 22 #= unsigned integer 8;
+dhcp-match=set:ipxe.dns, 175, 23 #= unsigned integer 8;
+dhcp-match=set:ipxe.bzimage, 175, 24 #= unsigned integer 8;
+dhcp-match=set:ipxe.multiboot, 175, 25 #= unsigned integer 8;
+dhcp-match=set:ipxe.slam, 175, 26 #= unsigned integer 8;
+dhcp-match=set:ipxe.srp, 175, 27 #= unsigned integer 8;
+dhcp-match=set:ipxe.nbi, 175, 32 #= unsigned integer 8;
+dhcp-match=set:ipxe.pxe, 175, 33 #= unsigned integer 8;
+dhcp-match=set:ipxe.elf, 175, 34 #= unsigned integer 8;
+dhcp-match=set:ipxe.comboot, 175, 35 #= unsigned integer 8;
+dhcp-match=set:ipxe.efi, 175, 36 #= unsigned integer 8;
+dhcp-match=set:ipxe.fcoe, 175, 37 #= unsigned integer 8;
+dhcp-match=set:ipxe.vlan, 175, 38 #= unsigned integer 8;
+dhcp-match=set:ipxe.menu, 175, 39 #= unsigned integer 8;
+dhcp-match=set:ipxe.sdi, 175, 40 #= unsigned integer 8;
+dhcp-match=set:ipxe.nfs, 175, 41 #= unsigned integer 8;
+
+
+##########
+# PXE Linux
+dhcp-match=set:x86_UEFI, option:client-arch, 6
+dhcp-match=set:x64_UEFI, option:client-arch, 7
+dhcp-match=set:x64_UEFI, option:client-arch, 9
+tag-if=set:x86_BIOS, tag:ARCH_0, tag:!ARM_RPI
+
+#pxe-service=tag:x86_BIOS,x86PC, "PXE Boot Menu (BIOS 00:00)", ${DST_PXE_BIOS:?}/lpxelinux
+#pxe-service=6, "PXE Boot Menu (UEFI 00:06)", ${DST_PXE_EFI32:?}/bootia32.efi
+#pxe-service=tag:x86-64_EFI, "PXE Boot Menu (UEFI 00:07)", ${DST_PXE_EFI64:?}/bootx64.efi
+#pxe-service=9, "PXE Boot Menu (UEFI 00:09)", ${DST_PXE_EFI64:?}/bootx64.efi
+
+tag-if=set:ipxe_feature_rich, tag:iPXE,tag:ipxe.priority,tag:ipxe.bus-id,tag:ipxe.version,tag:ipxe.pxeext,tag:ipxe.iscsi,tag:ipxe.aoe,tag:ipxe.http,tag:ipxe.tftp,tag:ipxe.dns,tag:ipxe.bzimage,tag:ipxe.multiboot,tag:ipxe.pxe,tag:ipxe.elf,tag:ipxe.menu
+dhcp-boot=tag:iPXE,tag:ipxe_feature_rich, menu-ipxe/menu.ipxe
+dhcp-boot=tag:iPXE,tag:!ipxe_feature_rich,tag:x86_BIOS, menu-ipxe/undionly.kpxe
+dhcp-boot=tag:iPXE,tag:!ipxe_feature_rich,tag:!x86_BIOS, menu-ipxe/ipxe.efi
+dhcp-option=tag:iPXE,tag:ipxe_feature_rich, option6:bootfile-url, tftp://[fd80::${IP_ETH0:?}]/menu-ipxe/menu.ipxe
+dhcp-option=tag:iPXE,tag:!ipxe_feature_rich,tag:x86_BIOS, option6:bootfile-url, tftp://[fd80::${IP_ETH0:?}]/menu-ipxe/undionly.kpxe
+dhcp-option=tag:iPXE,tag:!ipxe_feature_rich,tag:!x86_BIOS, option6:bootfile-url, tftp://[fd80::${IP_ETH0:?}]/menu-ipxe/ipxe.efi
+
+dhcp-boot=tag:!iPXE,tag:x86_BIOS, ${DST_PXE_BIOS:?}/lpxelinux.0
+dhcp-boot=tag:!iPXE,tag:x86_UEFI, ${DST_PXE_EFI32:?}/bootia32.efi
+dhcp-boot=tag:!iPXE,tag:x64_UEFI, ${DST_PXE_EFI64:?}/bootx64.efi
+dhcp-option=tag:!iPXE,tag:x86_BIOS, option6:bootfile-url, tftp://[fd80::${IP_ETH0:?}]/${DST_PXE_BIOS:?}/lpxelinux.0
+dhcp-option=tag:!iPXE,tag:x86_UEFI, option6:bootfile-url, tftp://[fd80::${IP_ETH0:?}]/${DST_PXE_EFI32:?}/bootia32.efi
+dhcp-option=tag:!iPXE,tag:x64_UEFI, option6:bootfile-url, tftp://[fd80::${IP_ETH0:?}]/${DST_PXE_EFI64:?}/bootx64.efi
+
+EOF
+ sudo systemctl restart dnsmasq.service;
+ }
+}
+
+
+########################################################################
+# https://github.com/RPi-Distro/firmware-nonfree/tree/bullseye/debian/config/brcm80211/cypress
+# https://github.com/RPi-Distro/firmware-nonfree/tree/bookworm/debian/config/brcm80211/cypress
+#
+# The file cyfmac43455-sdio-minimal.bin is an alternative firmware that has been
+# tuned to maximise the number of clients in AP mode while still supporting STA
+# mode.
+#
+# sudo update-alternatives --config cyfmac43455-sdio.bin
+#
+handle_hostapd() {
+ echo -e "\e[32mhandle_hostapd()\e[0m";
+
+ ####################################################################
+ grep -q mod_install_server /etc/hostapd/hostapd.conf || {
+ echo -e "\e[36m setup hostapd.conf for wlan access point\e[0m";
+ do_backup etc/hostapd/hostapd.conf
+ cat << EOF | sudo tee /etc/hostapd/hostapd.conf &>/dev/null
+########################################
+#/etc/hostapd/hostapd.conf
+## mod_install_server
+interface=${INTERFACE_WLAN0:?}
+driver=${DRIVER_WLAN0:?}
+
+
+##### IEEE 802.11 related configuration #######################################
+country_code=${COUNTRY_WLAN0:?}
+ieee80211d=1
+
+##### 802.11b
+#hw_mode=b
+#channel=1
+#channel=6
+#channel=11
+
+##### 802.11g
+hw_mode=g
+channel=1
+#channel=5
+#channel=9
+#channel=13
+
+#channel=1
+#channel=6
+#channel=11
+
+##### 802.11n (hw_mode=g + ieee80211n=1)
+#channel=3
+#channel=11
+
+##### 802.11a
+#hw_mode=a
+#channel=36
+
+#macaddr_acl=1
+#accept_mac_file=/etc/hostapd.accept
+
+ignore_broadcast_ssid=0
+
+# QoS support (gives different packages different priority)
+#wmm_enabled=1
+
+
+##### IEEE 802.11n related configuration ######################################
+ieee80211n=1
+
+
+##### WPA/IEEE 802.11i configuration ##########################################
+# bit 0 (1) = WPA; bit 1 (2) = WEP; (3) = WPA + WEP
+auth_algs=1
+# bit 0 (1) = WPA; bit 1 (2) = WPA2 (IEEE822.11i/RSN); (3) = WPA + WPA2
+wpa=2
+wpa_key_mgmt=WPA-PSK
+# WPA2 encryption algorithm
+rsn_pairwise=CCMP
+
+#wpa_passphrase=${PASSWORD_WLAN0:?}
+wpa_psk=$(wpa_passphrase ${SSID_WLAN0:?} ${PASSWORD_WLAN0:?} | grep '[[:blank:]]psk' | cut -d = -f2)
+ssid=${SSID_WLAN0:?}
+
+
+## optional: create virtual wlan adapter
+#auth_algs=1
+#wpa=2
+#wpa_key_mgmt=WPA-PSK
+#rsn_pairwise=CCMP
+##wpa_passphrase=${PASSWORD_WLAN0X:?}
+#wpa_psk=$(wpa_passphrase ${SSID_WLAN0X:?} ${PASSWORD_WLAN0X:?} | grep '[[:blank:]]psk' | cut -d = -f2)
+#ssid=${SSID_WLAN0X:?}
+#bss=${INTERFACE_WLAN0X:?}
+EOF
+
+ ################################################################
+ grep -q mod_install_server /etc/default/hostapd || {
+ echo -e "\e[36m setup hostapd for wlan access point\e[0m";
+ do_backup etc/default/hostapd
+ cat << EOF | sudo tee /etc/default/hostapd &>/dev/null
+########################################
+#/etc/default/hostapd
+## mod_install_server
+DAEMON_CONF="/etc/hostapd/hostapd.conf"
+EOF
+ }
+
+ sudo systemctl stop wpa_supplicant;
+ sudo systemctl disable wpa_supplicant;
+ sudo rfkill unblock wlan;
+
+ sudo systemctl unmask hostapd;
+ sudo systemctl enable hostapd;
+ sudo systemctl restart hostapd;
+ }
+}
+
+
+########################################################################
+handle_optional() {
+ echo -e "\e[32mhandle_optional()\e[0m";
+
+ ####################################################################
+ ## network nat
+ grep -q mod_install_server /etc/sysctl.conf 2> /dev/null || {
+ echo -e "\e[36m setup sysctrl for nat\e[0m";
+ do_backup etc/sysctl.conf
+ cat << EOF | sudo tee -a /etc/sysctl.conf &>/dev/null
+########################################
+## mod_install_server
+net.ipv4.ip_forward=1
+net.ipv6.conf.all.forwarding=1
+net.ipv6.conf.${INTERFACE_ETH0:?}.accept_ra=2
+net.ipv6.conf.${INTERFACE_ETH1:?}.accept_ra=2
+net.ipv6.conf.${INTERFACE_WLAN0:?}.accept_ra=2
+EOF
+ sudo sysctl -p &>/dev/null
+ sudo sysctl --system &>/dev/null
+ }
+
+
+ ####################################################################
+ ## network firewall
+ grep -q mod_install_server /etc/default/nfs-kernel-server 2> /dev/null || {
+ echo -e "\e[36m setup nfs-kernel-server for firewall\e[0m";
+ do_backup etc/default/nfs-kernel-server
+ sudo sed /etc/default/nfs-kernel-server -i -e 's/RPCMOUNTDOPTS=.*$/RPCMOUNTDOPTS=\"--manage-gids -p 20048\"/'
+ echo '# mod_install_server' | sudo tee -a /etc/default/nfs-kernel-server &>/dev/null
+ }
+ grep -q mod_install_server /etc/nftables.conf 2> /dev/null || {
+ echo -e "\e[36m setup nftables for firewall\e[0m";
+ do_backup etc/nftables.conf
+ cat << EOF | sudo tee /etc/nftables.conf &> /dev/null
+#!/usr/sbin/nft -f
+
+## mod_install_server
+## mod_install_stratum_one
+
+# https://wiki.nftables.org/wiki-nftables/index.php/Main_Page
+# https://wiki.nftables.org/wiki-nftables/index.php/Simple_ruleset_for_a_home_router
+# https://www.netfilter.org/projects/nftables/manpage.html
+# /etc/nftables.conf
+# sudo nft -f my_file
+# sudo nft list ruleset
+# sudo nft -j list ruleset
+
+flush ruleset
+
+define DEV_PRIVATE = ${INTERFACE_ETH0:?}
+define DEV_WORLD = ${INTERFACE_WLAN0:?}
+define DEV_WORLD2 = ${INTERFACE_ETH1:?}
+define NET_PRIVATE = ${IP_ETH0_0:?}
+define NET6_PRIVATE = { fd80::0/96, }
+
+table ip global {
+
+ chain inbound_world {
+ #icmp type echo-request limit rate 1/second burst 2 packets accept
+
+ #ip protocol . th dport vmap {
+ # udp . 53 : accept, tcp . 53 : accept, # DNS
+ # udp . 5353 : accept, # mDNS
+ # udp . 67 : accept, # DHCP
+ # udp . 123 : accept, # NTP
+ #}
+ }
+
+ chain inbound_private {
+ icmp type echo-request limit rate 1/second burst 2 packets accept
+
+ ip protocol . th dport vmap {
+ udp . 53 : accept, tcp . 53 : accept, # DNS
+ udp . 5353 : accept, # mDNS
+ udp . 67 : accept, # DHCP
+ udp . 123 : accept, # NTP
+ tcp . 139 : accept, tcp . 445 : accept, # SMB
+ tcp . 80 : accept, # HTTP
+ udp . 69 : accept, # TFTP
+ udp . 111 : accept, tcp . 111 : accept, # RPC-BIND
+ udp . 2049 : accept, tcp . 2049 : accept, # NFS
+ udp . 20048 : accept, tcp . 20048 : accept, # RPC-MOUNTD
+ tcp . 22 : accept, # SSH
+ tcp . 5900 : accept, # VNC
+ tcp . 2947 : accept, # GPSD
+ }
+ }
+
+ chain inbound {
+ type filter hook input priority 0; policy drop;
+
+ # Allow traffic from established and related packets, drop invalid
+ ct state vmap {
+ established : accept,
+ related : accept,
+ invalid : drop
+ }
+
+ # allow loopback traffic, anything else jump to chain for further evaluation
+ iifname vmap {
+ lo : accept,
+ \$DEV_PRIVATE : jump inbound_private,
+ \$DEV_WORLD : jump inbound_world,
+ \$DEV_WORLD2 : jump inbound_world,
+ }
+
+ # the rest is dropped by the above policy
+ }
+
+ chain forward {
+ type filter hook forward priority 0; policy drop;
+
+ # Allow traffic from established and related packets, drop invalid
+ ct state vmap {
+ established : accept,
+ related : accept,
+ invalid : drop
+ }
+
+ # connections from the internal net to the internet or to other
+ # internal nets are allowed
+ iifname \$DEV_PRIVATE accept
+
+ # the rest is dropped by the above policy
+ }
+
+ chain postrouting {
+ type nat hook postrouting priority 100; policy accept;
+
+ # masquerade private IP addresses
+ #ip saddr \$NET_PRIVATE oifname \$DEV_WORLD masquerade
+
+ # masquerade traffic from private interface
+ #iifname \$DEV_PRIVATE oifname \$DEV_WORLD masquerade
+
+ # masquerade all traffic to world interface
+ oifname \$DEV_WORLD masquerade
+ }
+}
+
+# TODO
+table ip6 global {
+ chain inbound {
+ type filter hook input priority 0; policy drop;
+ }
+ chain forward {
+ type filter hook forward priority 0; policy drop;
+ }
+ chain postrouting {
+ type filter hook postrouting priority 0; policy drop;
+ }
+}
+EOF
+ }
+}
+
+
+########################################################################
+handle_samba() {
+ echo -e "\e[32mhandle_samba()\e[0m";
+
+ ####################################################################
+ grep -q mod_install_server /etc/samba/smb.conf 2> /dev/null || ( \
+ echo -e "\e[36m setup samba\e[0m";
+ do_backup etc/samba/smb.conf
+ #sudo sed -i /etc/samba/smb.conf -n -e "1,/#======================= Share Definitions =======================/p";
+ cat << EOF | sudo tee /etc/samba/smb.conf &>/dev/null
+########################################
+## mod_install_server
+#======================= Global Settings =======================
+[global]
+
+## Browsing/Identification ###
+ workgroup = WORKGROUP
+dns proxy = yes
+enhanced browsing = no
+
+#### Networking ####
+interfaces = ${IP_ETH0_0:?} ${INTERFACE_ETH0:?}
+bind interfaces only = yes
+
+#### Debugging/Accounting ####
+ log file = /var/log/samba/log.%m
+ max log size = 1000
+ syslog = 0
+ panic action = /usr/share/samba/panic-action %d
+
+####### Authentication #######
+ server role = standalone server
+ obey pam restrictions = yes
+ unix password sync = yes
+ passwd program = /usr/bin/passwd %u
+ passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
+ pam password change = yes
+ map to guest = bad user
+
+########## Domains ###########
+
+############ Misc ############
+ usershare allow guests = yes
+
+#======================= Share Definitions =======================
+[srv]
+ path = ${DST_ROOT:?}
+ comment = /srv folder of pxe-server
+ guest ok = yes
+ guest only = yes
+ browseable = no
+ read only = no
+ create mask = 0644
+ directory mask = 0755
+ force create mode = 0644
+ force directory mode = 0755
+ force user = root
+ force group = root
+ hide dot files = no
+
+[media]
+ path = /media/
+ comment = /media folder of pxe-server
+ guest ok = yes
+ guest only = yes
+ browseable = no
+ read only = no
+ create mask = 0644
+ directory mask = 0755
+ force create mode = 0644
+ force directory mode = 0755
+ force user = $USER
+ force group = $USER
+ hide dot files = no
+EOF
+ sudo systemctl restart smbd.service;
+ )
+}
+
+
+########################################################################
+sudo mkdir -p "${DST_ISO:?}";
+sudo mkdir -p "${DST_IMG:?}";
+sudo mkdir -p "${DST_TFTP_ETH0:?}";
+sudo mkdir -p "${DST_NFS_ETH0:?}";
+
+
+########################################################################
+if [[ -d "/var/www/html" ]]; then
+ [[ -d "/var/www/html/srv" ]] || sudo mkdir -p /var/www/html/srv
+ [[ -h "/var/www/html/srv${ISO:?}" ]] || sudo ln -s "${DST_ISO:?}" "/var/www/html/srv${ISO:?}";
+ [[ -h "/var/www/html/srv${IMG:?}" ]] || sudo ln -s "${DST_IMG:?}" "/var/www/html/srv${IMG:?}";
+ [[ -h "/var/www/html/srv${NFS_ETH0:?}" ]] || sudo ln -s "${DST_NFS_ETH0:?}" "/var/www/html/srv${NFS_ETH0:?}";
+fi
+
+
+########################################################################
+handle_hostapd;
+handle_dhcpcd;
+handle_dnsmasq;
+handle_samba;
+handle_optional;
+handle_chrony;
+
+
+########################################################################
+. "${script_dir:?}/p2-update"
+
+
+########################################################################
+#sync
+#echo -e "\e[32mDone.\e[0m";
+echo -e "\e[1;31mPlease reboot\e[0m";
diff --git a/p2-include-handle b/p2-include-handle
new file mode 100644
index 0000000..364bacb
--- /dev/null
+++ b/p2-include-handle
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+#
+# Action:
+# '+' = Add image to PXE service
+# Download if not there
+# Update if new version is available
+#
+# '-' = Remove image from PXE service
+# Free resources on server
+# If backup exist, keep updating backup
+#
+# '#' = Skip image handling
+# Keep everything untouched
+# Does not updating backup
+# Good, when timestamping option is set but want to keep the current version and you don't want to download each daily update
+#
+# Type:
+# iso = Iso image (ISO, UDF, ISO_HYBRID)
+#
+# img = Hard drive image (MPT, GPT)
+#
+# kernel = Kernel
+#
+# zip_img = Zip file containing a hard drive image (zip -> img -> MTP/GPT)
+#
+# rpi_pxe = Only if you want to pxe boot a RPi3.
+# Copies files from its selected image boot & root partition to PXE server directories
+# Requires an already mounted hard drive image (img or zip_img)
+# Note: Action '-' does nothing for rpi_pxe. It is not implemented.
+# You have to free resources for rpi_pxe by hand
+# Note:
+# Do not put the $ in fornt of the VARIABLE name !!!
+# the handle_item functions do need the NAME of the VARIABLE (without _URL)
+
+########################################################################
+#-----------+----+-----+------------------------+-----------------------
+#exec |act.|type |VAR. name of item |optional options
+handle_item '-' iso BLACKARCH_X64;
+handle_item '-' iso BUNSEN_X64;
+handle_item '-' iso CLONEZILLA_X64;
+handle_item '-' iso CLONEZILLA_X86;
+handle_item '+' iso DEBIAN_X64;
+handle_item '-' iso DEBIAN_X86;
+handle_item '-' iso DEVUAN_X64;
+handle_item '-' iso DEVUAN_X86;
+handle_item '-' iso DRAGONOS_X64;
+handle_item '-' iso ESET_SYSRESCUE_X86;
+handle_item '-' iso EMMABUNTUS_X64;
+handle_item '-' iso EMMABUNTUS_X86;
+handle_item '+' iso FEDORA_X64;
+handle_item '-' iso FINNIX_X64;
+handle_item '-' iso GNURADIO_X64;
+handle_item '-' iso KALI_X64;
+handle_item '#' iso KASPERSKY_RESCUE_X86 timestamping;
+handle_item '-' iso KNOPPIX_X86;
+handle_item '#' iso LUBUNTU_DAILY_X64 timestamping;
+handle_item '-' iso LUBUNTU_LTS_X64;
+handle_item '-' iso LUBUNTU_LTS_X86;
+handle_item '-' iso LUBUNTU_X64;
+handle_item '-' iso LUBUNTU_X86;
+handle_item '-' iso MINT_X64;
+handle_item '#' iso OPENSUSE_RESCUE_X64 timestamping ,gid=root,uid=root,norock,mode=292 vbladed 0 1;
+handle_item '#' iso OPENSUSE_X64 timestamping ,gid=root,uid=root,norock,mode=292 vbladed 1 1;
+handle_item '-' iso PARROT_FULL_X64;
+handle_item '-' iso PARROT_LITE_X64;
+handle_item '#' iso PENTOO_BETA_X64 timestamping;
+handle_item '#' iso PENTOO_X64 timestamping;
+handle_item '#' iso RPDESKTOP_X86 timestamping;
+handle_item '-' iso RESCUEZILLA_X64;
+handle_item '-' iso SYSTEMRESCUE_X64;
+handle_item '-' iso TAILS_X64;
+handle_item '+' iso TINYCORE_X64 timestamping;
+handle_item '#' iso TINYCORE_X86 timestamping;
+handle_item '#' iso UBUNTU_DAILY_X64 timestamping;
+handle_item '-' iso UBUNTU_LTS_X64;
+handle_item '-' iso UBUNTU_LTS_X86;
+handle_item '#' iso UBUNTU_STUDIO_DAILY_X64 timestamping;
+handle_item '-' iso UBUNTU_STUDIO_X64;
+handle_item '+' iso UBUNTU_X64;
+
+#custom#
+handle_item '+' iso DESINFECT_X64;
+handle_item '+' iso DESINFECT_X86;
+handle_item '-' iso UBUNTU_NONPAE;
+handle_item '+' iso WIN_PE_X86;
+handle_item '+' iso WIN_PE_X64;
+
+#broken#
+handle_item '-' iso ANDROID_X86;
+
+#discontinued# handle_item '#' iso CENTOS_X64;
+#discontinued# handle_item '#' iso DEFT_X64;
+#discontinued# handle_item '#' iso DEFTZ_X64 ,gid=root,uid=root,norock,mode=292;
+
+
+########################################################################
+#-----------+----+-----+------------------------+-----------------------
+#exec |act.|type |VAR. name of item |optional options
+handle_item '-' img UBUNTU_FWTS;
+
+
+########################################################################
+#-----------+----+--------+--------------------+------------------------
+#exec |act.|type |VAR. name of item |optional options
+handle_item '#' kernel ARCH_NETBOOT_X64 timestamping;
+
+
+########################################################################
+#-----------+----+--------+--------------------+------------------------
+#exec |act.|type |VAR. name of item |optional options
+handle_item '-' zip_img PI_CORE;
+handle_item '#' zip_img RPD_BASIC timestamping;
+handle_item '#' zip_img RPD_FULL timestamping;
+handle_item '#' zip_img RPD_LITE timestamping;
+
+
+########################################################################
+## must be the last, because it requireas an already mounted image
+########################################################################
+#-----------+----+--------+----------+---------+------------------------
+#exec |act.|type |VAR. name |VAR. sn |optional options
+handle_item '-' rpi_pxe PI_CORE RPI_SN0 bootcode,config,root;
+handle_item '-' rpi_pxe RPD_BASIC RPI_SN0 bootcode,cmdline,config,ssh,root,fstab,wpa,history,apt;
+handle_item '-' rpi_pxe RPD_FULL RPI_SN0 bootcode,cmdline,config,ssh,root,fstab,wpa,history,apt;
+handle_item '-' rpi_pxe RPD_LITE RPI_SN0 bootcode,cmdline,config,ssh,root,fstab,wpa,history,apt;
diff --git a/p2-include-menu b/p2-include-menu
new file mode 100644
index 0000000..930d299
--- /dev/null
+++ b/p2-include-menu
@@ -0,0 +1,1880 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+if ! [[ "$1" == "ipxe" ]]
+then
+########################################################################
+## lpxelinux
+
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Live operating systems ---\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Live operating systems ------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$ARCH_NETBOOT_X64/kernel" ]]; then
+ echo -e "\e[36m add $ARCH_NETBOOT_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ # INFO: https://www.archlinux.org/releng/netboot/
+ LABEL $ARCH_NETBOOT_X64
+ MENU LABEL Arch netboot x64
+ # KERNEL https://www.archlinux.org/static/netboot/ipxe.lkrn
+ KERNEL $FILE_BASE$NFS_ETH0/$ARCH_NETBOOT_X64/kernel
+ TEXT HELP
+ Boot to Arch netboot x64
+ User: root
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$BUNSEN_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $BUNSEN_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $BUNSEN_X64
+ MENU LABEL Bunsen x64
+ KERNEL $FILE_BASE$NFS_ETH0/$BUNSEN_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$BUNSEN_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$BUNSEN_X64 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Bunsen x64 Live LXDE
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DEBIAN_TESTING_X64/live/vmlinuz$DEBIAN_TESTING_KVER" ]]; then
+ echo -e "\e[36m add $DEBIAN_TESTING_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DEBIAN_TESTING_X64
+ MENU LABEL Debian x64 (testing)
+ KERNEL $FILE_BASE$NFS_ETH0/$DEBIAN_TESTING_X64/live/vmlinuz$DEBIAN_TESTING_KVER
+ INITRD $FILE_BASE$NFS_ETH0/$DEBIAN_TESTING_X64/live/initrd.img$DEBIAN_TESTING_KVER
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEBIAN_TESTING_X64 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Debian x64 Live (testing)
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DEBIAN_X64/live/vmlinuz$DEBIAN_KVER" ]]; then
+ echo -e "\e[36m add $DEBIAN_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DEBIAN_X64
+ MENU LABEL Debian x64
+ KERNEL $FILE_BASE$NFS_ETH0/$DEBIAN_X64/live/vmlinuz$DEBIAN_KVER
+ INITRD $FILE_BASE$NFS_ETH0/$DEBIAN_X64/live/initrd.img$DEBIAN_KVER
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEBIAN_X64 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Debian x64 Live LXDE
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DEBIAN_X86/live/vmlinuz$DEBIAN_KVER_X86" ]]; then
+ echo -e "\e[36m add $DEBIAN_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DEBIAN_X86
+ MENU LABEL Debian x86
+ KERNEL $FILE_BASE$NFS_ETH0/$DEBIAN_X86/live/vmlinuz$DEBIAN_KVER_X86
+ INITRD $FILE_BASE$NFS_ETH0/$DEBIAN_X86/live/initrd.img$DEBIAN_KVER_X86
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEBIAN_X86 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Debian x86 Live LXDE
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DEVUAN_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $DEVUAN_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DEVUAN_X64
+ MENU LABEL Devuan x64
+ KERNEL $FILE_BASE$NFS_ETH0/$DEVUAN_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$DEVUAN_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEVUAN_X64 ro netboot=nfs boot=live username=devuan config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Devuan x64 Live
+ User: devuan
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DEVUAN_X86/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $DEVUAN_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DEVUAN_X86
+ MENU LABEL Devuan x86
+ KERNEL $FILE_BASE$NFS_ETH0/$DEVUAN_X86/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$DEVUAN_X86/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEVUAN_X86 ro netboot=nfs boot=live username=devuan config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Devuan x86 Live
+ User: devuan
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$FEDORA_X64/images/pxeboot/vmlinuz" ]]; then
+ echo -e "\e[36m add $FEDORA_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ ## INFO: http://people.redhat.com/harald/dracut.html#dracut.kernel
+ ## https://github.com/haraldh/dracut/blob/master/dracut.cmdline.7.asc
+ ## https://lukas.zapletalovi.com/2016/08/hidden-feature-of-fedora-24-live-pxe-boot.html
+ LABEL $FEDORA_X64
+ MENU LABEL Fedora x64
+ KERNEL $FILE_BASE$NFS_ETH0/$FEDORA_X64/images/pxeboot/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$FEDORA_X64/images/pxeboot/initrd.img
+ APPEND ip=dhcp root=live:nfs://$IP_ETH0$DST_NFS_ETH0/$FEDORA_X64/LiveOS/squashfs.img ro rd.live.image rd.lvm=0 rd.luks=0 rd.md=0 rd.dm=0 vga=794 fsck.mode=skip -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=$CUSTOM_KEYMAP locale.LANG=$CUSTOM_LOCALE
+ TEXT HELP
+ Boot to Fedora Workstation Live
+ User: liveuser
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$EMMABUNTUS_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $EMMABUNTUS_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $EMMABUNTUS_X64
+ MENU LABEL EmmaDE x64
+ KERNEL $FILE_BASE$NFS_ETH0/$EMMABUNTUS_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$EMMABUNTUS_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$EMMABUNTUS_X64 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to EmmaDE x64 Live LXDE
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$EMMABUNTUS_X86/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $EMMABUNTUS_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $EMMABUNTUS_X86
+ MENU LABEL EmmaDE x86
+ KERNEL $FILE_BASE$NFS_ETH0/$EMMABUNTUS_X86/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$EMMABUNTUS_X86/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$EMMABUNTUS_X86 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to EmmaDE x86 Live LXDE
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$LUBUNTU_DAILY_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $LUBUNTU_DAILY_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $LUBUNTU_DAILY_X64
+ MENU LABEL lubuntu x64 Daily-Live
+ KERNEL $FILE_BASE$NFS_ETH0/$LUBUNTU_DAILY_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$LUBUNTU_DAILY_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$LUBUNTU_DAILY_X64 ro netboot=nfs file=/cdrom/preseed/lubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to lubuntu x64 Daily-Live
+ User: lubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$LUBUNTU_LTS_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $LUBUNTU_LTS_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $LUBUNTU_LTS_X64
+ MENU LABEL lubuntu LTS x64
+ KERNEL $FILE_BASE$NFS_ETH0/$LUBUNTU_LTS_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$LUBUNTU_LTS_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$LUBUNTU_LTS_X64 ro netboot=nfs file=/cdrom/preseed/lubuntu.seed boot=casper fsck.mode=skip systemd.mask=tmp.mount -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to lubuntu LTS x64 Live
+ User: lubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$LUBUNTU_LTS_X86/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $LUBUNTU_LTS_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $LUBUNTU_LTS_X86
+ MENU LABEL lubuntu LTS x86
+ KERNEL $FILE_BASE$NFS_ETH0/$LUBUNTU_LTS_X86/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$LUBUNTU_LTS_X86/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$LUBUNTU_LTS_X86 ro netboot=nfs file=/cdrom/preseed/lubuntu.seed boot=casper fsck.mode=skip systemd.mask=tmp.mount -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to lubuntu LTS x86 Live
+ User: lubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$LUBUNTU_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $LUBUNTU_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $LUBUNTU_X64
+ MENU LABEL lubuntu x64
+ KERNEL $FILE_BASE$NFS_ETH0/$LUBUNTU_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$LUBUNTU_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$LUBUNTU_X64 ro netboot=nfs file=/cdrom/preseed/lubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to lubuntu x64 Live
+ User: lubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$LUBUNTU_X86/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $LUBUNTU_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $LUBUNTU_X86
+ MENU LABEL lubuntu x86
+ KERNEL $FILE_BASE$NFS_ETH0/$LUBUNTU_X86/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$LUBUNTU_X86/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$LUBUNTU_X86 ro netboot=nfs file=/cdrom/preseed/lubuntu.seed boot=casper fsck.mode=skip systemd.mask=tmp.mount -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to lubuntu x86 Live
+ User: lubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$MINT_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $MINT_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $MINT_X64
+ MENU LABEL linux-mint x64
+ KERNEL $FILE_BASE$NFS_ETH0/$MINT_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$MINT_X64/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$MINT_X64 ro netboot=nfs file=/cdrom/preseed/linuxmint.seed boot=casper fsck.mode=skip systemd.mask=tmp.mount -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to linux-mint x64 Live
+ User:
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$OPENSUSE_X64/boot/x86_64/loader/linux" ]]; then
+ echo -e "\e[36m add $OPENSUSE_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $OPENSUSE_X64
+ MENU LABEL openSUSE Leap x64
+ KERNEL $FILE_BASE$NFS_ETH0/$OPENSUSE_X64/boot/x86_64/loader/linux
+ INITRD $FILE_BASE$NFS_ETH0/$OPENSUSE_X64/boot/x86_64/loader/initrd
+ APPEND ip=dhcp root=live:AOEINTERFACE=e1.1 rd.kiwi.live.pxe --
+ TEXT HELP
+ Boot to openSUSE Leap Live
+ User: liveuser
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$TINYCORE_X64/boot/vmlinuz64" ]]; then
+ echo -e "\e[36m add $TINYCORE_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ # INFO: http://wiki.tinycorelinux.net/wiki:boot_options
+ LABEL $TINYCORE_X64
+ MENU LABEL tiny core x64
+ KERNEL $FILE_BASE$NFS_ETH0/$TINYCORE_X64/boot/vmlinuz64
+ INITRD $FILE_BASE$NFS_ETH0/$TINYCORE_X64/boot/corepure64.gz
+ APPEND ip=dhcp nfsmount=$IP_ETH0:$DST_NFS_ETH0/$TINYCORE_X64 tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 -- lang=$CUSTOM_LANGUAGE kmap=$CUSTOM_KMAP noswap norestore
+ #APPEND ip=dhcp nfsmount=$IP_ETH0:$DST_NFS_ETH0/$TINYCORE_X64.rw tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 -- lang=$CUSTOM_LANGUAGE kmap=$CUSTOM_KMAP noswap norestore
+ #APPEND ip=dhcp httplist=$IP_ETH0$DST_NFS_ETH0/tinycore-x64.xbase.lst vga=791 loglevel=3 -- lang=$CUSTOM_LANGUAGE kmap=$CUSTOM_KMAP tz=$CUSTOM_TIMEZONE noswap norestore settime showapps pause
+ TEXT HELP
+ Boot to tiny core x64
+ User: tc
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$TINYCORE_X64/boot/vmlinuz64" ]]; then
+ echo -e "\e[36m add $TINYCORE_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ # INFO: http://wiki.tinycorelinux.net/wiki:boot_options
+ LABEL $TINYCORE_X64 (ISO)
+ MENU LABEL tiny core x64 (ISO)
+ KERNEL memdisk
+ APPEND iso
+ INITRD $FILE_BASE$ISO/$TINYCORE_X64.iso
+ TEXT HELP
+ Boot to tiny core x64
+ User: tc
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$TINYCORE_X86/boot/vmlinuz" ]]; then
+ echo -e "\e[36m add $TINYCORE_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ # INFO: http://wiki.tinycorelinux.net/wiki:boot_options
+ LABEL $TINYCORE_X86
+ MENU LABEL tiny core x86
+ KERNEL $FILE_BASE$NFS_ETH0/$TINYCORE_X86/boot/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$TINYCORE_X86/boot/core.gz
+ APPEND nfsmount=$IP_ETH0:$DST_NFS_ETH0/$TINYCORE_X86 tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 -- lang=en kmap=qwertz/de-latin1 noswap norestore
+ #APPEND ip=dhcp nfsmount=$IP_ETH0:$DST_NFS_ETH0/$TINYCORE_X86.rw tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 -- lang=$CUSTOM_LANGUAGE kmap=$CUSTOM_KMAP noswap norestore
+ TEXT HELP
+ Boot to tiny core x86
+ User: tc
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_DAILY_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_DAILY_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_DAILY_X64
+ MENU LABEL Ubuntu x64 Daily-Live
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_DAILY_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_DAILY_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_DAILY_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu x64 Daily-Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_LTS_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_LTS_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_LTS_X64
+ MENU LABEL Ubuntu LTS x64
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_LTS_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_LTS_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_LTS_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip systemd.mask=tmp.mount -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu LTS x64 Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_LTS_X86/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_LTS_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_LTS_X86
+ MENU LABEL Ubuntu LTS x86
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_LTS_X86/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_LTS_X86/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_LTS_X86 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu LTS x86 Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_X64
+ MENU LABEL Ubuntu x64
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu x64 Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_X86/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_X86
+ MENU LABEL Ubuntu x86
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_X86/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_X86/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_X86 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu x86 Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Pentesting systems -------\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Pentesting systems ----------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$BLACKARCH_X64/blackarch/boot/x86_64/vmlinuz-linux" ]]; then
+ echo -e "\e[36m add $BLACKARCH_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $BLACKARCH_X64
+ MENU LABEL BlackArch x64
+ KERNEL $FILE_BASE$NFS_ETH0/$BLACKARCH_X64/blackarch/boot/x86_64/vmlinuz-linux
+ INITRD $FILE_BASE$NFS_ETH0/$BLACKARCH_X64/blackarch/boot/intel-ucode.img,$FILE_BASE$NFS_ETH0/$BLACKARCH_X64/blackarch/boot/amd-ucode.img,$FILE_BASE$NFS_ETH0/$BLACKARCH_X64/blackarch/boot/x86_64/initramfs-linux.img
+ APPEND ip=dhcp ro archisobasedir=blackarch archiso_nfs_srv=$IP_ETH0:$DST_NFS_ETH0/$BLACKARCH_X64 copytoram=n
+ #SYSAPPEND 3
+ TEXT HELP
+ Boot to BlackArch Linux full medium (x86_64, UEFI)
+ User: root, Password: blackarch
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DEFT_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $DEFT_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DEFT_X64
+ MENU LABEL DEFT x64
+ KERNEL $FILE_BASE$NFS_ETH0/$DEFT_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$DEFT_X64/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEFT_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip memtest=4 -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to DEFT x64 Live
+ User: root, Password: toor
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DEFTZ_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $DEFTZ_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DEFTZ_X64
+ MENU LABEL DEFT Zero x64
+ KERNEL $FILE_BASE$NFS_ETH0/$DEFTZ_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$DEFTZ_X64/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DEFTZ_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip memtest=4 -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to DEFT Zero x64 Live
+ User: root, Password: toor
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$KALI_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $KALI_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $KALI_X64
+ MENU LABEL Kali x64
+ KERNEL $FILE_BASE$NFS_ETH0/$KALI_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$KALI_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$KALI_X64 ro netboot=nfs boot=live noconfig=sudo username=kali hostname=kali -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Kali x64 Live
+ User: kali, Password: kali
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$PARROT_FULL_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $PARROT_FULL_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $PARROT_FULL_X64
+ MENU LABEL Parrot Full x64
+ KERNEL $FILE_BASE$NFS_ETH0/$PARROT_FULL_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$PARROT_FULL_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$PARROT_FULL_X64 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE pkeys=$CUSTOM_KMAP setxkbmap=$CUSTOM_KMAP utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Parrot Full x64 Live (Security)
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$PARROT_LITE_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $PARROT_LITE_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $PARROT_LITE_X64
+ MENU LABEL Parrot Lite x64
+ KERNEL $FILE_BASE$NFS_ETH0/$PARROT_LITE_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$PARROT_LITE_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$PARROT_LITE_X64 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE pkeys=$CUSTOM_KMAP setxkbmap=$CUSTOM_KMAP utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Parrot Lite x64 Live (Home/Workstation)
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$PENTOO_BETA_X64/boot/pentoo" ]]; then
+ echo -e "\e[36m add $PENTOO_BETA_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $PENTOO_BETA_X64
+ MENU LABEL Pentoo Beta x64
+ KERNEL $FILE_BASE$NFS_ETH0/$PENTOO_BETA_X64/boot/pentoo
+ INITRD $FILE_BASE$NFS_ETH0/$PENTOO_BETA_X64/boot/pentoo.igz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$PENTOO_BETA_X64 ro real_root=/dev/nfs root=/dev/ram0 init=/linuxrc overlayfs looptype=squashfs loop=/image.squashfs cdroot nox secureconsole max_loop=256 dokeymap video=uvesafb:mtrr:3,ywrap,1024x768-16 console=tty0 scsi_mod.use_blk_mq=1 net.ifnames=0 ipv6.autoconf=0 --
+ TEXT HELP
+ Boot to Pentoo Beta x64 Live
+ User: pentoo
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$PENTOO_X64/boot/pentoo" ]]; then
+ echo -e "\e[36m add $PENTOO_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $PENTOO_X64
+ MENU LABEL Pentoo x64
+ KERNEL $FILE_BASE$NFS_ETH0/$PENTOO_X64/boot/pentoo
+ INITRD $FILE_BASE$NFS_ETH0/$PENTOO_X64/boot/pentoo.igz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$PENTOO_X64 ro real_root=/dev/nfs root=/dev/ram0 init=/linuxrc overlayfs looptype=squashfs loop=/image.squashfs cdroot nox secureconsole max_loop=256 dokeymap video=uvesafb:mtrr:3,ywrap,1024x768-16 console=tty0 scsi_mod.use_blk_mq=1 net.ifnames=0 ipv6.autoconf=0 --
+ TEXT HELP
+ Boot to Pentoo x64 Live
+ User: pentoo
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Virus scanner systems ----\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Virus scanner systems -------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DESINFECT_X86/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $DESINFECT_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DESINFECT_X86
+ MENU LABEL desinfect x86
+ KERNEL $FILE_BASE$NFS_ETH0/$DESINFECT_X86/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$DESINFECT_X86/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DESINFECT_X86 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip memtest=4 rmdns -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to ct desinfect x86
+ User: desinfect
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DESINFECT_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $DESINFECT_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DESINFECT_X64
+ MENU LABEL desinfect x64
+ KERNEL $FILE_BASE$NFS_ETH0/$DESINFECT_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$DESINFECT_X64/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DESINFECT_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip memtest=4 rmdns -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to ct desinfect x64
+ User: desinfect
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$ESET_SYSRESCUE_X86/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $ESET_SYSRESCUE_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $ESET_SYSRESCUE_X86
+ MENU LABEL ESET SysRescue Live
+ KERNEL $FILE_BASE$NFS_ETH0/$ESET_SYSRESCUE_X86/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$ESET_SYSRESCUE_X86/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$ESET_SYSRESCUE_X86 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to ESET SysRescue Live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$KASPERSKY_RESCUE_X86/boot/grub/k-x86_64" ]]; then
+ echo -e "\e[36m add $KASPERSKY_RESCUE_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $KASPERSKY_RESCUE_X86
+ MENU LABEL Kaspersky Rescue Disk
+ KERNEL $FILE_BASE$NFS_ETH0/$KASPERSKY_RESCUE_X86/boot/grub/k-x86
+ INITRD $FILE_BASE$NFS_ETH0/$KASPERSKY_RESCUE_X86/boot/grub/initrd.xz
+ APPEND ip=dhcp netboot=nfs://$IP_ETH0:$DST_NFS_ETH0/$KASPERSKY_RESCUE_X86 ro dostartx -- lang=us setkmap=us
+ TEXT HELP
+ Boot to Kaspersky Rescue Disk
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Other systems ------------\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Other systems ---------------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$RESCUEZILLA_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $RESCUEZILLA_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $RESCUEZILLA_X64
+ MENU LABEL Rescuezilla x64
+ KERNEL $FILE_BASE$NFS_ETH0/$RESCUEZILLA_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$RESCUEZILLA_X64/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$RESCUEZILLA_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Rescuezilla x64 Live
+ User:
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$CLONEZILLA_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $CLONEZILLA_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $CLONEZILLA_X64
+ MENU LABEL Clonezilla x64
+ KERNEL $FILE_BASE$NFS_ETH0/$CLONEZILLA_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$CLONEZILLA_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$CLONEZILLA_X64 ro netboot=nfs boot=live config username=user hostname=clonezilla union=overlay components noswap edd=on nomodeset nodmraid ocs_live_run=ocs-live-general ocs_live_extra_param= ocs_live_batch=no net.ifnames=0 nosplash noprompt -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Clonezilla x64
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$CLONEZILLA_X86/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $CLONEZILLA_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $CLONEZILLA_X86
+ MENU LABEL Clonezilla x86
+ KERNEL $FILE_BASE$NFS_ETH0/$CLONEZILLA_X86/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$CLONEZILLA_X86/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$CLONEZILLA_X86 ro netboot=nfs boot=live config username=user hostname=clonezilla union=overlay components noswap edd=on nomodeset nodmraid ocs_live_run=ocs-live-general ocs_live_extra_param= ocs_live_batch=no net.ifnames=0 nosplash noprompt -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Clonezilla x86
+ User: user, Password: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$DRAGONOS_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $DRAGONOS_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $DRAGONOS_X64
+ MENU LABEL DragonOS x64
+ KERNEL $FILE_BASE$NFS_ETH0/$DRAGONOS_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$DRAGONOS_X64/casper/initrd.gz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$DRAGONOS_X64 ro netboot=nfs file=/cdrom/preseed/custom.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to DragonOS x64 Live
+ User: live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$FINNIX_X64/live/vmlinuz" ]]; then
+ echo -e "\e[36m add $FINNIX_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $FINNIX_X64
+ MENU LABEL Finnix x64
+ KERNEL $FILE_BASE$NFS_ETH0/$FINNIX_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$FINNIX_X64/live/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$FINNIX_X64 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Finnix x64 Live
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$GNURADIO_X64/casper/vmlinuz.efi" ]]; then
+ echo -e "\e[36m add $GNURADIO_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $GNURADIO_X64
+ MENU LABEL GNU Radio x64
+ KERNEL $FILE_BASE$NFS_ETH0/$GNURADIO_X64/casper/vmlinuz.efi
+ INITRD $FILE_BASE$NFS_ETH0/$GNURADIO_X64/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$GNURADIO_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to GNU Radio x64 Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$KNOPPIX_X86/boot/isolinux/linux" ]]; then
+ if ! [[ -f "$DST_NFS_ETH0/$KNOPPIX_X86_EXTRA_INITRD" ]]; then
+ echo -e "\e[36m download patch for $KNOPPIX_X86\e[0m";
+ sudo wget --quiet -O $DST_NFS_ETH0/$KNOPPIX_X86_EXTRA_INITRD $KNOPPIX_X86_EXTRA_INITRD_URL
+ fi
+ if [[ -f "$DST_NFS_ETH0/$KNOPPIX_X86_EXTRA_INITRD" ]]; then
+ echo -e "\e[36m add $KNOPPIX_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ ## INFO: https://github.com/beta-tester/RPi-PXE-Server/issues/27
+ ## $ knoppix-terminalserver
+ ## $ cp /tmp/tftproot/miniroot.gz /srv/nfs/knoppix-x86-miniroot.gz
+ LABEL $KNOPPIX_X86
+ MENU LABEL Knoppix x86
+ KERNEL $FILE_BASE$NFS_ETH0/$KNOPPIX_X86/boot/isolinux/linux
+ INITRD $FILE_BASE$NFS_ETH0/$KNOPPIX_X86_EXTRA_INITRD
+ APPEND ip=dhcp nfsdir=$IP_ETH0:$DST_NFS_ETH0/$KNOPPIX_X86 nodhcp ramdisk_size=100000 init=/sbin/init apm=power-off nomce loglevel=1 libata.force=noncq tz=localtime hpsa.hpsa_allow_any=1 BOOT_IMAGE=knoppix -- lang=de
+ TEXT HELP
+ Boot to Knoppix x86 Live
+ ENDTEXT
+EOF
+ else
+ echo -e "\e[1;31m failed $KNOPPIX_X86,\e[0m"
+ echo -e "\e[1;31m please visit: https://github.com/beta-tester/RPi-PXE-Server/issues/27\e[0m";
+ fi
+fi
+#========== END ==========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$OPENSUSE_RESCUE_X64/boot/x86_64/loader/linux" ]]; then
+ echo -e "\e[36m add $OPENSUSE_RESCUE_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $OPENSUSE_RESCUE_X64
+ MENU LABEL openSUSE Leap Rescue x64
+ KERNEL $FILE_BASE$NFS_ETH0/$OPENSUSE_RESCUE_X64/boot/x86_64/loader/linux
+ INITRD $FILE_BASE$NFS_ETH0/$OPENSUSE_RESCUE_X64/boot/x86_64/loader/initrd
+ APPEND ip=dhcp root=live:AOEINTERFACE=e0.1 rd.kiwi.live.pxe --
+ TEXT HELP
+ Boot to openSUSE Leap Rescue Live
+ User: liveuser
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$RPDESKTOP_X86/live/vmlinuz2" ]]; then
+ echo -e "\e[36m add $RPDESKTOP_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $RPDESKTOP_X86
+ MENU LABEL Raspberry Pi Desktop
+ KERNEL $FILE_BASE$NFS_ETH0/$RPDESKTOP_X86/live/vmlinuz2
+ INITRD $FILE_BASE$NFS_ETH0/$RPDESKTOP_X86/live/initrd2.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$RPDESKTOP_X86 ro netboot=nfs boot=live config -- locales=$CUSTOM_LOCALE keyboard-layouts=$CUSTOM_LAYOUTCODE utc=no timezone=$CUSTOM_TIMEZONE
+ TEXT HELP
+ Boot to Raspberry Pi Desktop
+ User: pi, Password: raspberry
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$SYSTEMRESCUE_X64/sysresccd/boot/x86_64/vmlinuz" ]]; then
+ echo -e "\e[36m add $SYSTEMRESCUE_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $SYSTEMRESCUE_X64
+ MENU LABEL System Rescue x64
+ KERNEL $FILE_BASE$NFS_ETH0/$SYSTEMRESCUE_X64/sysresccd/boot/x86_64/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$SYSTEMRESCUE_X64/sysresccd/boot/intel_ucode.img,$FILE_BASE$NFS_ETH0/$SYSTEMRESCUE_X64/sysresccd/boot/amd_ucode.img,$FILE_BASE$NFS_ETH0/$SYSTEMRESCUE_X64/sysresccd/boot/x86_64/sysresccd.img
+ #APPEND archisobasedir=sysresccd archiso_nfs_srv=$IP_ETH0:$DST_NFS_ETH0/$SYSTEMRESCUE_X64
+ APPEND ip=dhcp archisobasedir=sysresccd archiso_http_srv=$FILE_BASE$NFS_ETH0/$SYSTEMRESCUE_X64/
+ #SYSAPPEND 3
+ TEXT HELP
+ Boot to System Rescue x64 Live
+ User: root
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$TAILS_X64/live/vmlinuz" ]]; then
+ if ! [[ -f "$DST_NFS_ETH0/$TAILS_X64-hotfix-pxe.cpio.xz" ]]; then
+ #echo -e "\e[36m download patch for $TAILS_X64\e[0m";
+ #sudo wget --quiet -O $DST_NFS_ETH0/$TAILS_X64-hotfix-pxe.cpio.xz https://github.com/beta-tester/RPi-PXE-Server/files/?/$TAILS_X64-hotfix-pxe.cpio.xz
+ :
+ fi
+ if [[ -f "$DST_NFS_ETH0/$TAILS_X64-hotfix-pxe.cpio.xz" ]]; then
+ echo -e "\e[36m add $TAILS_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ ## INFO: how to create $DST_NFS_ETH0/$TAILS_X64-hotfix-pxe.cpio.xz
+ ## see:
+ ## https://github.com/beta-tester/RPi-PXE-Server/issues/31
+ ########################################
+ LABEL $TAILS_X64
+ MENU LABEL Tails x64
+ KERNEL $FILE_BASE$NFS_ETH0/$TAILS_X64/live/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$TAILS_X64/live/initrd.img,$FILE_BASE$NFS_ETH0/$TAILS_X64-hotfix-pxe.cpio.xz
+ APPEND ip=dhcp fetch=$FILE_BASE$NFS_ETH0/$TAILS_X64/live/filesystem.squashfs ro boot=live config live-media=removable ipv6.disable=1 nopersistence noprompt block.events_dfl_poll_msecs=1000 noautologin module=Tails slab_nomerge slub_debug=FZP mce=0 vsyscall=none page_poison=1 init_on_alloc=1 init_on_free=1 mds=full,nosmt timezone=Etc/UTC systemd.mask=tails-shutdown-on-media-removal.service fsck.mode=skip -- keyboard-layouts=$CUSTOM_LAYOUTCODE
+ TEXT HELP
+ Boot to Tails x64 Live
+ ENDTEXT
+EOF
+ else
+ echo -e "\e[1;31m failed $TAILS_X64,\e[0m"
+ echo -e "\e[1;31m please visit: https://github.com/beta-tester/RPi-PXE-Server/issues/31\e[0m";
+ fi
+fi
+#========== END ==========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_FWTS/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_FWTS\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ ## INFO: https://wiki.ubuntu.com/FirmwareTestSuite/
+ ## https://wiki.ubuntu.com/FirmwareTestSuite/Reference
+ ## http://fwts.ubuntu.com/fwts-live/?C=M;O=D
+ LABEL $UBUNTU_FWTS
+ MENU LABEL Ubuntu Live FirmwareTestSuite
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_FWTS/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_FWTS/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_FWTS ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip toram --
+ TEXT HELP
+ Boot to Ubuntu Live FirmwareTestSuite
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_STUDIO_DAILY_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_STUDIO_DAILY_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_STUDIO_DAILY_X64
+ MENU LABEL Ubuntu Studio x64 Daily-Live
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_STUDIO_DAILY_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_STUDIO_DAILY_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_STUDIO_DAILY_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu Studio x64 Daily-Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_STUDIO_X64/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_STUDIO_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_STUDIO_X64
+ MENU LABEL Ubuntu Studio x64
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_STUDIO_X64/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_STUDIO_X64/casper/initrd
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_STUDIO_X64 ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu Studio x64 Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Windows systems ----------\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Windows systems -------------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_TFTP_ETH0/$1/pxeboot.n12" ]]; then
+ echo -e "\e[36m add $WIN_PE_X86 (PXE)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $WIN_PE_X86-pxe
+ MENU LABEL Windows PE x86 (PXE)
+ PXE pxeboot.n12
+ TEXT HELP
+ Boot to Windows PE 32bit
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_ISO/$WIN_PE_X86.iso" ]]; then
+ echo -e "\e[36m add $WIN_PE_X86 (ISO)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $WIN_PE_X86-iso
+ MENU LABEL Windows PE x86 (ISO)
+ KERNEL memdisk
+ APPEND iso raw
+ INITRD $FILE_BASE$ISO/$WIN_PE_X86.iso
+ TEXT HELP
+ Boot to Windows PE 32bit ISO ~400MB
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_TFTP_ETH0/$1/wimboot" ]] \
+&& [[ -f "$DST_NFS_ETH0/$WIN_PE_X86/sources/boot.wim" ]]; then
+ echo -e "\e[36m add $WIN_PE_X86 (WIM)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $WIN_PE_X86-wim
+ MENU LABEL Windows PE x86 (WIM)
+ COM32 linux.c32 wimboot
+ APPEND initrdfile=$FILE_BASE$NFS_ETH0/$WIN_PE_X86/Boot/BCD,$FILE_BASE$NFS_ETH0/$WIN_PE_X86/Boot/boot.sdi,$FILE_BASE$NFS_ETH0/$WIN_PE_X86/sources/boot.wim
+ TEXT HELP
+ Boot to Windows PE 32bit
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_TFTP_ETH0/$1/pxeboot.n12" ]]; then
+ echo -e "\e[36m add $WIN_PE_X64 (PXE)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $WIN_PE_X64-pxe
+ MENU LABEL Windows PE x64 (PXE)
+ PXE pxeboot.n12
+ TEXT HELP
+ Boot to Windows PE 64bit
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_ISO/$WIN_PE_X64.iso" ]]; then
+ echo -e "\e[36m add $WIN_PE_X64 (ISO)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $WIN_PE_X64-iso
+ MENU LABEL Windows PE x64 (ISO)
+ KERNEL memdisk
+ APPEND iso raw
+ INITRD $FILE_BASE$ISO/$WIN_PE_X64.iso
+ TEXT HELP
+ Boot to Windows PE 64bit ISO ~400MB
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_TFTP_ETH0/$1/wimboot" ]] \
+&& [[ -f "$DST_NFS_ETH0/$WIN_PE_X64/sources/boot.wim" ]]; then
+ echo -e "\e[36m add $WIN_PE_X64 (WIM)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $WIN_PE_X64-wim
+ MENU LABEL Windows PE x64 (WIM)
+ COM64 linux.c64 wimboot
+ APPEND initrdfile=$FILE_BASE$NFS_ETH0/$WIN_PE_X64/Boot/BCD,$FILE_BASE$NFS_ETH0/$WIN_PE_X64/Boot/boot.sdi,$FILE_BASE$NFS_ETH0/$WIN_PE_X64/sources/boot.wim
+ TEXT HELP
+ Boot to Windows PE 64bit
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Broken systems -----------\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Broken systems --------------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$ANDROID_X86/kernel" ]]; then
+ echo -e "\e[36m add $ANDROID_X86\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ ## NOT WORKING
+ LABEL $ANDROID_X86
+ MENU LABEL Android x86 (broken)
+ KERNEL $FILE_BASE$NFS_ETH0/$ANDROID_X86/kernel
+ INITRD $FILE_BASE$NFS_ETH0/$ANDROID_X86/initrd.img
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$ANDROID_X86 ro netboot=nfs root=/dev/ram0 androidboot.selinux=permissive SRC= DATA=
+ TEXT HELP
+ Boot to Android x86 Live
+ User: root
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$CENTOS_X64/isolinux/vmlinuz" ]]; then
+ echo -e "\e[36m add $CENTOS_X64\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ ## NOT WORKING
+ ## INFO: http://people.redhat.com/harald/dracut.html#dracut.kernel
+ ## https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-installation-server-setup
+ ## https://github.com/haraldh/dracut/blob/master/dracut.cmdline.7.asc
+ LABEL $CENTOS_X64
+ MENU LABEL CentOS x64 (broken)
+ KERNEL $FILE_BASE$NFS_ETH0/$CENTOS_X64/isolinux/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$CENTOS_X64/isolinux/initrd.img
+ #APPEND ip=dhcp root=live:nfs:$IP_ETH0$DST_NFS_ETH0/$CENTOS_X64 ro rootfstype=auto rd.live.image rhgb rd.lvm=0 rd.luks=0 rd.md=0 rd.dm=0 rd.shell rd.break console=tty0 loglevel=7 vga=794 -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=$CUSTOM_KEYMAP locale.LANG=$CUSTOM_LOCALE
+
+ # dracut: FATAL: Don't know how to handle 'root=live:nfs:$IP_ETH0:$DST_NFS_ETH0/$CENTOS_X64';
+ #APPEND ip=dhcp root=live:nfs:$IP_ETH0:$DST_NFS_ETH0/$CENTOS_X64 ro root-path=/LiveOS/squashfs.img rootfstype=squashfs rd.live.image rd.live.ram=1 rd.live.overlay=none rd.luks=0 rd.md=0 rd.dm=0 vga=794 rd.shell log_buf_len=1M rd.retry=10 -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=$CUSTOM_KEYMAP locale.LANG=$CUSTOM_LOCALE
+
+ # dracut: FATAL: Don't know how to handle 'root=live:nfs:$IP_ETH0:$DST_NFS_ETH0/$CENTOS_X64/LiveOS/squashfs.img';
+ #APPEND ip=dhcp root=live:nfs:$IP_ETH0:$DST_NFS_ETH0/$CENTOS_X64/LiveOS/squashfs.img ro rootfstype=squashfs rd.live.image rd.live.ram=1 rd.live.overlay=none rd.luks=0 rd.md=0 rd.dm=0 vga=794 rd.shell log_buf_len=1M rd.retry=10 -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=$CUSTOM_KEYMAP locale.LANG=$CUSTOM_LOCALE
+
+ # mount.nfs: mountpoint /sysroot is not a directory
+ #APPEND ip=dhcp root=nfs:$IP_ETH0:$DST_NFS_ETH0/$CENTOS_X64/LiveOS/squashfs.img ro root-path=/LiveOS/squashfs.img rootfstype=squashfs rd.live.image rd.live.ram=1 rd.live.overlay=none rd.luks=0 rd.md=0 rd.dm=0 vga=794 rd.shell log_buf_len=1M rd.retry=10 -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=$CUSTOM_KEYMAP locale.LANG=$CUSTOM_LOCALE
+
+ # Warning: Could not boot.
+ # Warning: /dev/mapper/live-rw does not exist
+ # Starting Dracut Emergency Shell
+ APPEND ip=dhcp root=nfs:$IP_ETH0:$DST_NFS_ETH0/$CENTOS_X64 ro root-path=/LiveOS/squashfs.img rootfstype=squashfs rd.live.image rd.live.ram=1 rd.live.overlay=none rd.luks=0 rd.md=0 rd.dm=0 vga=794 rd.shell log_buf_len=1M rd.retry=10 -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=$CUSTOM_KEYMAP locale.LANG=$CUSTOM_LOCALE
+
+ TEXT HELP
+ Boot to CentOS LiveGNOME
+ User: liveuser
+ ENDTEXT
+EOF
+fi
+#========== END ==========
+
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Tools and utilities ------\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Tools and utilities ---------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]]; then
+ if [[ "${MENU_PXE}" == "${DST_PXE_BIOS}" ]]; then
+ echo -e "\e[36m add chainload-ipxe-bios\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL chainload-ipxe-bios
+ MENU LABEL iPXE-Menu ->
+ PXE ::/menu-ipxe/undionly.kpxe
+ TEXT HELP
+ Boot to iPXE (via chainload)
+ ENDTEXT
+EOF
+ else
+ echo -e "\e[36m add chainload-ipxe-efi\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL chainload-ipxe-efi
+ MENU HIDE
+ # not working under UEFI / SecureBoot
+ MENU LABEL iPXE-Menu ->
+ #PXE ::/menu-ipxe/ipxe.efi
+ #KERNEL ::/menu-ipxe/ipxe.efi
+ TEXT HELP
+ Boot to iPXE (via chainload)
+ ENDTEXT
+EOF
+ fi
+fi
+#=========== END ========
+
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Advanced options ---------\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+LABEL -
+ MENU LABEL --- Advanced options ------------------------------------
+ MENU DISABLE
+EOF
+fi
+
+if [[ -f "$FILE_MENU" ]]; then
+ if [[ "${MENU_PXE}" == "${DST_PXE_BIOS}" ]]; then
+ echo -e "\e[36m add reboot, power off (bios)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+########################################
+LABEL reboot
+ MENU LABEL Reboot
+ COM32 reboot.c32
+########################################
+LABEL poweroff
+ MENU LABEL Power Off
+ COM32 poweroff.c32
+
+
+EOF
+ else
+ echo -e "\e[36m add reboot, power off (efi)\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+########################################
+LABEL reboot
+ MENU HIDE
+ # not working under UEFI / SecureBoot
+ MENU LABEL Reboot
+ COM32 reboot.c32
+########################################
+LABEL poweroff
+ MENU HIDE
+ # not working under UEFI / SecureBoot
+ MENU LABEL Power Off
+ COM32 poweroff.c32
+
+
+EOF
+ fi
+fi
+
+
+
+########################################################################
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add section --- Custom systems -----------\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+########################################################################
+LABEL -
+ MENU LABEL --- Custom systems --------------------------------------
+ MENU DISABLE
+EOF
+fi
+
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]] \
+&& [[ -f "$DST_NFS_ETH0/$UBUNTU_NONPAE/casper/vmlinuz" ]]; then
+ echo -e "\e[36m add $UBUNTU_NONPAE\e[0m";
+ cat << EOF | sudo tee -a $FILE_MENU &>/dev/null
+ ########################################
+ LABEL $UBUNTU_NONPAE
+ MENU LABEL Ubuntu non-PAE x86
+ KERNEL $FILE_BASE$NFS_ETH0/$UBUNTU_NONPAE/casper/vmlinuz
+ INITRD $FILE_BASE$NFS_ETH0/$UBUNTU_NONPAE/casper/initrd.lz
+ APPEND ip=dhcp nfsroot=$IP_ETH0:$DST_NFS_ETH0/$UBUNTU_NONPAE ro netboot=nfs file=/cdrom/preseed/ubuntu.seed boot=casper fsck.mode=skip -- debian-installer/locale=$CUSTOM_LOCALE console-setup/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/layoutcode=$CUSTOM_LAYOUTCODE keyboard-configuration/variant=$CUSTOM_VARIANT
+ TEXT HELP
+ Boot to Ubuntu non-PAE x86 Live
+ User: ubuntu
+ ENDTEXT
+EOF
+fi
+#=========== END ===========
+
+########################################################################
+else
+
+
+########################################################################
+## ipxe
+#========== BEGIN ==========
+if [[ -f "$FILE_MENU" ]]; then
+ echo -e "\e[36m add ipxe menu\e[0m";
+ cat << EOF | sudo tee $FILE_MENU &>/dev/null
+#!ipxe
+
+# 2021-02-11
+# made by https://github.com/beta-tester
+# for project https://github.com/beta-tester/RPi-PXE-Server
+
+
+########################################################################
+### CHAIN LOAD SERVER VERSION OF iPXE
+:begin_ipxe_chainload_serverversion
+iseq \${product} VirtualBox || goto end_ipxe_chainload_serverversion
+set version_vbox 1.0.0+
+iseq \${version} \${version_vbox} || goto end_ipxe_chainload_serverversion
+:ipxe_chainload_serverversion
+echo download iPXE
+iseq \${platform} efi && set ipxe_file ipxe.efi || set ipxe_file undionly.kpxe
+imgfree ||
+chain \${ipxe_file}
+exit
+:end_ipxe_chainload_serverversion
+
+
+########################################################################
+### VARIABLES
+set base http://\${next-server}/srv/nfs
+set nfsroot \${next-server}:/srv/nfs
+
+set keymap $CUSTOM_KEYMAP
+set kmap $CUSTOM_KMAP
+set language $CUSTOM_LANGUAGE
+set layoutcode $CUSTOM_LAYOUTCODE
+set locale $CUSTOM_LOCALE
+set timezone $CUSTOM_TIMEZONE
+set variant $CUSTOM_VARIANT
+
+
+# Figure out if client is 64-bit capable
+cpuid --ext 29 && set archx x64 || set archx x86
+cpuid --ext 29 && set arch amd64 || set arch i386
+cpuid --ext 29 && set arch2 amd64 || set arch2 i686
+cpuid --ext 29 && set bit_cpu 64 || set bit_cpu 32
+
+# Figure out if BIOS, EFI32 or EFI64
+:begin_test_bios
+iseq \${platform} efi && goto test_bios_is_efi ||
+set pxe_menu menu-bios
+goto end_test_bios
+:test_bios_is_efi
+cpuid --ext 29 && set pxe_menu menu-efi64 || set pxe_menu menu-efi32
+:end_test_bios
+
+########################################################################
+### MAIN MENU
+:start
+imgfree
+menu iPXE \${version}, \${platform}, \${archx}, \${next-server}, \${pxe_menu}
+item --gap -- ------------------------- Live Operating systems -------------------------
+item arch-netboot-x64 Boot Arch netboot x64
+item bunsen-x64 Boot Bunsen x64
+item debian-x64 Boot Debian x64
+item devuan-x64 Boot Devuan x64
+item fedora-x64 Boot Fedora x64
+item emmabuntus-x64 Boot EmmaDE x64
+item mint-x64 Boot Linux Mint x64
+item opensuse-x64 Boot openSUSE x64
+item tinycore-x64 Boot Tiny Core x64
+item ubuntu-x64 Boot Ubuntu x64
+item --gap -- ------------------------- Pentesting systems ------------------------------
+item blackarch-x64 Boot BlackArch x64
+item kali-x64 Boot Kali x64
+item parrot-full-x64 Boot Parrot x64
+item pentoo-x64 Boot Pentoo x64
+item --gap -- ------------------------- Virus scanner systems ---------------------------
+item desinfect-x64 Boot Desinfec't x64
+item desinfect-x86 Boot Desinfec't x86
+item eset-rescue-x86 Boot ESET SysRescue Live x86
+item kaspersky-rescue-x86 Boot Kaspersky Rescue Disk x86
+item --gap -- ------------------------- Other systems ----------------------------------
+item clonezilla-x64 Boot Clonezilla x64
+item dragonos-x64 Boot DragonOS x64
+item finnix-x64 Boot Finnix x64
+item gnuradio-x64 Boot GNU Radio x64
+item knoppix-x86 Boot Knoppix x86
+item opensuse-rescue-x64 Boot openSUSE Rescue x64
+item rpdesktop-x86 Boot Raspberry Pi Desktop
+item rescuezilla-x64 Boot Rescuezilla x64
+item systemrescue-x64 Boot System Rescue x64
+item tails-x64 Boot Tails x64
+item ubuntu-studio-x64 Boot Ubuntu Studio x64
+item --gap -- ------------------------- Windows systems ----------------------------------
+item windows-iso-x64 Boot Windows PE x64 (ISO via http)
+item windows-iso-x86 Boot Windows PE x86 (ISO via http)
+item windows-pxe-x64 Boot Windows PE x64 (PXE via tftp)
+item windows-pxe-x86 Boot Windows PE x86 (PXE via tftp)
+item windows-wim-x64 Boot Windows PE x64 (WIM via http)
+item windows-wim-x86 Boot Windows PE x86 (WIM via http)
+item --gap -- ------------------------- Broken systems ----------------------------------
+item --gap -- ------------------------- Tools and utilities ----------------------------
+item --key p pxelinux Boot PXE-Linux ->
+item --gap -- ------------------------- Advanced options -------------------------------
+item --key c config Configure settings
+item shell Drop to iPXE shell
+item reboot Reboot computer
+item poweroff Power off computer
+item --gap -- --------------------------------------------------------------------------
+item --key x exit Exit iPXE and continue BIOS boot
+choose os || goto cancel
+echo \${os}
+goto \${os}
+
+
+:cancel
+echo You cancelled the menu, dropping you to the shell
+
+:shell
+echo Type 'exit' to get the back to the menu
+shell
+goto start
+
+:failed
+echo Action failed, dropping you to the shell
+goto shell
+
+:reboot
+reboot || goto failed
+
+:poweroff
+poweroff || goto failed
+
+:exit
+exit
+
+:config
+config
+goto start
+
+
+########################################################################
+###
+:arch-netboot-x64
+#imgselect http://www.archlinux.org/static/netboot/ipxe.lkrn || goto failed
+imgselect \${base}/\${os}/kernel || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+### ubuntu based
+:dragonos-x64
+set ext2 .gz
+set seed custom.seed
+goto ubuntu
+
+:eset-rescue-x86
+:mint-x64
+:rescuezilla-x64
+:ubuntu-x86
+:desinfect-x64
+:desinfect-x86
+set ext2 .lz
+set seed ubuntu.seed
+goto ubuntu
+
+:gnuradio-x64
+set ext1 .efi
+set ext2 .lz
+set seed ubuntu.seed
+goto ubuntu
+
+:lubuntu-daily-x64
+:lubuntu-x64
+set seed lubuntu.seed
+goto ubuntu
+
+:ubuntu-daily-x64
+:ubuntu-studio-daily-x64
+:ubuntu-studio-x64
+:ubuntu-x64
+:kubuntu-daily-x64
+:kubuntu-x64
+:xubuntu-daily-x64
+:xubuntu-x64
+set seed ubuntu.seed
+goto ubuntu
+
+:ubuntu
+#set custom -- debian-installer/locale=\${locale} debian-installer/language=\${language} console-setup/layoutcode=\${layoutcode} keyboard-configuration/layoutcode=\${layoutcode} keyboard-configuration/variant=\${variant}
+set custom -- debian-installer/locale=\${locale} console-setup/layoutcode=\${layoutcode} keyboard-configuration/layoutcode=\${layoutcode} keyboard-configuration/variant=\${variant}
+set options ip=dhcp nfsroot=\${nfsroot}/\${os} ro netboot=nfs file=/cdrom/preseed/\${seed} boot=casper fsck.mode=skip memtest=4 rmdns
+imgselect \${base}/\${os}/casper/vmlinuz\${ext1} \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/casper/initrd\${ext2} || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+### debian based
+:debian-cinnamon-x64
+:debian-gnome-x64
+:debian-kde-x64
+:debian-lxde-x64
+:debian-lxqt-x64
+:debian-mate-x64
+:debian-x64
+set version $DEBIAN_KVER
+set file1 vmlinuz\${version}
+set file2 initrd.img\${version}
+set extra
+goto debian
+
+:debian-cinnamon-x86
+:debian-gnome-x86
+:debian-kde-x86
+:debian-lxde-x86
+:debian-lxqt-x86
+:debian-mate-x86
+:debian-x86
+set version $DEBIAN_KVER_X86
+set file1 vmlinuz\${version}
+set file2 initrd.img\${version}
+set extra
+goto debian
+
+:devuan-x64
+:devuan-x86
+set file1 vmlinuz
+set file2 initrd.img
+set extra username=devuan
+goto debian
+
+:bunsen-x64
+:emmabuntus-x64
+:emmabuntus-x86
+set file1 vmlinuz
+set file2 initrd.img
+set extra
+goto debian
+
+:rpdesktop-x64
+:rpdesktop-x86
+set file1 vmlinuz2
+set file2 initrd2.img
+set extra
+goto debian
+
+:debian
+set custom -- locales=\${locale} keyboard-layouts=\${layoutcode} timezone=\${timezone} utc=no
+set options ip=dhcp nfsroot=\${nfsroot}/\${os} ro netboot=nfs boot=live config
+imgselect \${base}/\${os}/live/\${file1} \${options} \${extra} \${custom} || goto failed
+imgfetch \${base}/\${os}/live/\${file2} || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:fedora-x64
+set custom -- vconsole.font=latarcyrheb-sun16 vconsole.keymap=\${keymap} locale.LANG=\${locale}
+set options ip=dhcp root=live:nfs://\${next-server}/srv/nfs/\${os}/LiveOS/squashfs.img ro rd.live.image rd.lvm=0 rd.luks=0 rd.md=0 rd.dm=0 vga=794 fsck.mode=skip
+imgselect \${base}/\${os}/images/pxeboot/vmlinuz \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/images/pxeboot/initrd.img || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:opensuse-rescue-x64
+set aoe_if e0.1
+goto opensuse
+
+:opensuse-x64
+set aoe_if e1.1
+goto opensuse
+
+:opensuse
+set custom --
+set options ip=dhcp root=live:AOEINTERFACE=\${aoe_if} rd.kiwi.live.pxe
+imgselect \${base}/\${os}/boot/x86_64/loader/linux \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/boot/x86_64/loader/initrd || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:tinycore-x64
+:tinycore-x86
+set custom -- lang=\${language} kmap=\${kmap} tz=\${timezone}
+set options ip=dhcp nfsmount=\${nfsroot}/\${os} tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 noswap norestore
+#set options ip=dhcp nfsmount=\${nfsroot}/\${os}.rw tce=/mnt/nfs/cde waitusb=5 vga=791 loglevel=3 noswap norestore
+imgselect \${base}/\${os}/boot/vmlinuz64 \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/boot/corepure64.gz || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:blackarch-x64
+set custom -- locales=\${locale} keyboard-layouts=\${layoutcode} timezone=\${timezone} utc=no
+set options ip=dhcp archiso_nfs_srv=\${nfsroot}/\${os} ro archisobasedir=blackarch copytoram=n
+imgselect \${base}/\${os}/blackarch/boot/x86_64/vmlinuz-linux \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/blackarch/boot/intel-ucode.img || goto failed
+imgfetch \${base}/\${os}/blackarch/boot/amd-ucode.img || goto failed
+imgfetch \${base}/\${os}/blackarch/boot/x86_64/initramfs-linux.img || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:systemrescue-x64
+set custom -- locales=\${locale} keyboard-layouts=\${layoutcode} timezone=\${timezone} utc=no
+set options ip=dhcp archiso_nfs_srv=\${nfsroot}/\${os} ro archisobasedir=sysresccd copytoram=n
+imgselect \${base}/\${os}/sysresccd/boot/x86_64/vmlinuz \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/sysresccd/boot/intel_ucode.img || goto failed
+imgfetch \${base}/\${os}/sysresccd/boot/amd_ucode.img || goto failed
+imgfetch \${base}/\${os}/sysresccd/boot/x86_64/sysresccd.img || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:kali-x64
+set custom -- locales=\${locale} keyboard-layouts=\${layoutcode} timezone=\${timezone} utc=no
+set options ip=dhcp nfsroot=\${nfsroot}/\${os} ro netboot=nfs boot=live noconfig=sudo username=kali hostname=kali
+imgselect \${base}/\${os}/live/vmlinuz \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/live/initrd.img || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:parrot-full-x64
+set custom -- locales=\${locale} keyboard-layouts=\${layoutcode} pkeys=\${kmap} setxkbmap=\${kmap} timezone=\${timezone} utc=no
+set options ip=dhcp nfsroot=\${nfsroot}/\${os} ro netboot=nfs boot=live config
+imgselect \${base}/\${os}/live/vmlinuz \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/live/initrd.img || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:pentoo-beta-x64
+:pentoo-x64
+set custom --
+set options ip=dhcp nfsroot=\${nfsroot}/\${os} ro real_root=/dev/nfs root=/dev/ram0 init=/linuxrc overlayfs looptype=squashfs loop=/image.squashfs cdroot nox secureconsole max_loop=256 dokeymap video=uvesafb:mtrr:3,ywrap,1024x768-16 console=tty0 scsi_mod.use_blk_mq=1 net.ifnames=0 ipv6.autoconf=0
+imgselect \${base}/\${os}/boot/pentoo \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/boot/pentoo.igz || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:kaspersky-rescue-x86
+set custom -- lang=us setkmap=us
+set options ip=dhcp netboot=nfs://\${nfsroot}/\${os} ro dostartx
+imgselect \${base}/\${os}/boot/grub/k-x86 \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/boot/grub/initrd.xz || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:clonezilla-x64
+:clonezilla-x86
+set custom -- locales=\${locale} keyboard-layouts=\${layoutcode} utc=no timezone=\${timezone}
+set options ip=dhcp nfsroot=\${nfsroot}/\${os} ro netboot=nfs boot=live config username=user hostname=clonezilla union=overlay components noswap edd=on nomodeset nodmraid ocs_live_run=ocs-live-general ocs_live_extra_param= ocs_live_batch=no net.ifnames=0 nosplash noprompt
+imgselect \${base}/\${os}/live/vmlinuz \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/live/initrd.img || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:finnix-x64
+set custom -- locales=\${locale} keyboard-layouts=\${layoutcode} timezone=\${timezone} utc=no
+set options ip=dhcp nfsroot=\${nfsroot}/\${os} ro netboot=nfs boot=live config
+imgselect \${base}/\${os}/live/vmlinuz \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/live/initrd.img || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:knoppix-x86
+set custom -- lang=de
+set options ip=dhcp nfsdir=\${nfsroot}/\${os} nodhcp ramdisk_size=100000 init=/sbin/init apm=power-off nomce loglevel=1 libata.force=noncq tz=localtime hpsa.hpsa_allow_any=1 BOOT_IMAGE=knoppix
+imgselect \${base}/\${os}/boot/isolinux/linux \${options} \${custom} || goto failed
+imgfetch \${base}/$KNOPPIX_X86_EXTRA_INITRD || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:tails-x64
+set custom -- keyboard-layouts=\${lasyoutcode}
+set options ip=dhcp BOOTIF=\${hwaddr} fetch=\${base}/\${os}/live/filesystem.squashfs ro boot=live config live-media=removable ipv6.disable=1 nopersistence noprompt block.events_dfl_poll_msecs=1000 noautologin module=Tails slab_nomerge slub_debug=FZP mce=0 vsyscall=none page_poison=1 init_on_alloc=1 init_on_free=1 mds=full,nosmt timezone=Etc/UTC systemd.mask=tails-shutdown-on-media-removal.service fsck.mode=skip
+imgselect \${base}/\${os}/live/vmlinuz \${options} \${custom} || goto failed
+imgfetch \${base}/\${os}/live/initrd.img || goto failed
+imgfetch \${base}/\${os}-hotfix-pxe.cpio.xz || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:windows-iso-x64
+set os win-pe-x64
+goto windows-iso
+
+:windows-iso-x86
+set os win-pe-x86
+goto windows-iso
+
+:windows-iso
+imgselect memdisk iso raw || goto failed
+imgfetch http://\${next-server}/srv/iso/\${os}.iso || goto failed
+imgexec || goto failed
+goto start
+
+
+# https://git.ipxe.org/releases/wimboot/
+:windows-wim-x64
+set os win-pe-x64
+goto windows-wim
+
+:windows-wim-x86
+set os win-pe-x86
+goto windows-wim
+
+:windows-wim
+imgselect wimboot || goto failed
+imgfetch \${base}/\${os}/bootmgr bootmgr || goto failed
+imgfetch \${base}/\${os}/Boot/BCD BCD || goto failed
+imgfetch \${base}/\${os}/Boot/Fonts/wgl4_boot.ttf wgl4_boot.ttf || goto failed
+imgfetch \${base}/\${os}/Boot/boot.sdi boot.sdi || goto failed
+imgfetch \${base}/\${os}/sources/boot.wim boot.wim || goto failed
+imgexec || goto failed
+goto start
+
+
+:windows-pxe-x86
+goto windows-pxe
+
+:windows-pxe-x64
+goto windows-pxe
+
+:windows-pxe
+#set 67:string pxeboot.n12
+#set 17:string \${pxe_menu}
+iseq \${platform} efi && set boot-file bootmgr.efi || set boot-file pxeboot.n12
+imgselect \${pxe_menu}/\${boot-file} || goto failed
+#imgselect \${pxe_menu}/pxeboot.n12 || goto failed
+#imgselect http://\${next-server}/srv/iso/Boot.amd64/PXE/wdsnbp.com || goto failed
+#imgselect http://\${next-server}/srv/iso/Boot.amd64/PXE/bootmgr.exe || goto failed
+#imgselect http://\${next-server}/srv/iso/Boot.amd64/PXE/bootmgr.efi || goto failed
+imgexec || goto failed
+goto start
+
+
+########################################################################
+###
+:pxelinux
+set 209:string /pxelinux.cfg/default
+set 210:string \${pxe_menu}/
+imgselect /\${210:string}/lpxelinux.0 || goto failed
+imgexec || goto failed
+goto start
+
+EOF
+fi
+#========== END ==========
+
+fi
diff --git a/p2-include-url b/p2-include-url
new file mode 100644
index 0000000..e893ec3
--- /dev/null
+++ b/p2-include-url
@@ -0,0 +1,384 @@
+#!/usr/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+# v 2025-02-10
+
+# pull updates
+# cd ~/git/RPi-PXE-Server/ && git pull --no-rebase && cd - || git diff;
+# check for broken url
+# for i in $(grep -E "^[A-Z0-9_]+_URL=" ~/git/RPi-PXE-Server/p2-include-url | sed s/^.*=//g); do wget --quiet --timeout=5 --tries=1 --spider $i && echo -e "\e[32mOK\e[0m = $i" || echo -e "\e[97;41;5mFAILED\e[0m = $i"; done
+# for i in $(grep -E "^[A-Z0-9_]+_URL=" ~/git/RPi-PXE-Server/p2-include-url | sed s/^.*=//g); do curl --connect-timeout 5 --retry 0 -s -I -o /dev/null -w "%{response_code}" $i | grep -qE "(200|30.)" && echo -e "\e[32mOK\e[0m = $i" || echo -e "\e[97;41;5mFAILED\e[0m = $i"; done
+# execute run.sh
+# . ~/git/RPi-PXE-Server/run.sh
+# find KVER
+# curl https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-12.8.0-amd64-cinnamon.iso.contents -s | sed -n 's;^/live/vmlinuz;;p' | tail -n 1
+
+########################################################################
+# winpe https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install
+# https://www.heise.de/ct/artikel/c-t-Notfall-Windows-2020-4514169.html
+# https://github.com/pebakery/pebakery
+# arch https://www.archlinux.org/download/
+# blackarch https://blackarch.org/
+# fedora https://getfedora.org/en/workstation/download/
+# ubuntu https://releases.ubuntu.com/
+# https://cdimage.ubuntu.com/ubuntu/releases/
+# https://cdimage.ubuntu.com/daily-live/pending/
+# ubuntu studio https://cdimage.ubuntu.com/ubuntustudio/releases/
+# https://cdimage.ubuntu.com/ubuntustudio/dvd/pending/
+# lubuntu https://cdimage.ubuntu.com/lubuntu/releases/
+# https://cdimage.ubuntu.com/lubuntu/daily-live/pending/
+# debian https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/
+# https://cdimage.debian.org/debian-cd/current-live/i386/iso-hybrid/
+# devuan https://files.devuan.org/devuan_beowulf/desktop-live/
+# dragon os https://sourceforge.net/projects/dragonos-focal/files/
+# finnix https://linode-london.mirrors.finnix.org/pub/mirrors/finnix/releases/current/
+# gnuradio https://wiki.gnuradio.org/index.php/GNU_Radio_Live_SDR_Environment
+# http://eu2-dist.gnuradio.org/
+# parrotsec https://cdimage.parrotsec.org/parrot/iso/
+# kali https://cdimage.kali.org/kali-images/current/
+# https://cdimage.kali.org/kali-images/kali-weekly/
+# pentoo https://www.pentoo.ch/isos/latest-iso-symlinks/
+# deft http://www.deftlinux.net/
+# clonezilla https://sourceforge.net/projects/clonezilla/files/clonezilla_live_stable/
+# system rescue cd https://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/
+# https://system-rescue-cd.org/
+# tiny core http://tinycorelinux.net/downloads.html
+# rpdesktop https://downloads.raspberrypi.org/rpd_x86/images/?C=M;O=D
+# gentoo https://www.gentoo.org/downloads/
+# http://distfiles.gentoo.org/releases/amd64/
+# http://distfiles.gentoo.org/releases/x86/
+# opensuse https://download.opensuse.org/distribution/openSUSE-current/live/
+# https://download.opensuse.org/tumbleweed/iso/?C=M;O=D
+# centos https://www.centos.org/download/
+# tails https://tails.boum.org/install/download/
+# knoppix https://www.knopper.net/knoppix-mirrors/index-en.html
+# kaspersky https://www.kaspersky.com/downloads/thank-you/free-rescue-disk
+# bitdefender https://download.bitdefender.com/rescue_cd/latest/
+# Bitdefender Rescue CD reached End of Life on 2019-08-01
+# https://www.bitdefender.com/consumer/support/answer/10131/
+# ESET SysRescue Live free public version - end of life (2023-11) ?
+# https://www.eset.com/int/download-utilities/#content-c10295
+# linuxmint https://www.linuxmint.com/download.php
+# https://mirrors.edge.kernel.org/linuxmint/stable/
+# android x86 https://osdn.net/projects/android-x86/
+# rpi-raspbian https://downloads.raspberrypi.org/raspios_armhf/images/
+# piCore http://tinycorelinux.net/9.x/armv6/releases/RPi/
+# http://tinycorelinux.net/9.x/armv7/releases/RPi/
+# emmabuntus https://emmabuntus.org/
+# https://sourceforge.net/projects/emmabuntus/files/
+
+
+########################################################################
+# url to iso images, with LiveDVD systems
+# note:
+# update the url, if iso is outdated
+########################################################################
+
+
+ARCH_NETBOOT_X64=arch-netboot-x64
+ARCH_NETBOOT_X64_URL=https://archlinux.org/static/netboot/ipxe.lkrn
+
+
+BLACKARCH_X64=blackarch-x64
+BLACKARCH_X64_URL=https://ftp.halifax.rwth-aachen.de/blackarch/iso/blackarch-linux-slim-2023.05.01-x86_64.iso
+
+
+BUNSEN_X64=bunsen-x64
+BUNSEN_X64_URL=https://ddl.bunsenlabs.org/ddl/boron-1-240123-amd64.hybrid.iso
+BUNSEN_X64_SUM=https://ddl.bunsenlabs.org/ddl/release.sha256.txt
+BUNSEN_X64_SUM_TYPE=sha256
+
+
+CLONEZILLA_X64=clonezilla-x64
+CLONEZILLA_X64_URL=https://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable/3.2.0-5/clonezilla-live-3.2.0-5-amd64.iso
+CLONEZILLA_X86=clonezilla-x86
+CLONEZILLA_X86_URL=https://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable//3.2.0-5/clonezilla-live-3.2.0-5-i686.iso
+
+
+DEBIAN_KVER=
+DEBIAN_X64=debian-x64
+DEBIAN_X64_URL=https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-12.9.0-amd64-cinnamon.iso
+DEBIAN_X64_SUM=https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/SHA256SUMS
+DEBIAN_X64_SUM_TYPE=sha256
+
+DEBIAN_KVER_X86=-5.10.0-32-686
+DEBIAN_X86=debian-x86
+DEBIAN_X86_URL=https://cdimage.debian.org/cdimage/archive/latest-oldstable-live/i386/iso-hybrid/debian-live-11.11.0-i386-cinnamon.iso
+DEBIAN_X86_SUM=https://cdimage.debian.org/cdimage/archive/latest-oldstable-live/i386/iso-hybrid/SHA256SUMS
+DEBIAN_X86_SUM_TYPE=sha256
+
+
+DEFT_X64=deft-x64
+#DEFT_X64_URL=https://na.mirror.garr.it/mirrors/deft/iso/deft-8.2.iso
+#DEFT_X64_SUM=https://na.mirror.garr.it/mirrors/deft/md5.txt
+#DEFT_X64_SUM_TYPE=md5
+
+DEFTZ_X64=deftz-x64
+#DEFTZ_X64_URL=https://na.mirror.garr.it/mirrors/deft/zero/deftZ-2018-2.iso
+#DEFTZ_X64_SUM=https://na.mirror.garr.it/mirrors/deft/zero/deftZ-2018-2.iso.md5
+#DEFTZ_X64_SUM_TYPE=md5
+
+
+DEVUAN_X64=devuan-x64
+DEVUAN_X64_URL=https://files.devuan.org/devuan_daedalus/desktop-live/devuan_daedalus_5.0.0_amd64_desktop-live.iso
+DEVUAN_X64_SUM=https://files.devuan.org/devuan_daedalus/desktop-live/SHA256SUMS.txt
+DEVUAN_X64_SUM_TYPE=sha256
+
+DEVUAN_X86=devuan-x86
+DEVUAN_X86_URL=https://files.devuan.org/devuan_daedalus/desktop-live/devuan_daedalus_5.0.0_i386_desktop-live.iso
+DEVUAN_X86_SUM=https://files.devuan.org/devuan_daedalus/desktop-live/SHA256SUMS.txt
+DEVUAN_X86_SUM_TYPE=sha256
+
+
+DRAGONOS_X64=dragonos-x64
+DRAGONOS_X64_URL=https://downloads.sourceforge.net/project/dragonos-focal/DragonOS_FocalX_R37.1.iso
+DRAGONOS_X64_SUM=https://downloads.sourceforge.net/project/dragonos-focal/DragonOS_FocalX_R37.1.iso.sha256
+DRAGONOS_X64_SUM_TYPE=sha256
+
+
+EMMABUNTUS_X64=emmabuntus-x64
+EMMABUNTUS_X64_URL=https://downloads.sourceforge.net/project/emmabuntus/Emmabuntus_DE5/Images/1.03/emmabuntus-de5-amd64-12.8-1.03.iso
+EMMABUNTUS_X64_SUM=https://downloads.sourceforge.net/project/emmabuntus/Emmabuntus_DE5/Images/1.03/emmabuntus-de5-amd64-12.8-1.03.iso.sum.txt
+EMMABUNTUS_X64_SUM_TYPE=sha256
+
+EMMABUNTUS_X86=emmabuntus-x86
+EMMABUNTUS_X86_URL=https://downloads.sourceforge.net/project/emmabuntus/Emmabuntus_DE5/Images/1.03/emmabuntus-de5-i686-12.8-1.03.iso
+EMMABUNTUS_X86_SUM=https://downloads.sourceforge.net/project/emmabuntus/Emmabuntus_DE5/Images/1.03/emmabuntus-de5-i686-12.8-1.03.iso.sum.txt
+EMMABUNTUS_X86_SUM_TYPE=sha256
+
+
+ESET_SYSRESCUE_X86=eset-rescue-x86
+#ESET_SYSRESCUE_X86_URL=https://download.eset.com/com/eset/tools/recovery/rescue_cd/latest/eset_sysrescue_live_enu.iso
+
+
+FEDORA_X64=fedora-x64
+FEDORA_X64_URL=https://download.fedoraproject.org/pub/fedora/linux/releases/41/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-41-1.4.iso
+FEDORA_X64_SUM=https://download.fedoraproject.org/pub/fedora/linux/releases/41/Workstation/x86_64/iso/Fedora-Workstation-41-1.4-x86_64-CHECKSUM
+FEDORA_X64_SUM_TYPE=sha256
+
+FEDORA_SL_X64=fedora-sec-x64
+FEDORA_SL_X64_URL=https://download.fedoraproject.org/pub/alt/releases/41/Labs/x86_64/iso/Fedora-Security-Live-x86_64-41-1.4.iso
+FEDORA_SL_X64_SUM=https://download.fedoraproject.org/pub/alt/releases/41/Labs/x86_64/iso/Fedora-Labs-41-1.4-x86_64-CHECKSUM
+FEDORA_SL_X64_SUM_TYPE=sha256
+
+
+FINNIX_X64=finnix-x64
+FINNIX_X64_URL=https://www.finnix.org/releases/current/finnix-126.iso
+FINNIX_X64_SUM=https://www.finnix.org/releases/current/finnix-126.iso.gpg
+FINNIX_X64_SUM_TYPE=gpg
+
+
+GNURADIO_X64=gnuradio-x64
+#GNURADIO_X64_URL=http://eu2-dist.gnuradio.org/ubuntu-16.04.2-desktop-amd64-gnuradio-3.7.11.iso
+
+
+KALI_X64=kali-x64
+KALI_X64_URL=https://cdimage.kali.org/current/kali-linux-2024.4-live-amd64.iso
+KALI_X64_SUM=https://cdimage.kali.org/current/SHA256SUMS
+KALI_X64_SUM_TYPE=sha256
+
+
+KASPERSKY_RESCUE_X86=kaspersky-rescue-x86
+KASPERSKY_RESCUE_X86_URL=https://rescuedisk.s.kaspersky-labs.com/updatable/2018/krd.iso
+
+
+KNOPPIX_X86=knoppix-x86
+KNOPPIX_X86_URL=https://ftp.gwdg.de/pub/linux/knoppix/dvd/KNOPPIX_V9.1DVD-2021-01-25-DE.iso
+KNOPPIX_X86_SUM=https://ftp.gwdg.de/pub/linux/knoppix/dvd/KNOPPIX_V9.1DVD-2021-01-25-DE.iso.sha256
+KNOPPIX_X86_SUM_TYPE=sha256
+KNOPPIX_X86_EXTRA_INITRD=knoppix-x86-miniroot-9.1.gz
+KNOPPIX_X86_EXTRA_INITRD_URL=https://github.com/beta-tester/RPi-PXE-Server/files/6081579/knoppix-x86-miniroot-9.1.gz
+
+
+LUBUNTU_DAILY_X64=lubuntu-daily-x64
+LUBUNTU_DAILY_X64_URL=https://cdimage.ubuntu.com/lubuntu/daily-live/pending/plucky-desktop-amd64.iso
+LUBUNTU_DAILY_X64_SUM=https://cdimage.ubuntu.com/lubuntu/daily-live/pending/SHA256SUMS
+LUBUNTU_DAILY_X64_SUM_TYPE=sha256
+
+LUBUNTU_X64=lubuntu-x64
+LUBUNTU_X64_URL=https://cdimage.ubuntu.com/lubuntu/releases/24.10/release/lubuntu-24.10-desktop-amd64.iso
+LUBUNTU_X64_SUM=https://cdimage.ubuntu.com/lubuntu/releases/24.10/release/SHA256SUMS
+LUBUNTU_X64_SUM_TYPE=sha256
+
+LUBUNTU_LTS_X64=lubuntu-lts-x64
+LUBUNTU_LTS_X64_URL=https://cdimage.ubuntu.com/lubuntu/releases/24.04/release/lubuntu-24.04.1-desktop-amd64.iso
+LUBUNTU_LTS_X64_SUM=https://cdimage.ubuntu.com/lubuntu/releases/24.04/release/SHA256SUMS
+LUBUNTU_LTS_X64_SUM_TYPE=sha256
+
+LUBUNTU_LTS_X86=lubuntu-lts-x86
+LUBUNTU_LTS_X86_URL=https://cdimage.ubuntu.com/lubuntu/releases/18.04/release/lubuntu-18.04.5-desktop-i386.iso
+LUBUNTU_LTS_X86_SUM=https://cdimage.ubuntu.com/lubuntu/releases/18.04/release/SHA256SUMS
+LUBUNTU_LTS_X86_SUM_TYPE=sha256
+
+
+MINT_X64=mint-x64
+MINT_X64_URL=https://mirrors.edge.kernel.org/linuxmint/stable/22.1/linuxmint-22.1-cinnamon-64bit.iso
+MINT_X64_SUM=https://mirrors.edge.kernel.org/linuxmint/stable/22.1/sha256sum.txt
+MINT_X64_SUM_TYPE=sha256
+
+
+OPENSUSE_RESCUE_X64=opensuse-rescue-x64
+OPENSUSE_RESCUE_X64_URL=https://download.opensuse.org/distribution/openSUSE-current/live/openSUSE-Leap-15.6-Rescue-CD-x86_64-Media.iso
+OPENSUSE_RESCUE_X64_SUM=https://download.opensuse.org/distribution/openSUSE-current/live/openSUSE-Leap-15.6-Rescue-CD-x86_64-Media.iso.sha256
+OPENSUSE_RESCUE_X64_SUM_TYPE=sha256
+
+OPENSUSE_X64=opensuse-x64
+OPENSUSE_X64_URL=https://download.opensuse.org/distribution/openSUSE-current/live/openSUSE-Leap-15.6-KDE-Live-x86_64-Media.iso
+OPENSUSE_X64_SUM=https://download.opensuse.org/distribution/openSUSE-current/live/openSUSE-Leap-15.6-KDE-Live-x86_64-Media.iso.sha256
+OPENSUSE_X64_SUM_TYPE=sha256
+
+
+PARROT_FULL_X64=parrot-full-x64
+PARROT_FULL_X64_URL=https://download.parrot.sh/parrot/iso/6.3.2/Parrot-security-6.3.2_amd64.iso
+PARROT_FULL_X64_SUM=https://download.parrot.sh/parrot/iso/6.3.2/signed-hashes.txt
+PARROT_FULL_X64_SUM_TYPE=sha256
+
+PARROT_LITE_X64=parrot-lite-x64
+PARROT_LITE_X64_URL=https://download.parrot.sh/parrot/iso/6.3.2/Parrot-home-6.3.2_amd64.iso
+PARROT_LITE_X64_SUM=https://download.parrot.sh/parrot/iso/6.3.2/signed-hashes.txt
+PARROT_LITE_X64_SUM_TYPE=sha256
+
+
+PENTOO_BETA_X64=pentoo-beta-x64
+PENTOO_BETA_X64_URL=https://www.pentoo.ch/isos/latest-iso-symlinks/pentoo-full-daily-amd64-hardened-latest.iso
+
+PENTOO_X64=pentoo-x64
+PENTOO_X64_URL=https://www.pentoo.ch/isos/latest-iso-symlinks/pentoo-full-daily-amd64-hardened-latest.iso
+
+
+RPDESKTOP_X86=rpdesktop-x86
+RPDESKTOP_X86_URL=https://downloads.raspberrypi.org/rpd_x86_latest
+RPDESKTOP_X86_SUM=https://www.raspberrypi.org/downloads/raspberry-pi-desktop/
+RPDESKTOP_X86_SUM_TYPE=sha256
+
+
+RESCUEZILLA_X64=rescuezilla-x64
+RESCUEZILLA_X64_URL=https://github.com/rescuezilla/rescuezilla/releases/download/2.5.1/rescuezilla-2.5.1-64bit.noble.iso
+RESCUEZILLA_X64_SUM=https://github.com/rescuezilla/rescuezilla/releases/download/2.5.1/SHA256SUM
+RESCUEZILLA_X64_SUM_TYPE=sha256
+
+
+SYSTEMRESCUE_X64=systemrescue-x64
+SYSTEMRESCUE_X64_URL=https://downloads.sourceforge.net/project/systemrescuecd/sysresccd-x86/11.03/systemrescue-11.03-amd64.iso
+
+
+TAILS_X64=tails-x64
+TAILS_X64_URL=https://mirrors.edge.kernel.org/tails/stable/tails-amd64-6.12/tails-amd64-6.12.iso
+TAILS_X64_SUM=https://mirrors.edge.kernel.org/tails/stable/tails-amd64-6.12/tails-amd64-6.12.iso.sig
+TAILS_X64_SUM_TYPE=pgp
+
+
+TINYCORE_X64=tinycore-x64
+TINYCORE_X64_URL=http://tinycorelinux.net/15.x/x86_64/release/TinyCorePure64-current.iso
+TINYCORE_X64_SUM=http://tinycorelinux.net/15.x/x86_64/release/TinyCorePure64-current.iso.md5.txt
+TINYCORE_X64_SUM_TYPE=md5
+
+TINYCORE_X86=tinycore-x86
+TINYCORE_X86_URL=http://tinycorelinux.net/15.x/x86/release/TinyCore-current.iso
+TINYCORE_X86_SUM=http://tinycorelinux.net/15.x/x86/release/TinyCore-current.iso.md5.txt
+TINYCORE_X86_SUM_TYPE=md5
+
+
+UBUNTU_DAILY_X64=ubuntu-daily-x64
+UBUNTU_DAILY_X64_URL=https://cdimage.ubuntu.com/ubuntu/daily-live/pending/plucky-desktop-amd64.iso
+UBUNTU_DAILY_X64_SUM=https://cdimage.ubuntu.com/ubuntu/daily-live/pending/SHA256SUMS
+UBUNTU_DAILY_X64_SUM_TYPE=sha256
+
+UBUNTU_X64=ubuntu-x64
+UBUNTU_X64_URL=https://releases.ubuntu.com/24.10/ubuntu-24.10-desktop-amd64.iso
+UBUNTU_X64_SUM=https://releases.ubuntu.com/24.10/SHA256SUMS
+UBUNTU_X64_SUM_TYPE=sha256
+
+UBUNTU_LTS_X64=ubuntu-lts-x64
+UBUNTU_LTS_X64_URL=https://releases.ubuntu.com/24.04/ubuntu-24.04.1-desktop-amd64.iso
+UBUNTU_LTS_X64_SUM=https://releases.ubuntu.com/24.04/SHA256SUMS
+UBUNTU_LTS_X64_SUM_TYPE=sha256
+
+UBUNTU_LTS_X86=ubuntu-lts-x86
+UBUNTU_LTS_X86_URL=https://releases.ubuntu.com/16.04/ubuntu-16.04.6-desktop-i386.iso
+UBUNTU_LTS_X86_SUM=https://releases.ubuntu.com/16.04/SHA256SUMS
+UBUNTU_LTS_X86_SUM_TYPE=sha256
+
+UBUNTU_STUDIO_DAILY_X64=ubuntu-studio-daily-x64
+UBUNTU_STUDIO_DAILY_X64_URL=https://cdimage.ubuntu.com/ubuntustudio/daily-live/pending/plucky-desktop-amd64.iso
+UBUNTU_STUDIO_DAILY_X64_SUM=https://cdimage.ubuntu.com/ubuntustudio/daily-live/pending/SHA256SUMS
+UBUNTU_STUDIO_DAILY_X64_SUM_TYPE=sha256
+
+UBUNTU_STUDIO_X64=ubuntu-studio-x64
+UBUNTU_STUDIO_X64_URL=https://cdimage.ubuntu.com/ubuntustudio/releases/24.10/release/ubuntustudio-24.10-desktop-amd64.iso
+UBUNTU_STUDIO_X64_SUM=https://cdimage.ubuntu.com/ubuntustudio/releases/24.10/release/SHA256SUMS
+UBUNTU_STUDIO_X64_SUM_TYPE=sha256
+
+UBUNTU_FWTS=ubuntu-fwts
+UBUNTU_FWTS_URL=https://fwts.ubuntu.com/fwts-live/fwts-live-24.11.00-x86_64.img.xz
+UBUNTU_FWTS_SUM=https://fwts.ubuntu.com/fwts-live/SHA256SUM
+UBUNTU_FWTS_SUM_TYPE=sha256
+
+
+#custom#
+DESINFECT_X64=desinfect-x64
+DESINFECT_X64_URL=
+
+DESINFECT_X86=desinfect-x86
+DESINFECT_X86_URL=
+
+
+UBUNTU_NONPAE=ubuntu-nonpae
+UBUNTU_NONPAE_URL=
+
+
+WIN_PE_X86=win-pe-x86
+WIN_PE_X86_URL=
+
+WIN_PE_X64=win-pe-x64
+WIN_PE_X64_URL=
+
+
+#broken#
+ANDROID_X86=android-x86
+ANDROID_X86_URL=https://dotsrc.dl.osdn.net/osdn/android-x86/71931/android-x86_64-9.0-r2.iso
+
+
+CENTOS_X64=centos-x64
+#CENTOS_X64_URL=https://mirrors.edge.kernel.org/centos/7/isos/x86_64/CentOS-7-x86_64-LiveGNOME-2003.iso
+#CENTOS_X64_SUM=https://mirrors.edge.kernel.org/centos/7/isos/x86_64/sha256sum.txt
+#CENTOS_X64_SUM_TYPE=sha256
+
+
+########################################################################
+# url to zip files,
+# that contains disk images
+# for raspbarry pi 3 pxe network booting
+# note:
+# update the url, if disk image is outdated
+########################################################################
+PI_CORE=pi-core
+PI_CORE_URL=http://tinycorelinux.net/14.x/armv7/releases/RPi/piCore-14.0.zip
+
+
+RPD_BASIC=rpi-raspbian-basic
+RPD_BASIC_URL=https://downloads.raspberrypi.org/raspios_armhf_latest
+RPD_BASIC_SUM=https://www.raspberrypi.org/downloads/raspberry-pi-os/
+RPD_BASIC_SUM_TYPE=sha256
+
+RPD_FULL=rpi-raspbian-full
+RPD_FULL_URL=https://downloads.raspberrypi.org/raspios_full_armhf_latest
+RPD_FULL_SUM=https://www.raspberrypi.org/downloads/raspberry-pi-os/
+RPD_FULL_SUM_TYPE=sha256
+
+RPD_LITE=rpi-raspbian-lite
+RPD_LITE_URL=https://downloads.raspberrypi.org/raspios_lite_armhf_latest
+RPD_LITE_SUM=https://www.raspberrypi.org/downloads/raspberry-pi-os/
+RPD_LITE_SUM_TYPE=sha256
+
+
+########################################################################
diff --git a/p2-include-var b/p2-include-var
new file mode 100644
index 0000000..076313e
--- /dev/null
+++ b/p2-include-var
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+########################################################################
+## variables, you have to customize
+## e.g.:
+## RPI_SN0 : serial number
+## of the raspberry pi 3 for network booting
+## and other variables...
+########################################################################
+########################################################################
+RPI_SN0=--------
+RPI_SN1=--------
+RPI_SN2=--------
+RPI_SN3=--------
+########################################################################
+INTERFACE_ETH0=
+INTERFACE_ETH1=eth1
+INTERFACE_WLAN0=wlan0
+########################################################################
+if [[ -z "$INTERFACE_ETH0" ]] && [[ -d /sys/devices/platform/scb/fd580000.genet/net ]]; then
+# RPi4B
+INTERFACE_ETH0=$(ls /sys/devices/platform/scb/fd580000.genet/net)
+fi
+if [[ -z "$INTERFACE_ETH0" ]] && [[ -d /sys/devices/platform/soc/*.usb/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0/net ]]; then
+# RPi3B+
+INTERFACE_ETH0=$(ls /sys/devices/platform/soc/*.usb/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0/net)
+fi
+if [[ -z "$INTERFACE_ETH0" ]] && [[ -d /sys/devices/platform/soc/*.usb/usb1/1-1/1-1.1/1-1.1:1.0/net ]]; then
+# RPi1B rev.1, RPi1B rev.2, RPi1B+, RPi2B, RPi3B
+INTERFACE_ETH0=$(ls /sys/devices/platform/soc/*.usb/usb1/1-1/1-1.1/1-1.1:1.0/net)
+fi
+if [[ -z "$INTERFACE_ETH0" ]]; then
+# fallback
+INTERFACE_ETH0=eth0
+fi
+########################################################################
+IP_ETH0=$(ip -4 address show dev $INTERFACE_ETH0 | grep -o -E '(([0-9]{1,3}[\.]){3}[0-9]{1,3})' | sed '1!d')
+IP_ETH0_=$(echo $IP_ETH0 | grep -o -E '([0-9]{1,3}[\.]){3}')
+IP_ETH0_0=$(echo $(echo $IP_ETH0_)0)/24
+IP_ETH0_START=$(echo $(echo $IP_ETH0_)200)
+IP_ETH0_END=$(echo $(echo $IP_ETH0_)250)
+IP_ETH0_ROUTER=$(echo $(ip rout show dev $INTERFACE_ETH0 | grep default | cut -d' ' -f3))
+IP_ETH0_DNS=$IP_ETH0_ROUTER
+IP_ETH0_MASK=255.255.255.0
+########################################################################
+IP_ETH1=192.168.250.1
+IP_ETH1_0=192.168.250.0/24
+IP_ETH1_START=192.168.250.100
+IP_ETH1_END=192.168.250.110
+IP_ETH1_MASK=255.255.255.0
+########################################################################
+IP_WLAN0=192.168.251.1
+IP_WLAN0_0=192.168.251.0/24
+IP_WLAN0_START=192.168.251.100
+IP_WLAN0_END=192.168.251.110
+IP_WLAN0_MASK=255.255.255.0
+########################################################################
+DRIVER_WLAN0=nl80211
+COUNTRY_WLAN0=US
+PASSWORD_WLAN0=p@ssw0rd
+SSID_WLAN0=wlan0@domain.local
+INTERFACE_WLAN0X=wlan0x
+PASSWORD_WLAN0X=p@ssw0rd
+SSID_WLAN0X=wlan0x@domain.local
+
+########################################################################
+ISO=/iso
+IMG=/img
+TFTP_ETH0=/tftp
+NFS_ETH0=/nfs
+SRC_MOUNT=/media/server
+SRC_BACKUP=$SRC_MOUNT/backup
+SRC_ISO=$SRC_BACKUP$ISO
+SRC_IMG=$SRC_BACKUP$IMG
+SRC_TFTP_ETH0=$SRC_BACKUP$TFTP_ETH0
+SRC_NFS_ETH0=$SRC_BACKUP$NFS_ETH0
+DST_ROOT=/srv
+DST_ISO=$DST_ROOT$ISO
+DST_IMG=$DST_ROOT$IMG
+DST_TFTP_ETH0=$DST_ROOT$TFTP_ETH0
+DST_NFS_ETH0=$DST_ROOT$NFS_ETH0
+########################################################################
+DST_PXE_BIOS=menu-bios
+DST_PXE_EFI32=menu-efi32
+DST_PXE_EFI64=menu-efi64
+DST_IPXE=menu-ipxe
+########################################################################
+KERNEL_MAJOR=$(cat /proc/version | awk '{print $3}' | awk -F . '{print $1}')
+KERNEL_MINOR=$(cat /proc/version | awk '{print $3}' | awk -F . '{print $2}')
+KERNEL_VER=$((KERNEL_MAJOR*100 + KERNEL_MINOR))
+OS_VER=$(grep VERSION_ID /etc/*-release | grep -o '".*"' | sed 's/"//g')
diff --git a/p2-update b/p2-update
new file mode 100644
index 0000000..6bbd7ce
--- /dev/null
+++ b/p2-update
@@ -0,0 +1,1470 @@
+#!/bin/bash
+
+########################################################################
+if [[ -z "$script_dir" ]]
+then
+ echo 'do not run this script directly !'
+ echo 'this script is part of run.sh'
+ exit -1
+fi
+########################################################################
+
+
+########################################################################
+# known issues:
+# overlayfs can not get exported via nfs
+# overlayfs is working, when you put a bindfs on top of overlayfs, to make exportfs happy
+# note: this overlayfs+bindfs construction does NOT work reliably - data loss!
+# solution: maybe linux kernel 5.6
+
+
+########################################################################
+echo -e "\e[36msetup variables\e[0m";
+
+
+########################################################################
+########################################################################
+. "${script_dir:?}/p2-include-var"
+. "${script_dir:?}/c2-custom-var"
+
+
+########################################################################
+########################################################################
+. "${script_dir:?}/p2-include-url"
+. "${script_dir:?}/c2-custom-url"
+
+
+echo
+echo -e "${KERNEL_MAJOR}.${KERNEL_MINOR} \e[36mis kernel version\e[0m";
+echo -e "${INTERFACE_ETH0} \e[36mis used as primary networkadapter for PXE\e[0m";
+echo -e "${IP_ETH0} \e[36mis used as primary IP address for PXE\e[0m";
+echo -e "${RPI_SN0} \e[36mis used as SN for RPi3 network booting\e[0m";
+echo
+
+if [[ -z "${IP_ETH0}" ]]; then
+ echo -e "\e[1;31mIP address not found. please check your ethernet cable.\e[0m";
+ exit 1
+fi
+
+if [[ -z "${IP_ETH0_ROUTER}" ]]; then
+ echo -e "\e[1;31mrouter IP address not found. please check your router settings.\e[0m";
+ exit 1
+fi
+
+[[ -z "${SRC_MOUNT}" ]] && sudo umount -f "${SRC_MOUNT}" &>/dev/null;
+[[ -z "${SRC_MOUNT}" ]] && sudo mount "${SRC_MOUNT}" &>/dev/null;
+
+
+########################################################################
+compare_last_modification_time() {
+ python3 - << EOF "${1:?}" "${2:?}"
+import sys
+import os
+import urllib.request
+import time
+
+try:
+ arg_file = sys.argv[1]
+ stat_file = os.stat(arg_file)
+ time_file = time.gmtime(stat_file.st_mtime)
+
+ arg_url = sys.argv[2]
+ conn_url = urllib.request.urlopen(arg_url)
+ time_url = time.strptime(conn_url.headers['last-modified'], '%a, %d %b %Y %H:%M:%S %Z')
+
+ if time_url <= time_file:
+ exit_code = 0
+ else:
+ exit_code = 1
+
+ print('file:{} <-> url:{}'.format(time.strftime("%Y-%m-%d %H:%M:%S", time_file), time.strftime("%Y-%m-%d %H:%M:%S", time_url)))
+except:
+ exit_code = 1
+
+sys.exit(exit_code)
+EOF
+}
+
+
+########################################################################
+_unhandle_img() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ # ${2..} : optional options
+ local OPT=${2}
+ ####################################################################
+ local FILE_URL="${NAME:?}.url"
+ local FILE_IMG="${NAME:?}.img"
+ ####################################################################
+ echo -e "\e[32m_unhandle_img(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ sudo exportfs -u "*:${DST_NFS_ETH0:?}/${NAME:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_ETH0:?}/${NAME:?}" 2> /dev/null;
+
+ sudo rm -f "${DST_IMG:?}/${FILE_URL:?}";
+ sudo rm -f "${DST_IMG:?}/${FILE_IMG:?}";
+
+ sudo rm -rf "${DST_NFS_ETH0:?}/${NAME:?}";
+
+ sudo sed /etc/fstab -i -e "/${NAME:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME:?}/d"
+
+ if [[ -d "${SRC_IMG:?}" ]] \
+ && ( \
+ ! [[ -s "${SRC_IMG:?}/${FILE_IMG:?}" ]] \
+ || ! grep -q "${URL}" "${SRC_IMG:?}/${FILE_URL:?}" 2> /dev/null \
+ || ([[ "${OPT}" == "timestamping" ]] && ! compare_last_modification_time "${SRC_IMG:?}/${FILE_IMG:?}" "${URL:?}") \
+ ); \
+ then
+ echo -e "\e[36m download image to backup location\e[0m";
+ sudo rm -f "${SRC_IMG:?}/${FILE_URL:?}";
+ sudo rm -f "${SRC_IMG:?}/${FILE_IMG:?}";
+ sudo wget -O "${SRC_IMG:?}/${FILE_IMG:?}" "${URL:?}";
+ sudo sh -c "echo '${URL}' > ${SRC_IMG:?}/${FILE_URL:?}";
+ sudo touch -r "${SRC_IMG:?}/${FILE_IMG:?}" "${SRC_IMG:?}/${FILE_URL:?}";
+ fi
+}
+
+
+########################################################################
+_unhandle_iso() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ # ${2..} : optional options
+ # local OPT=${2}
+ ####################################################################
+ local FILE_URL="${NAME:?}.url"
+ local FILE_ISO="${NAME:?}.iso"
+ ####################################################################
+ echo -e "\e[32m_unhandle_iso(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ local timestamping;
+ local bindfs;
+ local vblade;
+ local vblade_shelf;
+ local vblade_slot;
+ local fstab_options;
+
+ # collect optional options
+ shift;
+
+ while [[ $# -gt 0 ]]; do
+ case "${1}" in
+ timestamping)
+ timestamping=yes;
+ ;;
+ bindfs)
+ bindfs=yes;
+ ;;
+ vbladed)
+ vblade=yes;
+ vblade_shelf="${2}";
+ vblade_slot="${3}";
+ shift 2;
+ ;;
+ *)
+ fstab_options="${1}"
+ ;;
+ esac
+ shift;
+ done
+ ####################################################################
+
+ if [[ "${vblade}" == "yes" ]]; then
+ sudo systemctl stop vblade@$(systemd-escape "${NAME:?}").service &>/dev/null;
+ sudo rm -f "/etc/vblade.conf.d/${NAME:?}.conf" &>/dev/null;
+ sudo systemctl daemon-reload &>/dev/null;
+ sudo systemctl restart vblade.service &>/dev/null;
+ fi
+
+ sudo exportfs -u "*:${DST_NFS_ETH0:?}/${NAME:?}" &>/dev/null;
+ sudo umount -f "${DST_NFS_ETH0:?}/${NAME:?}" &>/dev/null;
+
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rm -f "${DST_ISO:?}/${FILE_ISO:?}";
+
+ sudo rm -rf "${DST_NFS_ETH0:?}/${NAME:?}";
+
+ sudo sed /etc/fstab -i -e "/${NAME:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME:?}/d"
+
+ if [[ -d "${SRC_ISO:?}" ]] \
+ && ( \
+ ! [[ -s "${SRC_ISO:?}/${FILE_ISO:?}" ]] \
+ || ! grep -q "${URL}" "${SRC_ISO:?}/${FILE_URL:?}" 2> /dev/null \
+ || ([[ "${timestamping}" == "yes" ]] && ! compare_last_modification_time "${SRC_ISO:?}/${FILE_ISO:?}" "${URL:?}") \
+ ); \
+ then
+ echo -e "\e[36m download iso image to backup location\e[0m";
+ sudo rm -f "${SRC_ISO:?}/${FILE_URL:?}";
+ sudo rm -f "${SRC_ISO:?}/${FILE_ISO:?}";
+ sudo wget -O "${SRC_ISO:?}/${FILE_ISO:?}" "${URL:?}";
+ sudo sh -c "echo '${URL}' > ${SRC_ISO:?}/${FILE_URL:?}";
+ sudo touch -r "${SRC_ISO:?}/${FILE_ISO:?}" "${SRC_ISO:?}/${FILE_URL:?}";
+ fi
+}
+
+
+########################################################################
+_unhandle_kernel() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ ####################################################################
+ local FILE_URL="${NAME:?}.url"
+ local FILE_KERNEL="${NAME:?}.kernel"
+ ####################################################################
+ echo -e "\e[32m_unhandle_kernel(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ sudo exportfs -u "*:${DST_NFS_ETH0:?}/${NAME:?}" 2> /dev/null;
+
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rm -f "${DST_ISO:?}/${FILE_KERNEL:?}";
+
+ sudo rm -rf "${DST_NFS_ETH0:?}/${NAME:?}";
+
+ sudo sed /etc/exports -i -e "/${NAME:?}/d"
+}
+
+
+########################################################################
+_unhandle_zip_img() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ # ${2} : optional options
+ local OPT=${2}
+ ####################################################################
+ local RAW_FILENAME=$(basename "${URL:?}" .zip)
+ local RAW_FILENAME_ZIP="${RAW_FILENAME:?}.zip"
+ local NAME_BOOT="${NAME:?}-boot"
+ local NAME_ROOT="${NAME:?}-root"
+ local DST_NFS_BOOT="${DST_NFS_ETH0:?}/${NAME_BOOT:?}"
+ local DST_NFS_ROOT="${DST_NFS_ETH0:?}/${NAME_ROOT:?}"
+ local FILE_URL="${NAME:?}.url"
+ local FILE_IMG="${NAME:?}.img"
+ ####################################################################
+ echo -e "\e[32m_unhandle_zip_img(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ ## boot
+ sudo exportfs -u "*:${DST_NFS_BOOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_BOOT:?}" 2> /dev/null;
+ sudo rm -rf "${DST_NFS_BOOT:?}";
+ sudo sed /etc/fstab -i -e "/${NAME_BOOT:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME_BOOT:?}/d"
+
+ ## root
+ sudo exportfs -u "*:${DST_NFS_ROOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_ROOT:?}" 2> /dev/null;
+ sudo rm -rf "${DST_NFS_ROOT:?}";
+ sudo sed /etc/fstab -i -e "/${NAME_ROOT:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME_ROOT:?}/d"
+
+ ## img
+ sudo rm -f "${DST_IMG:?}/${FILE_IMG:?}";
+ sudo rm -f "${DST_IMG:?}/${FILE_URL:?}";
+
+ if [[ -d "${SRC_IMG:?}" ]] \
+ && ( \
+ ! [[ -s "${SRC_IMG:?}/${FILE_IMG:?}" ]] \
+ || ! grep -q "${URL}" "${SRC_IMG:?}/${FILE_URL:?}" 2> /dev/null \
+ || ([[ "${OPT}" == "timestamping" ]] && ! compare_last_modification_time "${SRC_IMG:?}/${FILE_URL:?}" "${URL:?}") \
+ ); \
+ then
+ echo -e "\e[36m download image to backup location\e[0m";
+ sudo rm -f "${SRC_IMG:?}/${FILE_IMG:?}";
+ sudo rm -f "${SRC_IMG:?}/${FILE_URL:?}";
+ sudo wget -O "${SRC_IMG:?}/${RAW_FILENAME_ZIP:?}" "${URL:?}";
+
+ sudo sh -c "echo '${URL}' > ${SRC_IMG:?}/${FILE_URL:?}";
+ sudo touch -r "${SRC_IMG:?}/${RAW_FILENAME_ZIP:?}" "${SRC_IMG:?}/${FILE_URL:?}";
+
+ echo -e "\e[36m extract image to backup location\e[0m";
+ sudo unzip "${SRC_IMG:?}/${RAW_FILENAME_ZIP:?}" -d "${SRC_IMG:?}" > /tmp/output.tmp;
+ sudo rm -f "${SRC_IMG:?}/${RAW_FILENAME_ZIP:?}";
+ local RAW_FILENAME_IMG=$(grep 'inflating' /tmp/output.tmp | cut -d':' -f2 | xargs basename)
+ sudo mv "${SRC_IMG:?}/${RAW_FILENAME_IMG:?}" "${SRC_IMG:?}/${FILE_IMG:?}";
+ rm /tmp/output.tmp
+ fi
+}
+
+
+########################################################################
+handle_img() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ # ${2..} : optional options
+ local OPT=${2}
+ ####################################################################
+ local FILE_URL="${NAME:?}.url"
+ local FILE_IMG="${NAME:?}.img"
+ ####################################################################
+ echo -e "\e[32mhandle_img(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ if ! [[ -d "${DST_IMG:?}/" ]]; then sudo mkdir -p "${DST_IMG:?}/"; fi
+ if ! [[ -d "${DST_NFS_ETH0:?}/" ]]; then sudo mkdir -p "${DST_NFS_ETH0:?}/"; fi
+
+ sudo exportfs -u "*:${DST_NFS_ETH0:?}/${NAME:?}" 2> /dev/null;
+# sudo umount -f "${DST_NFS_ETH0:?}/${NAME:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_ETH0:?}/${NAME:?}";
+
+ if [[ -z "${URL}" ]]; then
+ if ! [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]] \
+ && [[ -s "${SRC_IMG:?}/${FILE_IMG:?}" ]] \
+ && [[ -f "${SRC_IMG:?}/${FILE_URL:?}" ]]; \
+ then
+ echo -e "\e[36m copy img from usb-stick\e[0m";
+ sudo rm -f "${FILE_IMG:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_IMG:?}" "${DST_IMG:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_URL:?}" "${DST_IMG:?}";
+ fi
+ else
+ if [[ -s "${SRC_IMG:?}/${FILE_IMG:?}" ]] \
+ && [[ -f "${SRC_IMG:?}/${FILE_URL:?}" ]] \
+ && grep -q "${URL}" "${SRC_IMG:?}/${FILE_URL:?}" 2> /dev/null \
+ && ! grep -q "${URL}" "${DST_IMG:?}/${FILE_URL:?}" 2> /dev/null; \
+ then
+ echo -e "\e[36m copy img from usb-stick\e[0m";
+ sudo rm -f "${FILE_IMG:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_IMG:?}" "${DST_IMG:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_URL:?}" "${DST_IMG:?}";
+ fi
+
+ if ! [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]] \
+ || ! grep -q "${URL}" "${DST_IMG:?}/${FILE_URL:?}" 2> /dev/null \
+ || ([[ "${OPT}" == "timestamping" ]] && ! compare_last_modification_time "${DST_IMG:?}/${FILE_URL:?}" "${URL:?}"); \
+ then
+ echo -e "\e[36m download image\e[0m";
+ sudo rm -f "${DST_IMG:?}/${FILE_IMG:?}";
+ sudo rm -f "${DST_IMG:?}/${FILE_URL:?}";
+ sudo wget -O "${DST_IMG:?}/${FILE_IMG:?}" "${URL:?}";
+
+ sudo sh -c "echo '${URL}' > ${DST_IMG:?}/${FILE_URL:?}";
+ sudo touch -r "${DST_IMG:?}/${FILE_IMG:?}" "${DST_IMG:?}/${FILE_URL:?}";
+ fi
+ fi
+
+ if ! [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]]; then
+ sudo rm -f "${DST_IMG:?}/${FILE_IMG:?}";
+ sudo rm -f "${DST_IMG:?}/${FILE_URL:?}";
+ fi
+
+ if [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]]; then
+ local OFFSET_PART1=$((512*$(sfdisk -d "${DST_IMG:?}/${FILE_IMG:?}" | grep "${DST_IMG:?}/${FILE_IMG:?}"\1 | awk '{print $4}' | sed 's/,//')))
+ local SIZE_PART1=$((512*$(sfdisk -d "${DST_IMG:?}/${FILE_IMG:?}" | grep "${DST_IMG:?}/${FILE_IMG:?}"\1 | awk '{print $6}' | sed 's/,//')))
+ #sfdisk -d "${DST_IMG:?}/${FILE_IMG:?}"
+
+ ## partition1
+ if ! [[ -d "${DST_NFS_ETH0:?}/${NAME:?}" ]]; then
+ echo -e "\e[36m create image folder\e[0m";
+ sudo mkdir -p "${DST_NFS_ETH0:?}/${NAME:?}";
+ fi
+
+ if ! grep -q "${DST_NFS_ETH0:?}/${NAME:?}" /etc/fstab; then
+ echo -e "\e[36m add image to fstab\e[0m";
+ sudo sh -c "echo '${DST_IMG:?}/${FILE_IMG:?} ${DST_NFS_ETH0:?}/${NAME:?} auto ro,nofail,auto,loop,offset=${OFFSET_PART1:?},sizelimit=${SIZE_PART1:?} 0 11' >> /etc/fstab";
+ fi
+
+ if ! grep -q "${DST_NFS_ETH0:?}/${NAME:?}" /etc/exports; then
+ echo -e "\e[36m add image folder to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_ETH0:?}/${NAME:?} *(ro,async,no_subtree_check,root_squash,mp,fsid=$(uuid))' >> /etc/exports";
+ fi
+
+ sudo mount "${DST_NFS_ETH0:?}/${NAME:?}";
+ sudo exportfs "*:${DST_NFS_ETH0:?}/${NAME:?}";
+ else
+ ## partition1
+ sudo sed /etc/fstab -i -e "/${NAME:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME:?}/d"
+ fi
+}
+
+
+########################################################################
+handle_iso() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ # ${2..} : optional options
+ # local OPT=${2}
+ ####################################################################
+ local FILE_URL="${NAME:?}.url"
+ local FILE_ISO="${NAME:?}.iso"
+ local DST_ORIGINAL="/srv/tmp/original/${NAME:?}"
+ ####################################################################
+ echo -e "\e[32mhandle_iso(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ local timestamping;
+ local bindfs;
+ local vblade;
+ local vblade_shelf;
+ local vblade_slot;
+ local fstab_options;
+
+ # collect optional options
+ shift;
+
+ while [[ $# -gt 0 ]]; do
+ case "${1}" in
+ timestamping)
+ timestamping=yes;
+ echo -e "\e[36m timestamping\e[0m";
+ ;;
+ bindfs)
+ bindfs=yes;
+ echo -e "\e[36m bindfs\e[0m";
+ ;;
+ vbladed)
+ vblade=yes;
+ vblade_shelf="${2}";
+ vblade_slot="${3}";
+ shift 2;
+ echo -e "\e[36m vblade_shelf=${vblade_shelf}, vblade_slot=${vblade_slot}\e[0m";
+ ;;
+ *)
+ fstab_options="${1}"
+ echo -e "\e[36m fstab_options=${fstab_options}\e[0m";
+ ;;
+ esac
+ shift;
+ done
+ ####################################################################
+
+ if ! [[ -d "${DST_ISO:?}/" ]]; then sudo mkdir -p "${DST_ISO:?}/"; fi
+ if ! [[ -d "${DST_NFS_ETH0:?}/" ]]; then sudo mkdir -p "${DST_NFS_ETH0:?}/"; fi
+
+ if [[ "${vblade}" == "yes" ]]; then
+ sudo systemctl stop vblade@$(systemd-escape "${NAME:?}").service &>/dev/null;
+ fi
+
+ sudo exportfs -u "*:${DST_NFS_ETH0:?}/${NAME:?}" &>/dev/null;
+ sudo umount -f "${DST_NFS_ETH0:?}/${NAME:?}" &>/dev/null;
+ if [[ "${bindfs}" == "yes" ]]; then sudo umount -f "${DST_ORIGINAL:?}" 2> /dev/null; fi
+
+ if [[ -z "${URL}" ]]; then
+ if ! [[ -s "${DST_ISO:?}/${FILE_ISO:?}" ]] \
+ && [[ -s "${SRC_ISO:?}/${FILE_ISO:?}" ]] \
+ && [[ -f "${SRC_ISO:?}/${FILE_URL:?}" ]]; \
+ then
+ echo -e "\e[36m copy iso from usb-stick\e[0m";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_ISO:?}" "${DST_ISO:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_URL:?}" "${DST_ISO:?}";
+ fi
+ else
+ if [[ -s "${SRC_ISO:?}/${FILE_ISO:?}" ]] \
+ && [[ -f "${SRC_ISO:?}/${FILE_URL:?}" ]] \
+ && grep -q "${URL}" "${SRC_ISO:?}/${FILE_URL:?}" 2> /dev/null \
+ && ! grep -q "${URL}" "${DST_ISO:?}/${FILE_URL:?}" 2> /dev/null; \
+ then
+ echo -e "\e[36m copy iso from usb-stick\e[0m";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_ISO:?}" "${DST_ISO:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_URL:?}" "${DST_ISO:?}";
+ fi
+
+ if ! [[ -s "${DST_ISO:?}/${FILE_ISO:?}" ]] \
+ || ! grep -q "${URL}" "${DST_ISO:?}/${FILE_URL:?}" 2> /dev/null \
+ || ([[ "${timestamping}" == "yes" ]] && ! compare_last_modification_time "${DST_ISO:?}/${FILE_ISO:?}" "${URL:?}"); \
+ then
+ echo -e "\e[36m download iso image\e[0m";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rm -f "${DST_ISO:?}/${FILE_ISO:?}";
+ sudo wget -O "${DST_ISO:?}/${FILE_ISO:?}" "${URL:?}";
+ sudo sh -c "echo '${URL}' > ${DST_ISO:?}/${FILE_URL:?}";
+ sudo touch -r "${DST_ISO:?}/${FILE_ISO:?}" "${DST_ISO:?}/${FILE_URL:?}";
+ fi
+ fi
+
+ if ! [[ -s "${DST_ISO:?}/${FILE_ISO:?}" ]]; then
+ sudo rm -f "${DST_ISO:?}/${FILE_ISO:?}";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ fi
+
+ if [[ -s "${DST_ISO:?}/${FILE_ISO:?}" ]]; then
+ if ! [[ -d "${DST_NFS_ETH0:?}/${NAME:?}" ]]; then
+ echo -e "\e[36m create nfs folder\e[0m";
+ sudo mkdir -p "${DST_NFS_ETH0:?}/${NAME:?}";
+ fi
+
+ if ! [[ -d "${DST_ORIGINAL:?}" ]]; then
+ if [[ "${bindfs}" == "yes" ]]; then
+ echo -e "\e[36m create nfs folder\e[0m";
+ sudo mkdir -p "${DST_ORIGINAL:?}";
+ fi
+ fi
+
+ if ! grep -q "${DST_NFS_ETH0:?}/${NAME:?}" /etc/fstab; then
+ echo -e "\e[36m add iso image to fstab\e[0m";
+ if [[ "${bindfs}" == "yes" ]]; then
+ sudo sh -c "echo '${DST_ISO:?}/${FILE_ISO:?} ${DST_ORIGINAL:?} auto ro,nofail,auto,loop 0 10' >> /etc/fstab";
+ sudo sh -c "echo '${DST_ORIGINAL:?} ${DST_NFS_ETH0:?}/${NAME:?} fuse.bindfs ro,auto,force-user=root,force-group=root,perms=a+rX 0 11' >> /etc/fstab";
+ else
+ sudo sh -c "echo '${DST_ISO:?}/${FILE_ISO:?} ${DST_NFS_ETH0:?}/${NAME:?} auto ro,nofail,auto,loop${fstab_options} 0 10' >> /etc/fstab";
+ fi
+ fi
+
+ if ! grep -q "${DST_NFS_ETH0:?}/${NAME:?}" /etc/exports; then
+ echo -e "\e[36m add nfs folder to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_ETH0:?}/${NAME:?} *(ro,async,no_subtree_check,root_squash,mp,fsid=$(uuid))' >> /etc/exports";
+ fi
+
+ if [[ "${bindfs}" == "yes" ]]; then sudo mount "${DST_ORIGINAL:?}"; fi
+ sudo mount "${DST_NFS_ETH0:?}/${NAME:?}";
+ sudo exportfs "*:${DST_NFS_ETH0:?}/${NAME:?}";
+
+ if [[ "${vblade}" == "yes" ]]; then
+ echo -e "\e[36m setup vblade-persistence\e[0m";
+ ##cat << EOF | sudo tee "/etc/vblade.conf.d/e${vblade_shelf}${vblade_slot}.conf" &>/dev/null
+ cat << EOF | sudo tee "/etc/vblade.conf.d/${NAME:?}.conf" &>/dev/null
+shelf=${vblade_shelf}
+slot=${vblade_slot}
+netif=${INTERFACE_ETH0:?}
+filename=${DST_ISO:?}/${FILE_ISO:?}
+options='-r'
+ionice='--class best-effort --classdata 7'
+EOF
+ sudo systemctl daemon-reload;
+ sudo systemctl restart vblade.service;
+ fi
+ else
+ sudo sed /etc/fstab -i -e "/${NAME:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME:?}/d"
+
+ if [[ "${vblade}" == "yes" ]]; then
+ sudo systemctl stop vblade@$(systemd-escape "${NAME:?}").service &>/dev/null;
+ sudo rm -f "/etc/vblade.conf.d/${NAME:?}.conf" &>/dev/null;
+ sudo systemctl daemon-reload &>/dev/null;
+ sudo systemctl restart vblade.service &>/dev/null;
+ fi
+ fi
+}
+
+
+########################################################################
+handle_zip_img() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ # ${2} : optional options
+ local OPT=${2}
+ ####################################################################
+ local RAW_FILENAME=$(basename "${URL:?}" .zip)
+ local RAW_FILENAME_ZIP="${RAW_FILENAME:?}.zip"
+ local NAME_BOOT="${NAME:?}-boot"
+ local NAME_ROOT="${NAME:?}-root"
+ local DST_NFS_BOOT="${DST_NFS_ETH0:?}/${NAME_BOOT:?}"
+ local DST_NFS_ROOT="${DST_NFS_ETH0:?}/${NAME_ROOT:?}"
+ local FILE_URL="${NAME:?}.url"
+ local FILE_IMG="${NAME:?}.img"
+ ####################################################################
+ echo -e "\e[32mhandle_zip_img(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ if ! [[ -d "${DST_IMG:?}/" ]]; then sudo mkdir -p "${DST_IMG:?}/"; fi
+ if ! [[ -d "${DST_NFS_ETH0:?}/" ]]; then sudo mkdir -p "${DST_NFS_ETH0:?}/"; fi
+
+ sudo exportfs -u "*:${DST_NFS_BOOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_BOOT:?}" 2> /dev/null;
+
+ sudo exportfs -u "*:${DST_NFS_ROOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_ROOT:?}" 2> /dev/null;
+
+ if [[ -z "${URL}" ]]; then
+ if ! [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]] \
+ && [[ -s "${SRC_IMG:?}/${FILE_IMG:?}" ]] \
+ && [[ -f "${SRC_IMG:?}/${FILE_URL:?}" ]]; \
+ then
+ echo -e "\e[36m copy img from usb-stick\e[0m";
+ sudo rm -f "${FILE_IMG:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_IMG:?}" "${DST_IMG:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_URL:?}" "${DST_IMG:?}";
+ fi
+ else
+ if [[ -s "${SRC_IMG:?}/${FILE_IMG:?}" ]] \
+ && [[ -f "${SRC_IMG:?}/${FILE_URL:?}" ]] \
+ && grep -q "${URL}" "${SRC_IMG:?}/${FILE_URL:?}" 2> /dev/null \
+ && ! grep -q "${URL}" "${DST_IMG:?}/${FILE_URL:?}" 2> /dev/null; \
+ then
+ echo -e "\e[36m copy img from usb-stick\e[0m";
+ sudo rm -f "${FILE_IMG:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_IMG:?}" "${DST_IMG:?}";
+ sudo rsync -xa --info=progress2 "${SRC_IMG:?}/${FILE_URL:?}" "${DST_IMG:?}";
+ fi
+
+ if ! [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]] \
+ || ! grep -q "${URL}" "${DST_IMG:?}/${FILE_URL:?}" 2> /dev/null \
+ || ([[ "${OPT}" == "timestamping" ]] && ! compare_last_modification_time "${DST_IMG:?}/${FILE_URL:?}" "${URL:?}"); \
+ then
+ echo -e "\e[36m download image\e[0m";
+ sudo rm -f "${DST_IMG:?}/${FILE_IMG:?}";
+ sudo rm -f "${DST_IMG:?}/${FILE_URL:?}";
+ sudo wget -O "${DST_IMG:?}/${RAW_FILENAME_ZIP:?}" "${URL:?}";
+
+ sudo sh -c "echo '${URL}' > ${DST_IMG:?}/${FILE_URL:?}";
+ sudo touch -r "${DST_IMG:?}/${RAW_FILENAME_ZIP:?}" "${DST_IMG:?}/${FILE_URL:?}";
+
+ echo -e "\e[36m extract image\e[0m";
+ sudo unzip "${DST_IMG:?}/${RAW_FILENAME_ZIP:?}" -d "${DST_IMG:?}" > /tmp/output.tmp;
+ sudo rm -f "${DST_IMG:?}/${RAW_FILENAME_ZIP:?}";
+ local RAW_FILENAME_IMG=$(grep 'inflating' /tmp/output.tmp | cut -d':' -f2 | xargs basename)
+ sudo mv "${DST_IMG:?}/${RAW_FILENAME_IMG:?}" "${DST_IMG:?}/${FILE_IMG:?}";
+ rm /tmp/output.tmp
+ fi
+ fi
+
+ if ! [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]]; then
+ sudo rm -f "${DST_IMG:?}/${FILE_IMG:?}";
+ sudo rm -f "${DST_IMG:?}/${FILE_URL:?}";
+ fi
+
+ if [[ -s "${DST_IMG:?}/${FILE_IMG:?}" ]] && [[ $(sfdisk -d ${DST_IMG:?}/${FILE_IMG:?}) ]]; then
+ local OFFSET_BOOT=$((512*$(sfdisk -d ${DST_IMG:?}/${FILE_IMG:?} | grep ${DST_IMG:?}/${FILE_IMG:?}\1 | awk '{print $4}' | sed 's/,//')))
+ local SIZE_BOOT=$((512*$(sfdisk -d ${DST_IMG:?}/${FILE_IMG:?} | grep ${DST_IMG:?}/${FILE_IMG:?}\1 | awk '{print $6}' | sed 's/,//')))
+ local OFFSET_ROOT=$((512*$(sfdisk -d ${DST_IMG:?}/${FILE_IMG:?} | grep ${DST_IMG:?}/${FILE_IMG:?}\2 | awk '{print $4}' | sed 's/,//')))
+ local SIZE_ROOT=$((512*$(sfdisk -d ${DST_IMG:?}/${FILE_IMG:?} | grep ${DST_IMG:?}/${FILE_IMG:?}\2 | awk '{print $6}' | sed 's/,//')))
+ #sfdisk -d "${DST_IMG:?}/${FILE_IMG:?}"
+
+ sudo sed /etc/fstab -i -e "/${NAME_BOOT:?}/d"
+ sudo sed /etc/fstab -i -e "/${NAME_ROOT:?}/d"
+
+ ## boot
+ if ! [[ -d "${DST_NFS_BOOT:?}" ]]; then
+ echo -e "\e[36m create image-boot folder\e[0m";
+ sudo mkdir -p "${DST_NFS_BOOT:?}";
+ fi
+
+ if ! grep -q "${DST_NFS_BOOT:?}" /etc/fstab; then
+ echo -e "\e[36m add image-boot to fstab\e[0m";
+ sudo sh -c "echo '${DST_IMG:?}/${FILE_IMG:?} ${DST_NFS_BOOT:?} auto ro,nofail,auto,loop,offset=${OFFSET_BOOT:?},sizelimit=${SIZE_BOOT:?} 0 11' >> /etc/fstab";
+ fi
+
+ if ! grep -q "${DST_NFS_BOOT:?}" /etc/exports; then
+ echo -e "\e[36m add image-boot folder to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_BOOT:?} *(ro,async,no_subtree_check,root_squash,mp,fsid=$(uuid))' >> /etc/exports";
+ fi
+
+ ## root
+ if ! [[ -d "${DST_NFS_ROOT:?}" ]]; then
+ echo -e "\e[36m create image-root folder\e[0m";
+ sudo mkdir -p "${DST_NFS_ROOT:?}";
+ fi
+
+ if ! grep -q "${DST_NFS_ROOT:?}" /etc/fstab; then
+ echo -e "\e[36m add image-root to fstab\e[0m";
+ sudo sh -c "echo '${DST_IMG:?}/${FILE_IMG:?} ${DST_NFS_ROOT:?} auto ro,nofail,auto,loop,offset=${OFFSET_ROOT:?},sizelimit=${SIZE_ROOT:?} 0 11' >> /etc/fstab";
+ fi
+
+ if ! grep -q "${DST_NFS_ROOT:?}" /etc/exports; then
+ echo -e "\e[36m add image-root folder to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_ROOT:?} *(ro,async,no_subtree_check,root_squash,mp,fsid=$(uuid))' >> /etc/exports";
+ fi
+
+ sudo mount "${DST_NFS_BOOT:?}";
+ sudo exportfs "*:${DST_NFS_BOOT:?}";
+
+ sudo mount "${DST_NFS_ROOT:?}";
+ sudo exportfs "*:${DST_NFS_ROOT:?}";
+ else
+ ## boot
+ sudo sed /etc/fstab -i -e "/${NAME_BOOT:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME_BOOT:?}/d"
+ ## root
+ sudo sed /etc/fstab -i -e "/${NAME_ROOT:?}/d"
+ sudo sed /etc/exports -i -e "/${NAME_ROOT:?}/d"
+ fi
+}
+
+########################################################################
+handle_kernel() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE -> $VARIABLE, $VARIABLE_URL, $VARIABLE_SUM, $VARIABLE_SUM_TYPE
+ local NAME="${!1}"
+ local URL="${1}_URL"; URL="${!URL}"
+ local SUM="${1}_SUM"; SUM="${!SUM}"
+ local SUM_TYPE="${1}_SUM_TYPE"; SUM_TYPE="${!SUM_TYPE}"
+ # ${2} : optional options
+ local OPT=${2}
+ ####################################################################
+ local FILE_URL="${NAME:?}.url"
+ local FILE_KERNEL="${NAME:?}.kernel"
+ local DST_ORIGINAL="/srv/tmp/original/${NAME:?}"
+ ####################################################################
+ echo -e "\e[32mhandle_kernel(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ if ! [[ -d "${DST_NFS_ETH0:?}/" ]]; then sudo mkdir -p "${DST_NFS_ETH0:?}/"; fi
+
+ sudo exportfs -u "*:${DST_NFS_ETH0:?}/${NAME:?}" 2> /dev/null;
+
+ if [[ -z "${URL}" ]]; then
+ if ! [[ -s "${DST_ISO:?}/${FILE_KERNEL:?}" ]] \
+ && [[ -s "${SRC_ISO:?}/${FILE_KERNEL:?}" ]] \
+ && [[ -f "${SRC_ISO:?}/${FILE_URL:?}" ]]; \
+ then
+ echo -e "\e[36m copy kernel from usb-stick\e[0m";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_KERNEL:?}" "${DST_ISO:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_URL:?}" "${DST_ISO:?}";
+ fi
+ else
+ if [[ -s "${SRC_ISO:?}/${FILE_KERNEL:?}" ]] \
+ && [[ -f "${SRC_ISO:?}/${FILE_URL:?}" ]] \
+ && grep -q "${URL}" "${SRC_ISO:?}/${FILE_URL:?}" 2> /dev/null \
+ && ! grep -q "${URL}" "${DST_ISO:?}/${FILE_URL:?}" 2> /dev/null; \
+ then
+ echo -e "\e[36m copy kernel from usb-stick\e[0m";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_KERNEL:?}" "${DST_ISO:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ISO:?}/${FILE_URL:?}" "${DST_ISO:?}";
+ fi
+
+ if ! [[ -s "${DST_ISO:?}/${FILE_KERNEL:?}" ]] \
+ || ! grep -q "${URL}" "${DST_ISO:?}/${FILE_URL:?}" 2> /dev/null \
+ || ([[ "${OPT}" == "timestamping" ]] && ! compare_last_modification_time "${DST_ISO:?}/${FILE_KERNEL:?}" "${URL:?}"); \
+ then
+ echo -e "\e[36m download kernel image\e[0m";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ sudo rm -f "${DST_ISO:?}/${FILE_KERNEL:?}";
+ sudo wget -O "${DST_ISO:?}/${FILE_KERNEL:?}" "${URL:?}";
+
+ sudo sh -c "echo '${URL}' > ${DST_ISO:?}/${FILE_URL:?}";
+ sudo touch -r "${DST_ISO:?}/${FILE_KERNEL:?}" "${DST_ISO:?}/${FILE_URL:?}";
+ fi
+ fi
+
+ if ! [[ -s "${DST_ISO:?}/${FILE_KERNEL:?}" ]]; then
+ sudo rm -f "${DST_ISO:?}/${FILE_KERNEL:?}";
+ sudo rm -f "${DST_ISO:?}/${FILE_URL:?}";
+ fi
+
+ if [[ -s "${DST_ISO:?}/${FILE_KERNEL:?}" ]]; then
+ if ! [[ -d "${DST_NFS_ETH0:?}/${NAME:?}" ]]; then
+ echo -e "\e[36m create nfs folder\e[0m";
+ sudo mkdir -p "${DST_NFS_ETH0:?}/${NAME:?}";
+ fi
+
+ sudo cp "${DST_ISO:?}/${FILE_KERNEL:?}" "${DST_NFS_ETH0:?}/${NAME:?}/kernel"
+
+ if ! grep -q "${DST_NFS_ETH0:?}/${NAME:?}" /etc/exports; then
+ echo -e "\e[36m add nfs folder to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_ETH0:?}/${NAME:?} *(ro,async,no_subtree_check,root_squash,mp,fsid=$(uuid))' >> /etc/exports";
+ fi
+
+ sudo exportfs "*:${DST_NFS_ETH0:?}/${NAME:?}";
+ else
+ sudo sed /etc/exports -i -e "/${NAME:?}/d"
+ fi
+}
+
+
+########################################################################
+handle_item() {
+ local ITEM_ACTION="${1}"
+ local ITEM_TYPE="${2}"
+
+ shift;
+ shift;
+
+ case "${ITEM_ACTION:?}" in
+ '+')
+ case "${ITEM_TYPE:?}" in
+ img)
+ handle_img $*;
+ ;;
+ iso)
+ handle_iso $*;
+ ;;
+ kernel)
+ handle_kernel $*;
+ ;;
+ zip_img)
+ handle_zip_img $*;
+ ;;
+ rpi_pxe)
+ handle_rpi_pxe $*;
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ '-')
+ case "${ITEM_TYPE:?}" in
+ img)
+ _unhandle_img $*;
+ ;;
+ iso)
+ _unhandle_iso $*;
+ ;;
+ kernel)
+ _unhandle_kernel $*;
+ ;;
+ zip_img)
+ _unhandle_zip_img $*;
+ ;;
+ rpi_pxe)
+ #_unhandle_rpi_pxe $*;
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ '#')
+ ;;
+ *)
+ ;;
+ esac
+}
+
+
+########################################################################
+handle_ipxe() {
+ echo -e "\e[32mhandle_ipxe()\e[0m";
+
+ local FILE_MENU="${DST_TFTP_ETH0:?}/${DST_IPXE:?}/menu.ipxe"
+ local FILE_BASE="http://${IP_ETH0:?}/srv"
+
+ if ! [[ -d "${DST_TFTP_ETH0:?}/${DST_IPXE:?}" ]]; then sudo mkdir -p "${DST_TFTP_ETH0:?}/${DST_IPXE:?}"; fi
+
+ ####################################################################
+ # http://ipxe.org/docs
+ # http://ipxe.org/howto/chainloading
+ ####################################################################
+ if (! compare_last_modification_time "${DST_TFTP_ETH0:?}/${DST_IPXE:?}/ipxe.efi" https://boot.ipxe.org/ipxe.efi); then
+ echo -e "\e[36m download iPXE stuff\e[0m";
+ sudo wget --quiet -O "${DST_TFTP_ETH0:?}/${DST_IPXE:?}/ipxe.efi" https://boot.ipxe.org/ipxe.efi;
+ sudo wget --quiet -O "${DST_TFTP_ETH0:?}/${DST_IPXE:?}/undionly.kpxe" https://boot.ipxe.org/undionly.kpxe;
+
+ [[ -f "${DST_TFTP_ETH0:?}/${DST_IPXE:?}/wimboot" ]] || (\
+ wget -O /tmp/wimboot.tar.gz https://git.ipxe.org/releases/wimboot/wimboot-latest.tar.gz; \
+ tar -xf /tmp/wimboot.tar.gz --wildcards *wimboot -O | sudo tee "${DST_TFTP_ETH0:?}/${DST_IPXE:?}/wimboot" &>/dev/null);
+
+ sudo wget --quiet -O "${DST_TFTP_ETH0:?}/${DST_IPXE:?}/ipxe.pxe" https://boot.ipxe.org/ipxe.pxe;
+ sudo wget --quiet -O "${DST_TFTP_ETH0:?}/${DST_IPXE:?}/ipxe.iso" https://boot.ipxe.org/ipxe.iso;
+ fi
+
+ sudo touch "${FILE_MENU:?}"
+ . "${script_dir:?}/p2-include-menu" ipxe
+}
+
+
+########################################################################
+handle_pxe_menu() {
+ # $1 : menu short name
+ # $2 : menu file name
+ local MENU_PXE="${1}"
+ local FILE_NAME="${2}"
+ ####################################################################
+ local FILE_MENU="${DST_TFTP_ETH0:?}/${MENU_PXE:?}/pxelinux.cfg/${FILE_NAME:?}"
+ local FILE_BASE="http://${IP_ETH0:?}/srv"
+ ####################################################################
+ ## INFO:
+ ## The entry before -- means that it will be used by the live system / the installer
+ ## The entry after -- means that it will be carried to and used by the installed system
+ ## https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/kernel-parameters.txt
+ ##
+ ## some debian/ubuntu parameter
+ ## https://www.debian.org/releases/stretch/example-preseed.txt
+ ## https://www.debian.org/releases/stretch/amd64/apb.html.en
+ ## https://www.debian.org/releases/stretch/amd64/ch05s03.html.en
+ ## https://manpages.debian.org/stretch/live-config-doc/live-config.7.en.html
+ ## http://manpages.ubuntu.com/manpages/precise/man7/live-config.7.html
+ ####################################################################
+ echo -e "\e[32mhandle_pxe_menu(\e[0m${MENU_PXE:?}\e[32m)\e[0m";
+ echo -e "\e[36m setup sys menu for pxe\e[0m";
+ if ! [[ -d "${DST_TFTP_ETH0:?}/${MENU_PXE:?}/pxelinux.cfg" ]]; then sudo mkdir -p "${DST_TFTP_ETH0:?}/${MENU_PXE:?}/pxelinux.cfg"; fi
+ if [[ -d "${DST_TFTP_ETH0:?}/${MENU_PXE:?}/pxelinux.cfg" ]]; then
+ cat << EOF | sudo tee "${FILE_MENU:?}" &>/dev/null
+########################################
+# ${FILE_MENU:?}
+
+# http://www.syslinux.org/wiki/index.php?title=Menu
+
+UI menu.c32
+
+PROMPT 0
+NOESCAPE 1
+
+MENU CLEAR
+MENU MARGIN 0
+MENU ROWS 17
+MENU TABMSGROW 21
+
+MENU COLOR title 1;37;44 * * all
+MENU COLOR border 22;36;44 * * std
+MENU COLOR scrollbar 22;36;44 * * std
+MENU COLOR disabled 22;36;44 * * std
+MENU COLOR sel 1;37;41 * * all
+MENU COLOR hotsel 1;37;41 * * all
+MENU COLOR tabmsg 22;36;44 * * std
+
+MENU TITLE PXE-Linux Boot Menu (${MENU_PXE:?})
+MENU TABMSG [Enter]=boot, [Tab]=edit, [Esc]=return
+
+EOF
+ fi
+
+ ####################################################################
+ ####################################################################
+ . "${script_dir:?}/p2-include-menu"
+ . "${script_dir:?}/c2-custom-menu"
+}
+
+
+########################################################################
+handle_pxe() {
+ echo -e "\e[32mhandle_pxe()\e[0m";
+
+ ####################################################################
+ [[ -d "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}" ]] || sudo mkdir -p "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}";
+ if [[ -d "${SRC_TFTP_ETH0:?}" ]]; then
+ echo -e "\e[36m copy win-pe stuff\e[0m";
+ if ! [[ -f "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/pxeboot.n12" ]] && [[ -f "${SRC_TFTP_ETH0:?}/pxeboot.n12" ]]; then sudo rsync -xa --info=progress2 "${SRC_TFTP_ETH0:?}/pxeboot.n12" "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/"; fi
+ if ! [[ -f "${DST_TFTP_ETH0:?}/bootmgr.exe" ]] && [[ -f "${SRC_TFTP_ETH0:?}/bootmgr.exe" ]]; then sudo rsync -xa --info=progress2 "${SRC_TFTP_ETH0:?}/bootmgr.exe" "${DST_TFTP_ETH0:?}/"; fi
+ if ! [[ -d "${DST_TFTP_ETH0:?}/Boot" ]] && [[ -d "${SRC_TFTP_ETH0:?}/Boot" ]]; then sudo rsync -xa --info=progress2 "${SRC_TFTP_ETH0:?}/Boot" "${DST_TFTP_ETH0:?}/"; fi
+ fi
+ [[ -h "${DST_TFTP_ETH0:?}/sources" ]] || sudo ln -s "${DST_NFS_ETH0:?}/${WIN_PE_X86:?}/sources/" "${DST_TFTP_ETH0:?}/sources";
+
+ ####################################################################
+ echo -e "\e[36m setup sys menu files for pxe bios\e[0m";
+ [[ -d "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}" ]] || sudo mkdir -p "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/lpxelinux.0" ]] || sudo ln -s /usr/lib/PXELINUX/lpxelinux.0 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/ldlinux.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/bios/ldlinux.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/menu.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/bios/menu.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/libutil.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/bios/libutil.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/poweroff.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/bios/poweroff.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/reboot.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/bios/reboot.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/libcom32.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/bios/libcom32.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/nfs" ]] || sudo ln -s "${DST_NFS_ETH0:?}/" "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/nfs";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/iso" ]] || sudo ln -s "${DST_ISO:?}/" "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/iso";
+
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/memdisk" ]] || sudo ln -s /usr/lib/syslinux/memdisk "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/linux.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/bios/linux.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/";
+ [[ -f "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/wimboot" ]] || ( \
+ wget -O /tmp/wimboot.tar.gz https://git.ipxe.org/releases/wimboot/wimboot-latest.tar.gz; \
+ tar -xf /tmp/wimboot.tar.gz --wildcards *wimboot -O | sudo tee "${DST_TFTP_ETH0:?}/${DST_PXE_BIOS:?}/wimboot" > /dev/null);
+
+ handle_pxe_menu "${DST_PXE_BIOS:?}" default;
+
+ ####################################################################
+ echo -e "\e[36m setup sys menu files for pxe efi32\e[0m";
+ [[ -d "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}" ]] || sudo mkdir -p "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/bootia32.efi" ]] || sudo ln -s /usr/lib/SYSLINUX.EFI/efi32/syslinux.efi "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/bootia32.efi";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/ldlinux.e32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi32/ldlinux.e32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/menu.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi32/menu.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/libutil.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi32/libutil.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/poweroff.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi32/poweroff.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/reboot.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi32/reboot.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/libcom32.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi32/libcom32.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/";
+
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/nfs" ]] || sudo ln -s "${DST_NFS_ETH0:?}/" "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/nfs";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/iso" ]] || sudo ln -s "${DST_ISO:?}/" "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/iso";
+
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/linux.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi32/linux.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/";
+ [[ -f "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/wimboot" ]] || ( \
+ wget -O /tmp/wimboot.tar.gz https://git.ipxe.org/releases/wimboot/wimboot-latest.tar.gz; \
+ tar -xf /tmp/wimboot.tar.gz --wildcards *wimboot -O | sudo tee "${DST_TFTP_ETH0:?}/${DST_PXE_EFI32:?}/wimboot" &>/dev/null);
+
+ handle_pxe_menu "${DST_PXE_EFI32:?}" default;
+
+ ####################################################################
+ echo -e "\e[36m setup sys menu files for pxe efi64\e[0m";
+ [[ -d "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}" ]] || sudo mkdir -p "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/bootx64.efi" ]] || sudo ln -s /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/bootx64.efi";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/ldlinux.e64" ]] || sudo ln -s /usr/lib/syslinux/modules/efi64/ldlinux.e64 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/menu.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi64/menu.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/libutil.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi64/libutil.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/reboot.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi64/reboot.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/libcom32.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi64/libcom32.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/";
+
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/nfs" ]] || sudo ln -s "${DST_NFS_ETH0:?}/" "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/nfs";
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/iso" ]] || sudo ln -s "${DST_ISO:?}/" "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/iso";
+
+ [[ -h "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/linux.c32" ]] || sudo ln -s /usr/lib/syslinux/modules/efi64/linux.c32 "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/";
+ [[ -f "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/wimboot" ]] || (\
+ wget -O /tmp/wimboot.tar.gz https://git.ipxe.org/releases/wimboot/wimboot-latest.tar.gz; \
+ tar -xf /tmp/wimboot.tar.gz --wildcards *wimboot -O | sudo tee "${DST_TFTP_ETH0:?}/${DST_PXE_EFI64:?}/wimboot" &>/dev/null);
+
+ handle_pxe_menu "${DST_PXE_EFI64:?}" default;
+}
+
+
+########################################################################
+handle_rpi_pxe_classic() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE
+ # ${!2} : name of VARIABLE for serial number
+ # ${3} : flags (redo,bootcode,cmdline,config,ssh,root,fstab,wpa,history)
+ local NAME="${!1}"
+ local SN="${!2}"
+ local FLAGS="${3}"
+ ####################################################################
+ local NAME_BOOT="${NAME:?}-boot"
+ local NAME_ROOT="${NAME:?}-root"
+ local DST_SN_BOOT="${SN:?}-boot"
+ local DST_SN_ROOT="${SN:?}-root"
+ local SRC_BOOT="${DST_NFS_ETH0:?}/${NAME_BOOT:?}"
+ local SRC_ROOT="${DST_NFS_ETH0:?}/${NAME_ROOT:?}"
+ local DST_NFS_BOOT="${DST_NFS_ETH0:?}/${DST_SN_BOOT:?}"
+ local DST_NFS_ROOT="${DST_NFS_ETH0:?}/${DST_SN_ROOT:?}"
+ local FILE_URL="${NAME:?}.url"
+ ####################################################################
+ local DST_CUSTOM_BOOT="${DST_NFS_BOOT:?}"
+ local DST_CUSTOM_ROOT="${DST_NFS_ROOT:?}"
+ ####################################################################
+ echo -e "\e[32mhandle_rpi_pxe_classic(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ sudo exportfs -u "*:${DST_NFS_BOOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_BOOT:?}" 2> /dev/null;
+
+ sudo exportfs -u "*:${DST_NFS_ROOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_BOOT:?}" 2> /dev/null;
+
+
+ ####################################################################
+ if (echo "${FLAGS:?}" | grep -q redo) \
+ || ( [[ -f "${DST_IMG:?}/${FILE_URL:?}" ]] && ! grep -q $(cat "${DST_IMG:?}/${FILE_URL:?}") "${DST_NFS_BOOT:?}/${FILE_URL:?}" ) 2> /dev/null; then
+ echo -e "\e[36m delete old boot files\e[0m";
+ sudo rm -rf "${DST_NFS_BOOT:?}";
+ echo -e "\e[36m delete old root files\e[0m";
+ sudo rm -rf "${DST_NFS_ROOT:?}";
+ sudo sed /etc/fstab -i -e "/${DST_SN_BOOT:?}/d"
+ sudo sed /etc/fstab -i -e "/${DST_SN_ROOT:?}/d"
+ sudo sed /etc/exports -i -e "/${DST_SN_BOOT:?}/d"
+ sudo sed /etc/exports -i -e "/${DST_SN_ROOT:?}/d"
+ local FLAGS="${FLAGS:?}",redo
+ fi
+
+ ####################################################################
+ if ! [[ -d "${DST_NFS_BOOT:?}" ]]; then
+ echo -e "\e[36m copy boot files\e[0m";
+ sudo mkdir -p "${DST_NFS_BOOT:?}";
+ sudo rsync -xa --info=progress2 "${SRC_BOOT:?}/"* "${DST_NFS_BOOT:?}/"
+ fi
+
+ if ! [[ -d "${DST_NFS_ROOT:?}" ]] \
+ && (echo "${FLAGS:?}" | grep -q root); then
+ echo -e "\e[36m copy root files\e[0m";
+ sudo mkdir -p "${DST_NFS_ROOT:?}";
+ sudo rsync -xa --info=progress2 "${SRC_ROOT:?}/"* "${DST_NFS_ROOT:?}/"
+ fi
+
+ ####################################################################
+ if ! [[ -h "${DST_TFTP_ETH0:?}/${SN:?}" ]]; then sudo ln -s "${DST_NFS_BOOT:?}/" "${DST_TFTP_ETH0:?}/${SN:?}"; fi
+
+ ####################################################################
+ sudo cp "${DST_IMG:?}/${FILE_URL:?}" "${DST_CUSTOM_BOOT:?}/${FILE_URL:?}";
+ handle_rpi_pxe_customization "${DST_CUSTOM_BOOT:?}" "${DST_CUSTOM_ROOT:?}" "${FLAGS:?}";
+
+ ####################################################################
+ if ! grep -q "${DST_NFS_BOOT:?}" /etc/exports; then
+ echo -e "\e[36m add ${DST_NFS_BOOT:?} to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_BOOT:?} *(rw,sync,no_subtree_check,no_root_squash)' >> /etc/exports";
+ fi
+ sudo exportfs "*:${DST_NFS_BOOT:?}";
+
+ ####################################################################
+ if (echo "${FLAGS:?}" | grep -q root); then
+ if ! grep -q "${DST_NFS_ROOT:?}" /etc/exports; then
+ echo -e "\e[36m add ${DST_NFS_ROOT:?} to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_ROOT:?} *(rw,sync,no_subtree_check,no_root_squash)' >> /etc/exports";
+ fi
+ sudo exportfs "*:${DST_NFS_ROOT:?}";
+ else
+ sudo sed /etc/exports -i -e "/${NAME_ROOT:?}/d"
+ fi
+
+ ####################################################################
+ if ! [[ -f "${DST_TFTP_ETH0:?}/bootcode.bin" ]]; then
+ echo -e "\e[36m download bootcode.bin for RPi3 network booting\e[0m";
+ sudo wget -O "${DST_TFTP_ETH0:?}/bootcode.bin" https://github.com/raspberrypi/firmware/raw/stable/boot/bootcode.bin;
+ fi
+}
+
+
+########################################################################
+handle_rpi_pxe_overlay() {
+ if [[ -z "${1}" ]] || [[ -z "${!1}" ]]; then return 0; fi
+
+ ####################################################################
+ # ${!1} : name of VARIABLE
+ # ${!2} : name of VARIABLE for serial number
+ # ${3} : flags (redo,bootcode,cmdline,config,ssh,root,fstab,wpa,history)
+ local NAME="${!1}"
+ local SN="${!2}"
+ local FLAGS="${3}"
+ ####################################################################
+ local NAME_BOOT="${NAME:?}-boot"
+ local NAME_ROOT="${NAME:?}-root"
+ local DST_SN_BOOT="${SN:?}-boot"
+ local DST_SN_ROOT="${SN:?}-root"
+ local SRC_BOOT="${DST_NFS_ETH0:?}/${NAME_BOOT:?}"
+ local SRC_ROOT="${DST_NFS_ETH0:?}/${NAME_ROOT:?}"
+ local DST_NFS_BOOT="${DST_NFS_ETH0:?}/${DST_SN_BOOT:?}"
+ local DST_NFS_ROOT="${DST_NFS_ETH0:?}/${DST_SN_ROOT:?}"
+ local FILE_URL="${NAME:?}.url"
+ ####################################################################
+ local DST_LOWER_BOOT="/srv/tmp/lower/${NAME_BOOT:?}"
+ local DST_LOWER_ROOT="${SRC_ROOT:?}"
+ local DST_UPPER_BOOT="/srv/tmp/upper/${DST_SN_BOOT:?}"
+ local DST_UPPER_ROOT="/srv/tmp/upper/${DST_SN_ROOT:?}"
+ local DST_WORK_BOOT="/srv/tmp/work/${DST_SN_BOOT:?}"
+ local DST_WORK_ROOT="/srv/tmp/work/${DST_SN_ROOT:?}"
+ local DST_MERGED_BOOT="/srv/tmp/merged/${DST_SN_BOOT:?}"
+ local DST_MERGED_ROOT="/srv/tmp/merged/${DST_SN_ROOT:?}"
+ ####################################################################
+ local DST_CUSTOM_BOOT="${DST_NFS_BOOT:?}"
+ local DST_CUSTOM_ROOT="${DST_NFS_ROOT:?}"
+ ####################################################################
+ echo -e "\e[32mhandle_rpi_pxe_overlay(\e[0m${NAME:?}\e[32m)\e[0m";
+
+ sudo exportfs -u "*:${DST_NFS_BOOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_BOOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_MERGED_BOOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_LOWER_BOOT:?}" 2> /dev/null;
+
+ sudo exportfs -u "*:${DST_NFS_ROOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_NFS_ROOT:?}" 2> /dev/null;
+ sudo umount -f "${DST_MERGED_ROOT:?}" 2> /dev/null;
+
+
+ ####################################################################
+ if (echo "${FLAGS:?}" | grep -q redo) \
+ || ( [[ -f "${DST_IMG:?}/${FILE_URL:?}" ]] && ! grep -q $(cat "${DST_IMG:?}/${FILE_URL:?}") "${DST_UPPER_BOOT:?}/${FILE_URL:?}" ) 2> /dev/null; then
+ echo -e "\e[36m delete old boot files\e[0m";
+ sudo rm -rf "${DST_NFS_BOOT:?}";
+ sudo rm -rf "${DST_UPPER_BOOT:?}";
+ sudo rm -rf "${DST_WORK_BOOT:?}";
+ sudo rm -rf "${DST_MERGED_BOOT:?}";
+ sudo rm -rf "${DST_LOWER_BOOT:?}";
+ echo -e "\e[36m delete old root files\e[0m";
+ sudo rm -rf "${DST_NFS_ROOT:?}";
+ sudo rm -rf "${DST_UPPER_ROOT:?}";
+ sudo rm -rf "${DST_WORK_ROOT:?}";
+ sudo rm -rf "${DST_MERGED_BOOT:?}";
+ sudo sed /etc/fstab -i -e "/${DST_SN_BOOT:?}/d"
+ sudo sed /etc/fstab -i -e "/${DST_SN_ROOT:?}/d"
+ sudo sed /etc/exports -i -e "/${DST_SN_BOOT:?}/d"
+ sudo sed /etc/exports -i -e "/${DST_SN_ROOT:?}/d"
+ local FLAGS="${FLAGS:?}",redo
+ fi
+
+ ####################################################################
+ if ! [[ -d "${DST_NFS_BOOT:?}" ]]; then sudo mkdir -p "${DST_NFS_BOOT:?}"; fi
+ if ! [[ -d "${DST_UPPER_BOOT:?}" ]]; then sudo mkdir -p "${DST_UPPER_BOOT:?}"; fi
+ if ! [[ -d "${DST_WORK_BOOT:?}" ]]; then sudo mkdir -p "${DST_WORK_BOOT:?}"; fi
+ if ! [[ -d "${DST_MERGED_BOOT:?}" ]]; then sudo mkdir -p "${DST_MERGED_BOOT:?}"; fi
+ if ! [[ -d "${DST_LOWER_BOOT:?}" ]]; then sudo mkdir -p "${DST_LOWER_BOOT:?}"; fi
+ ####################################################################
+ if (echo "${FLAGS:?}" | grep -q root); then
+ if ! [[ -d "${DST_NFS_ROOT:?}" ]]; then sudo mkdir -p "${DST_NFS_ROOT:?}"; fi
+ if ! [[ -d "${DST_UPPER_ROOT:?}" ]]; then sudo mkdir -p "${DST_UPPER_ROOT:?}"; fi
+ if ! [[ -d "${DST_WORK_ROOT:?}" ]]; then sudo mkdir -p "${DST_WORK_ROOT:?}"; fi
+ if ! [[ -d "${DST_MERGED_ROOT:?}" ]]; then sudo mkdir -p "${DST_MERGED_ROOT:?}"; fi
+ fi
+
+ ####################################################################
+ if ! [[ -f "/etc/mount-delayed.sh" ]]; then sudo touch /etc/mount-delayed.sh; sudo chmod 0755 /etc/mount-delayed.sh; fi
+ if ! grep -q "mount-delayed.sh" /etc/rc.local; then
+ sudo sed /etc/rc.local -i -e "s/^exit 0$/\########################################\n## workaround\n\/etc\/mount-delayed.sh;\n\nexit 0/"
+ fi
+ sudo sed /etc/mount-delayed.sh -i -e "/${DST_SN_BOOT:?}/d"
+ sudo sh -c "echo 'mount ${DST_LOWER_BOOT:?}' >> /etc/mount-delayed.sh";
+ sudo sh -c "echo 'mount ${DST_MERGED_BOOT:?}' >> /etc/mount-delayed.sh";
+ sudo sh -c "echo 'mount ${DST_NFS_BOOT:?}' >> /etc/mount-delayed.sh";
+ sudo sed /etc/mount-delayed.sh -i -e "/${DST_SN_ROOT:?}/d"
+ if (echo "${FLAGS:?}" | grep -q root); then
+ sudo sh -c "echo 'mount ${DST_MERGED_ROOT:?}' >> /etc/mount-delayed.sh";
+ sudo sh -c "echo 'mount ${DST_NFS_ROOT:?}' >> /etc/mount-delayed.sh";
+ fi
+
+ ####################################################################
+ if ! grep -q "${DST_NFS_BOOT:?}" /etc/fstab; then
+ echo -e "\e[36m add image-boot to fstab\e[0m";
+ sudo sh -c "echo '${SRC_BOOT:?} ${DST_LOWER_BOOT:?} fuse.bindfs ro,noauto 0 12' >> /etc/fstab";
+ sudo sh -c "echo 'overlay ${DST_MERGED_BOOT:?} overlay rw,noauto,lowerdir=${DST_LOWER_BOOT:?},upperdir=${DST_UPPER_BOOT:?},workdir=${DST_WORK_BOOT:?} 0 13' >> /etc/fstab";
+ sudo sh -c "echo '${DST_MERGED_BOOT:?} ${DST_NFS_BOOT:?} fuse.bindfs rw,noauto 0 14' >> /etc/fstab";
+ fi
+
+ ####################################################################
+ if (echo "${FLAGS:?}" | grep -q root); then
+ if ! grep -q "${DST_NFS_ROOT:?}" /etc/fstab; then
+ echo -e "\e[36m add image-root to fstab\e[0m";
+ sudo sh -c "echo 'overlay ${DST_MERGED_ROOT:?} overlay rw,lowerdir=${DST_LOWER_ROOT:?},upperdir=${DST_UPPER_ROOT:?},workdir=${DST_WORK_ROOT:?} 0 13' >> /etc/fstab";
+ sudo sh -c "echo '${DST_MERGED_ROOT:?} ${DST_NFS_ROOT:?} fuse.bindfs rw,noauto 0 14' >> /etc/fstab";
+ fi
+ fi
+
+
+ ####################################################################
+ sudo mount "${DST_LOWER_BOOT:?}";
+ sudo mount "${DST_MERGED_BOOT:?}";
+ sudo mount "${DST_NFS_BOOT:?}";
+ if (echo "${FLAGS:?}" | grep -q root); then
+ sudo mount "${DST_MERGED_ROOT:?}";
+ sudo mount "${DST_NFS_ROOT:?}";
+ fi
+
+ ####################################################################
+ if ! [[ -h "${DST_TFTP_ETH0:?}/${SN:?}" ]]; then sudo ln -s "${DST_NFS_BOOT:?}/" "${DST_TFTP_ETH0:?}/${SN:?}"; fi
+
+ ####################################################################
+ sudo cp "${DST_IMG:?}/${FILE_URL:?}" "${DST_CUSTOM_BOOT:?}/${FILE_URL:?}";
+ handle_rpi_pxe_customization "${DST_CUSTOM_BOOT:?}" "${DST_CUSTOM_ROOT:?}" "${FLAGS:?}";
+
+ ####################################################################
+ if ! grep -q "${DST_NFS_BOOT:?}" /etc/exports; then
+ echo -e "\e[36m add ${DST_NFS_BOOT:?} to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_BOOT:?} *(rw,sync,no_subtree_check,no_root_squash,mp,fsid=$(uuid))' >> /etc/exports";
+ fi
+ sudo exportfs "*:${DST_NFS_BOOT:?}";
+
+ ####################################################################
+ if (echo "${FLAGS:?}" | grep -q root); then
+ if ! grep -q "${DST_NFS_ROOT:?}" /etc/exports; then
+ echo -e "\e[36m add ${DST_NFS_ROOT:?} to exports\e[0m";
+ sudo sh -c "echo '${DST_NFS_ROOT:?} *(rw,sync,no_subtree_check,no_root_squash,mp,fsid=$(uuid))' >> /etc/exports";
+ fi
+ sudo exportfs "*:${DST_NFS_ROOT:?}";
+ else
+ sudo sed /etc/fstab -i -e "/${DST_SN_ROOT:?}/d"
+ sudo sed /etc/exports -i -e "/${DST_SN_ROOT:?}/d"
+ fi
+
+ ####################################################################
+ if ! [[ -f "${DST_TFTP_ETH0:?}/bootcode.bin" ]]; then
+ echo -e "\e[36m download bootcode.bin for RPi3 network booting\e[0m";
+ sudo wget -O "${DST_TFTP_ETH0:?}/bootcode.bin" https://github.com/raspberrypi/firmware/raw/stable/boot/bootcode.bin;
+ fi
+}
+
+
+########################################################################
+handle_rpi_pxe_customization() {
+ echo -e "\e[36m handle_rpi_pxe_customization()\e[0m";
+ ####################################################################
+ local DST_CUSTOM_BOOT="${1:?}"
+ local DST_CUSTOM_ROOT="${2:?}"
+ local FLAGS="${3:?}"
+ ####################################################################
+ if (echo "${FLAGS:?}" | grep -q redo); then
+ ################################################################
+ if (echo "${FLAGS:?}" | grep -q cmdline); then
+ echo -e "\e[36m add cmdline file\e[0m";
+ sudo sh -c "echo 'dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 plymouth.ignore-serial-consoles root=/dev/nfs nfsroot=${IP_ETH0:?}:${DST_NFS_ROOT:?},vers=3 rootwait rw ip=dhcp elevator=deadline net.ifnames=0 consoleblank=0' > ${DST_CUSTOM_BOOT:?}/cmdline.txt";
+ fi
+
+ ################################################################
+ if (echo "${FLAGS:?}" | grep -q config); then
+ echo -e "\e[36m add config file\e[0m";
+ cat << EOF | sudo tee "${DST_CUSTOM_BOOT:?}/config.txt" &>/dev/null
+# Enable audio (loads snd_bcm2835)
+dtparam=audio=on
+
+[pi4]
+# Enable DRM VC4 V3D driver on top of the dispmanx display stack
+dtoverlay=vc4-fkms-v3d
+max_framebuffers=2
+
+[all]
+#dtoverlay=vc4-fkms-v3d
+
+disable_overscan=1
+max_usb_current=1
+
+hdmi_force_hotplug=1
+
+#hdmi_ignore_cec=1
+#hdmi_ignore_cec_init=1
+cec_osd_name=NetBoot
+
+disable_splash=1
+EOF
+ fi
+
+ ################################################################
+ if (echo "${FLAGS:?}" | grep -q ssh); then
+ echo -e "\e[36m add ssh file\e[0m";
+ sudo touch "${DST_CUSTOM_BOOT:?}/ssh";
+ fi
+
+ ################################################################
+ if (echo "${FLAGS:?}" | grep -q root); then
+ ############################################################
+ if (echo "${FLAGS:?}" | grep -q fstab); then
+ echo -e "\e[36m add fstab file\e[0m";
+ cat << EOF | sudo tee "${DST_CUSTOM_ROOT:?}/etc/fstab" &>/dev/null
+########################################
+proc /proc proc defaults 0 0
+${IP_ETH0:?}:${DST_NFS_ROOT:?} / nfs defaults,noatime 0 1
+${IP_ETH0:?}:${DST_NFS_BOOT:?} /boot nfs defaults,noatime 0 2
+EOF
+ sudo rm "${DST_CUSTOM_ROOT:?}/etc/init.d/resize2fs_once";
+ fi
+
+ ############################################################
+ if (echo "${FLAGS:?}" | grep -q wpa); then
+ echo -e "\e[36m add wpa_supplicant template file\e[0m";
+ cat << EOF | sudo tee "${DST_CUSTOM_ROOT:?}/etc/wpa_supplicant/wpa_supplicant.conf" &>/dev/null
+########################################
+country=${COUNTRY_WLAN0:?}
+ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
+update_config=1
+
+network={
+ # wpa_passphrase
+ #ssid=
+ #psk=
+
+ # sudo iwlist wlan0 scan [essid ]
+ #bssid=
+
+ scan_ssid=1
+ key_mgmt=WPA-PSK
+}
+EOF
+ if [[ -s "${SRC_BACKUP:?}/wpa_supplicant.conf" ]]; then
+ echo -e "\e[36m add wpa_supplicant file from backup\e[0m";
+ sudo rsync -xa --info=progress2 "${SRC_BACKUP:?}/wpa_supplicant.conf" "${DST_CUSTOM_ROOT:?}/etc/wpa_supplicant/"
+ fi
+ fi
+
+ ############################################################
+ if (echo "${FLAGS:?}" | grep -q history); then
+ echo -e "\e[36m add .bash_history file\e[0m";
+ cat << EOF | sudo tee "${DST_CUSTOM_ROOT:?}/home/pi/.bash_history" &>/dev/null
+sudo poweroff
+sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y --purge && sudo apt autoclean -y && sync && echo Done.
+sudo nano /etc/resolv.conf
+ip route
+sudo ip route del default dev eth0
+sudo reboot
+sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
+wpa_passphrase
+sudo iwlist wlan0 scan [essid ]
+sudo raspi-config
+EOF
+ sudo chown 1000:1000 "${DST_CUSTOM_ROOT:?}/home/pi/.bash_history";
+ fi
+
+ ############################################################
+ if (echo "${FLAGS:?}" | grep -q apt); then
+ ########################################################
+ if ! [[ -f "${DST_CUSTOM_ROOT:?}/etc/apt/apt.conf.d/01proxy" ]]; then
+ echo -e "\e[36m add apt proxy file\e[0m";
+ cat << EOF | sudo tee "${DST_CUSTOM_ROOT:?}/etc/apt/apt.conf.d/01proxy" &>/dev/null
+Acquire::http::Proxy "http://${IP_ETH0:?}:3142";
+EOF
+ fi
+ fi
+ fi
+ fi
+}
+
+
+########################################################################
+handle_rpi_pxe() {
+ local SN="${!2}"
+ if [[ "${SN:?}" == "--------" ]]; then
+ echo -e "\e[36m skipped: no proper serial number given.\e[0m";
+ return 1;
+ fi
+
+ if [[ $(("${KERNEL_VER:?}" < 413)) != 0 ]]; then
+ handle_rpi_pxe_classic "${1:?}" "${2:?}" "${3:?}";
+ # overlayfs is working, when you put a bindfs on top of overlayfs, to make exportfs happy
+ # note: this construction does NOT work reliably - data loss!
+ #handle_rpi_pxe_overlay "${1:?}" "${2:?}" "${3:?}";
+ else
+ # overlayFS is still not able to export via nfs
+ handle_rpi_pxe_classic "${1:?}" "${2:?}" "${3:?}";
+
+ # overlayfs is working, when you put a bindfs on top of overlayfs, to make exportfs happy
+ # note: this construction does NOT work reliably - data loss!
+ #handle_rpi_pxe_overlay "${1:?}" "${2:?}" "${3:?}";
+ fi
+}
+
+
+########################################################################
+sudo mkdir -p "${DST_ISO:?}";
+sudo mkdir -p "${DST_IMG:?}";
+sudo mkdir -p "${DST_TFTP_ETH0:?}";
+sudo mkdir -p "${DST_NFS_ETH0:?}";
+
+
+########################################################################
+if [[ -d "/var/www/html" ]]; then
+ [[ -d "/var/www/html/srv" ]] || sudo mkdir -p /var/www/html/srv
+ [[ -h "/var/www/html/srv${ISO:?}" ]] || sudo ln -s "${DST_ISO:?}" "/var/www/html/srv${ISO:?}";
+ [[ -h "/var/www/html/srv${IMG:?}" ]] || sudo ln -s "${DST_IMG:?}" "/var/www/html/srv${IMG:?}";
+ [[ -h "/var/www/html/srv${NFS_ETH0:?}" ]] || sudo ln -s "${DST_NFS_ETH0:?}" "/var/www/html/srv${NFS_ETH0:?}";
+fi
+
+
+########################################################################
+########################################################################
+. "${script_dir:?}/p2-include-handle"
+. "${script_dir:?}/c2-custom-handle"
+
+
+########################################################################
+handle_pxe;
+handle_ipxe;
+
+
+########################################################################
+if [[ -d "${SRC_ISO:?}" ]] && ! [[ "${SRC_ISO:?}" == "${DST_ISO:?}" ]]; then
+ echo -e "\e[32mbackup new iso images to usb-stick\e[0m";
+ sudo rsync -xa --info=progress2 "${DST_ISO:?}/"*.iso "${DST_ISO:?}/"*.url "${SRC_ISO:?}/" 2>/dev/null
+fi
+########################################################################
+if [[ -d "${SRC_IMG:?}" ]] && ! [[ "${SRC_IMG:?}" == "${DST_IMG:?}" ]]; then
+ echo -e "\e[32mbackup new images to usb-stick\e[0m";
+ sudo rsync -xa --info=progress2 "${DST_IMG:?}/"*.img "${DST_IMG:?}/"*.url "${SRC_IMG:?}/" 2>/dev/null
+fi
+########################################################################
+sync
+echo -e "\e[32mDone.\e[0m";
+#echo -e "\e[1;31mPlease reboot\e[0m";
diff --git a/patch-tails.sh b/patch-tails.sh
new file mode 100644
index 0000000..cb036fd
--- /dev/null
+++ b/patch-tails.sh
@@ -0,0 +1,180 @@
+#!/usr/bin/bash
+
+# ... break=premount
+# ... break=init
+# ... debug
+#
+# sudo unsquashfs -d /tmp/test -f /srv/nfs/tails-x64/live/filesystem.squashfs
+# $ ls /tmp/test/bin/live-*
+# $ ls -r /tmp/test/lib/live/*
+
+# 2024-02-27 for tails 6.0, renamed to all-net-blocklist.conf
+# 2024-02-27 for tails 6.0, updated path from /lib/modules/ to /usr/lib/modules/
+# 2023-09-11 skip network de-init on boot option "break=init" to keep network alive for debugging
+# 2021-11-07 /conf/net_drivers.tar.xz, /conf/conf.d/zzzz-hotfix-pxe, /etc/live/boot/zzzz-hotfix-pxe
+
+# requires:
+# squashfs-tools (unsquashfs)
+# initramfs-tools (cpio)
+# xz-utils (xz)
+
+# location, where to store temporary files
+TMP=/tmp/tails-net
+
+# full filename of the filesystem.squashfs from tails ISO
+SRC=/srv/nfs/tails-x64/live/filesystem.squashfs
+
+# full filename of the hotfix-pxe image
+DST=/srv/nfs/tails-x64-hotfix-pxe.cpio.xz
+
+
+if [[ -z "${TMP}" ]] || [[ -z "${SRC}" ]] || [[ -z "${DST}" ]]; then
+ echo "ERROR: undefined variable"
+ return -1
+fi
+
+if ! [[ -d "$(dirname ${TMP:?})" ]] && ! [[ -r "${SRC:?}" ]] && ! [[ -d "$(dirname ${DST:?})" ]]; then
+ echo "ERROR: wrong file or folder"
+ return -2
+fi
+
+
+# kernel version of tails
+KVER=$(basename $(unsquashfs -l "${SRC:?}" -e /usr/lib/modules/ | grep /usr/lib/modules/ | head -n 1))
+(( $? != 0 )) && return -4
+
+# test if kernel version is correct
+if [[ -n "${KVER}" ]]; then
+ echo "INFO: KVER='${KVER:?}'"
+else
+ echo "ERROR: unknown kernel version"
+ return -3
+fi
+
+do_modules() {
+# extract missing network kernel drivers modules from tails
+sudo unsquashfs \
+ -d "${TMP:?}" \
+ -f "${SRC:?}" \
+ -e "/usr/lib/modules/${KVER:?}/kernel/drivers/net/phy" \
+ -e "/usr/lib/modules/${KVER:?}/kernel/drivers/net/ethernet" \
+ ;
+(( $? != 0 )) && exit -4
+
+# compress missing network kernel drivers modules to file
+[[ -e "${TMP:?}/conf/" ]] || sudo mkdir -p "${TMP:?}/conf/"
+sudo tar -ravf "${TMP:?}/conf/net_drivers.tar.xz" -C "${TMP:?}" "usr/lib"
+sudo rm -rf "${TMP:?}/usr/lib"
+}
+
+
+do_patch_top() {
+# add hotfix for pxe boot to initrd image
+[[ -e "${TMP:?}/conf/conf.d/" ]] || sudo mkdir -p "${TMP:?}/conf/conf.d/"
+cat << EOF | sudo tee "${TMP:?}/conf/conf.d/zzzz-hotfix-pxe" &>/dev/null
+#!/usr/bin/sh
+
+patch_top()
+{
+ # check if we dealing with same kernel version
+ if [ "\$(uname -r)" != "${KVER:?}" ]; then
+ . /scripts/functions
+ log_failure_msg "wrong kernel version. '\$(uname -r)'!='${KVER:?}'"
+ panic "please visit: https://github.com/beta-tester/RPi-PXE-Server/issues/31"
+ fi
+
+ # comment out all blacklist entries
+ sed "s/^install/# install/g" -i /etc/modprobe.d/all-net-blocklist.conf
+
+ # replace wget script by busybox, for normal behavior
+ mv /usr/bin/wget /usr/bin/wget.bak
+ ln -sf /usr/bin/busybox /usr/bin/wget
+
+ # replace depmod, for normal behavior
+ mv /usr/sbin/depmod /usr/sbin/depmod.bak
+ ln -sf /usr/bin/kmod /usr/sbin/depmod
+
+ # excract the compressed drivers in place
+ tar -xf "/conf/net_drivers.tar.xz" -C /
+
+ # rebulid dependencies for added network kernel drivers modules
+ depmod -b /usr
+
+ # enqueue hot fix for patch_bottom
+ echo '/scripts/init-bottom/zzzz-hotfix-pxe' | tee -a /scripts/init-bottom/ORDER
+}
+
+patch_top
+EOF
+(( $? != 0 )) && return -4
+sudo chmod +x "${TMP:?}/conf/conf.d/zzzz-hotfix-pxe"
+(( $? != 0 )) && return -4
+}
+
+do_patch_bottom() {
+[[ -e "${TMP:?}/scripts/init-bottom/" ]] || sudo mkdir -p "${TMP:?}/scripts/init-bottom/"
+cat << EOF | sudo tee "${TMP:?}/scripts/init-bottom/zzzz-hotfix-pxe" &>/dev/null
+#!/usr/bin/sh
+
+patch_bottom()
+{
+ if ! [ -n "\$break" ]; then
+ # hotfix-pxe for issue with network initialisation in tails
+ local path_device
+ for path_device in /sys/class/net/*; do
+ local name_device
+ name_device=\$(basename \$path_device)
+ if [ "\$name_device" != "lo" ]; then
+ # set network devices down
+ ip link set \$name_device down
+
+ local path_module
+ path_module=\$(readlink \$path_device/device/driver/module)
+ if [ -n "\$path_module" ]; then
+ # remove used network drivers
+ local name_module
+ name_module=\$(basename \$path_module)
+ modprobe -r \$name_module
+ fi
+ fi
+ done
+ fi
+}
+
+patch_bottom
+EOF
+(( $? != 0 )) && return -4
+sudo chmod +x "${TMP:?}/scripts/init-bottom/zzzz-hotfix-pxe"
+(( $? != 0 )) && return -4
+}
+
+
+do_initrd() {
+# create an initrd image to overlay at boot time
+sudo rm "${DST:?}"
+cd "${TMP:?}"
+(( $? != 0 )) && return -4
+find . -type f -print0 | cpio --null --create --verbose --format=newc \
+ | xz --compress --extreme --check=crc32 | sudo tee "${DST:?}" &>/dev/null
+(( $? != 0 )) && return -4
+cd -
+}
+
+
+do_cleanup() {
+# clean up temporary files
+sudo rm -rf "${TMP:?}"
+(( $? != 0 )) && return -4
+}
+
+
+do_modules
+do_patch_top
+do_patch_bottom
+
+do_initrd
+
+do_cleanup
+
+
+echo done.
diff --git a/run.sh b/run.sh
new file mode 100644
index 0000000..569df5a
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+
+########################################################################
+script_dir=$(dirname "${BASH_SOURCE:?}")
+
+
+########################################################################
+FILE_LAST_RUN="${script_dir:?}/.run_last"
+RUN=
+PASS=
+
+########################################################################
+if [[ -f "${FILE_LAST_RUN}" ]]; then
+ LAST_RUN=$(<"${FILE_LAST_RUN:?}")
+
+ case "${LAST_RUN}" in
+ "install")
+ RUN="setup"
+ ;;
+ "setup")
+ RUN="update"
+ ;;
+ "update")
+ RUN="update"
+ ;;
+ *)
+ RUN="install"
+ ;;
+ esac
+else
+ RUN="install"
+fi
+
+
+########################################################################
+if ! [[ -z "${1}" ]]; then
+ RUN="${1:?}"
+fi
+
+
+########################################################################
+case "${RUN}" in
+ "install")
+ PASS="p0"
+ ;;
+ "setup")
+ PASS="p1"
+ ;;
+ "update")
+ PASS="p2"
+ ;;
+ *)
+ ;;
+esac
+
+
+########################################################################
+echo "Available actions:"
+echo
+echo "'install'"
+echo " This will run script 'p0-install'"
+echo " to install required packages"
+echo
+echo "'setup'"
+echo " This will run script 'p1-setup'"
+echo " to setup / configure services"
+echo
+echo "'update'"
+echo " This will run script 'p2-update'"
+echo " to download and mount images"
+echo " or unmount and remove images"
+echo " and update menue items"
+echo
+echo "Automatic next action will be '${RUN}'"
+echo
+read -p "Do you want to continue with: '${RUN}' [y|N]? " CHOICE
+echo
+case "${CHOICE}" in
+ Y|y) ;;
+ *) echo "To override automatic action, you can give the script 'run.sh' one of the above actions"
+ exit 1
+ ;;
+esac
+
+
+########################################################################
+. "${script_dir:?}/${PASS:?}-${RUN:?}"
+
+
+########################################################################
+echo "${RUN:?}" > "${FILE_LAST_RUN:?}"