# To Do...

# Modular Approach

## Folder Structure

* main.sh
  * ./services
    * main
    * tftpd-hpa
      * plugin.sh
      * config.sh
      * ./templates
      * ./build
    * nfs
    * samba
    * iscsi / tgt
    * lighthttpd
  * ./menues
    * ./pxelinux
      * plugin.sh
      * config.sh
      * ./templates
      * ./build
    * ./ipxe
    * ./custom-made
  * ./plugins
    * Knoppix
      * plugin.sh
      * config.sh
      * ./templates
      * ./build
      * ./resources
      * ./downloads
      * ./temp
    * Rescuezilla
    * FreeDOS
    * Clonezilla

## Structure

### main.sh
* drives all actions:
  * init - bootstrap the bare minimum: debian packages, config files, etc.
  * build - build all enabled plugins: trigger downloads, file processing
  * build-all - build even disabled plugins
  * start / stop / restart - handle services
* points all plugins to source global variables from ./services/main (could be changed!)
* provides global variables:
  * IP / Hostname

### ./services
  * make services modular
  * plugin.sh
    * manages all actions: downloads, file processing, template parsing
  * config.sh
    * holds plugin specific variables
  * ./main
    * configure settings:
    * variables
      * tftp root dir 
      * hook: pxelinux or ipxe menus? so plugins could provide matching menue entries
  * ./tftp-hpa and other services:
    * templates for config files

### ./menues
  * make modular menues
  * branding
  * which menue to use: menu.c32 or vesamenu.c32, even use iPXE menues (may be broken by plugins)
  * create menu sections: (maybe a kind of hook for plugin-types?)
    * put plugins into sections
    * types: livesystem, rescue, tools, installer, etc.

### ./plugins
  * plugin contains all needed files
  * plugin.sh
    * manages all actions: downloads, file processing, template parsing
  * config.sh
    * plugin name
    * enabled: y/n
    * type: rescue, os, installer (must be one of the menue hooks)
    * depends: nfs, samba, etc.
    * plugin specific variables and settings





* Modular pxelinux menu:
 * split menu in parts: Knoppix, Rescuezilla, Acronis, etc.
 * use settings.sh as configuration file, e.g. MENU_KNOPPIX=YES or MENU_NON-FREE=NO
 * create template files in ./resources: menu-knoppix.cfg, menu-rescuezilla.cfg
 * use INCLUDE command if possible https://wiki.syslinux.org/wiki/index.php?title=Menu#INCLUDE
 * read settings.sh and parse templates to fill in variables


* iSCSI Target:
  * apt install tgt
    * zless /usr/share/doc/tgt/README.iscsi.gz
    * tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2020-11.tld.ostrach:target1
    * tgtadm --lld iscsi --op show --mode target
    * tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/hdc1
    * tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

* https://www.server-world.info/en/note?os=Debian_11&p=iscsi&f=2
* http://etherboot.org/wiki/sanboot
* https://ipxe.org/howto/winpe
 
1. install tgt
2. parse settings.sh and create tgt config files to:
3. a Windows 10 DVD target (.iso under /srv/tftp/non-free/windows10.iso)

Remeber: Check if a iSCSI Tape-Target could be used to trick a Tape Backup Software to use HardDisks as Tapes
