Compare commits

..

5 Commits

Author SHA1 Message Date
root
df690d47cf .. 2023-04-18 15:38:46 +02:00
root
582077c7ec changes 2023-04-18 15:00:05 +02:00
root
a4b09dc07c Auf Branch main
Ihr Branch ist auf demselben Stand wie 'origin/main'.

 Zum Commit vorgemerkte Änderungen:
	geändert:       conf.d/service_10_main.conf.sh
	geändert:       conf.d/service_30_nfs.conf.sh
	geändert:       conf.d/service_40_smbd.conf.sh
	geändert:       settings.sh

 Unversionierte Dateien:
	resrc.d/default-minimal.txt
2023-04-18 14:59:12 +02:00
root
ce4f185331 . 2023-04-18 14:06:17 +02:00
root
7fd9ca7edd new approach 2023-04-18 13:41:50 +02:00
14 changed files with 535 additions and 36 deletions

View File

@@ -0,0 +1,220 @@
#!/bin/sh
. ./settings.sh
#
# Menue configuration
#
M_ENABLED=Yes
M_NAME="default"
if ! [ "$(echo $M_ENABLED | tr A-Z a-z)" = "yes" ]; then
exit 0
fi
echo "Menue $M_NAME is enabled..."
M_PAYLOAD="
rootprompt 0
path bios/
default bios/vesamenu.c32
#TIMEOUT 300
MENU TITLE Default Menu
MENU BACKGROUND splash.png
MENU ROWS 15
MENU TABMSGROW 20
MENU TIMEOUTROW 22
LABEL disk0
localboot 0
MENU LABEL Starte von lokaler Platte (Default)
label -
MENU LABEL Live-Systeme: --------------------------
MENU DISABLE
LABEL knx
MENU LABEL * Knoppix 9.1 Live, Grafisch, 32Bit
KERNEL free/knx/boot/isolinux/linux
APPEND nfsdir=${HOST_IP}:/srv/tftp/free/knx nodhcp lang=de ramdisk_size=100000 init=/sbin/init apm=power-off nomce loglevel=1 initrd=free/knx/boot/isolinux/miniroot.gz libata.force=noncq tz=europe/Berlin hpsa.hpsa_allow_any=1 BOOT_IMAGE=knoppix
MENU BEGIN
MENU LABEL * Weitere Optionen...
LABEL knx
MENU LABEL * Knoppix 9.1 Live, Textmodus, 32Bit
KERNEL free/knx/boot/isolinux/linux
APPEND nfsdir=${HOST_IP}:/srv/tftp/free/knx nodhcp lang=de ramdisk_size=100000 init=/sbin/init apm=power-off nomce loglevel=1 initrd=free/knx/boot/isolinux/miniroot.gz libata.force=noncq tz=Europe/Berlin hpsa.hpsa_allow_any=1 BOOT_IMAGE=knoppix 2
LABEL zurueck...
MENU EXIT
MENU END
label -
MENU LABEL Backup & Restore: ----------------------
MENU DISABLE
LABEL rescue
MENU LABEL * Rescuezilla Live
kernel free/rz/casper/vmlinuz
APPEND initrd=free/rz/casper/initrd.lz netboot=nfs root=/dev/nfs ramdisk_size=1500000 ip=dhcp nfsroot=${HOST_IP}:${D_TFTP}/free/rz/ boot=casper locale=de_DE keyboard-configuration/layoutcode=de bootkbd=de console-setup/layoutcode=de quiet
MENU BEGIN
MENU LABEL * Weitere Optionen...
LABEL rescue2
MENU LABEL * Rescuezilla Live Fail-Safe
kernel free/rz/casper/vmlinuz
APPEND initrd=free/rz/casper/initrd.lz netboot=nfs root=/dev/nfs ramdisk_size=1500000 ip=dhcp nfsroot=${HOST_IP}:${D_TFTP}/free/rz/ boot=casper locale=de_DE keyboard-configuration/layoutcode=de bootkbd=de console-setup/layoutcode=de xforcevesa nomodeset vga=791 quiet
LABEL cz
MENU LABEL * Clonezilla Live (Ramdisk)
KERNEL free/cz/live/vmlinuz
APPEND initrd=free/cz/live/initrd.img boot=live username=user union=overlay config components noswap edd=on nomodeset nodmraid locales=de_DE.UTF-8 keyboard-layouts=de-latin-1 ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=tftp://${HOST_IP}/free/cz/live/filesystem.squashfs quiet
LABEL acr18
MENU LABEL * Acronis True Image Home 2018
LINUX memdisk
INITRD non-free/acronis/acronis2018.iso
APPEND iso raw
LABEL acr14
MENU LABEL * Acronis True Image Home 2014
LINUX memdisk
INITRD non-free/acronis/acronis2014.iso
APPEND iso raw
LABEL acr11
MENU LABEL * Acronis True Image Home 2011
LINUX memdisk
INITRD non-free/acronis/acronis2011.iso
APPEND iso raw
LABEL acr10
MENU LABEL * Acronis True Image 2010
LINUX memdisk
INITRD non-free/acronis/acronis2010.iso
APPEND iso raw
LABEL acr09
MENU LABEL * Acronis True Image 2009
LINUX memdisk
INITRD non-free/acronis/acronis2009.iso
APPEND iso raw
LABEL zurueck...
MENU EXIT
MENU END
label -
MENU LABEL Installer: ------------------------------
MENU DISABLE
MENU BEGIN
MENU LABEL * Linux Installer...
LABEL deb12
MENU LABEL * Debian 12 Installer 64Bit Textmodus
CONFIG free/deb-bookworm/debian-installer/amd64/pxelinux.cfg/default
APPEND free/deb-bookworm/
LABEL deb12
MENU LABEL * Debian 12 Installer 32Bit Textmodus
CONFIG free/deb-bookworm/debian-installer/i386/pxelinux.cfg/default
APPEND free/deb-bookworm/
LABEL deb11
MENU LABEL * Debian 11 Installer 64Bit Textmodus
CONFIG free/deb-bullseye/debian-installer/amd64/pxelinux.cfg/default
APPEND free/deb-bullseye/
LABEL deb11
MENU LABEL * Debian 11 Installer 32Bit Textmodus
CONFIG free/deb-bullseye/debian-installer/i386/pxelinux.cfg/default
APPEND free/deb-bullseye/
LABEL zurueck...
MENU EXIT
MENU END
MENU BEGIN
MENU LABEL * Windows Installer...
LABEL win10
MENU LABEL * Windows 10
KERNEL memdisk
INITRD non-free/windows/winpe.iso
APPEND iso raw
LABEL win10
MENU LABEL * Windows 10 iPXE Test
KERNEL ipxe.lkrn
APPEND dhcp && chain non-free/wimboot.ipxe
LABEL zurueck...
MENU EXIT
MENU END
label -
MENU LABEL Boot- & System-Tools: --------------------
MENU DISABLE
LABEL hdt
MENU LABEL * Hardware Erkennung
COM32 bios/hdt.c32
LABEL memtestpl
MENU LABEL * Memtest86+
kernel free/memtest86+
MENU BEGIN
MENU LABEL * Weitere Optionen...
label sbm
MENU LABEL * Smart Boot Manager
kernel memdisk
append initrd=free/sbm.imz
LABEL plop
MENU LABEL * PloP Boot Manager
kernel free/plop.exe
LABEL ipxe
MENU LABEL * iPXE Shell
KERNEL ipxe.lkrn dhcp && shell
LABEL memtest
MENU LABEL * Memtest86
kernel free/memtest86
LABEL fdos
MENU LABEL * FreeDOS Bootdisk
KERNEL memdisk
APPEND initrd=free/FD13BOOT.img
label win98
MENU LABEL * Windows 98 Bootdisk (DOS 7)
kernel memdisk
append initrd=non-free/win98.img
label ether
MENU LABEL * Etherboot
kernel memdisk
append initrd=free/ether.img
LABEL zurueck...
MENU EXIT
MENU END
"
case $1 in
build)
echo $M_PAYLOAD > ${D_TFTP}/pxelinux.cfg/default
;;
esac

View File

48
conf.d/service_10_main.conf.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/sh
. ./settings.sh
#
# Main Service
#
S_ENABLED=YES
S_NAME="none"
S_PACKAGES="git sudo p7zip p7zip-full ipxe pxelinux syslinux syslinux-common"
# handle services
fservice $S_ENABLED $1 $S_NAME "$S_PACKAGES"
case $1 in
init)
# create directories
mkdir -p ${D_TFTP}
mkdir -p ${D_TFTP}/pxelinux.cfg
# copy Files some files:
cp -a /usr/lib/syslinux/modules/bios ${D_TFTP}/
cp -a ${D_RESRC}/default-minimal.txt ${D_TFTP}/pxelinux.cfg/default
# Link needed Files from installed Debian Packages to the TFTP-Root:
ln /usr/lib/PXELINUX/pxelinux.0 ${D_TFTP}/
ln /boot/ipxe.lkrn ${D_TFTP}/ipxe
ln /usr/lib/syslinux/memdisk ${D_TFTP}/
ln ${D_TFTP}/bios/ldlinux.c32 ${D_TFTP}/
ln ${D_TFTP}/pxelinux.cfg/default ${D_TFTP}/default -s
# download needed files:
wget -O ${D_TFTP}/wimboot "https://github.com/ipxe/wimboot/releases/latest/download/wimboot"
# set file access
chown ${USERID}:${GROUPID} . -R
chmod a+rw . -R
chown ${USERID}:${GROUPID} ${D_TFTP} -R
chmod a+rwx ${D_TFTP} -R
;;
esac

21
conf.d/service_20_tftp.conf.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
. ./settings.sh
#
# Service configuration
#
S_ENABLED=YES
S_NAME="tftpd-hpa"
S_PACKAGES="tftpd-hpa"
fservice $S_ENABLED $1 $S_NAME $S_PACKAGES
case $1 in
init)
;;
esac

23
conf.d/service_30_nfs.conf.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
. ./settings.sh
#
# Service configuration
#
S_ENABLED=no
S_NAME="nfs-kernel-server"
S_PACKAGES="nfs-kernel-server nfs-common"
fservice $S_ENABLED $1 $S_NAME $S_PACKAGES
case $1 in
init)
echo " create /etc/exports..."
cat ${D_ROOTDIR}/resrc.d/service_nfs_exports.txt | sed "s#__D_TFTP__#$D_TFTP#g" > /etc/exports
;;
esac

23
conf.d/service_40_smbd.conf.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
. ./settings.sh
#
# Service configuration
#
S_ENABLED=no
S_NAME="smbd"
S_PACKAGES="samba"
fservice $S_ENABLED $1 $S_NAME $S_PACKAGES
case $1 in
init)
echo " create smb.conf ..."
cat ${D_ROOTDIR}/resrc.d/service_smb.conf.txt | sed "s#__D_TFTP__#$D_TFTP#g" > /etc/samba/smb.conf
;;
esac

71
main.sh Normal file → Executable file
View File

@@ -0,0 +1,71 @@
#!/bin/sh
. ./settings.sh
case $1 in
#
# services
#
services)
# find services:
SLIST=$(ls ./conf.d/service_*.conf.sh )
# process command
case $2 in
init)
echo "--------------------------------------------------"
echo "service init..."
echo "--------------------------------------------------"
for ITEM in ${SLIST};
do
$ITEM init
done
;;
start)
echo "--------------------------------------------------"
echo "service start..."
echo "--------------------------------------------------"
for ITEM in ${SLIST};
do
$ITEM start
done
;;
stop)
echo "--------------------------------------------------"
echo "service stop..."
echo "--------------------------------------------------"
for ITEM in ${SLIST};
do
$ITEM stop
done
;;
restart)
echo "--------------------------------------------------"
echo "service restart..."
echo "--------------------------------------------------"
for ITEM in ${SLIST};
do
$ITEM restart
done
;;
esac
;;
#
# menues
#
menues)
;;
#
# plugins
#
plugins)
;;
*)
echo "Usage: $0 services [init|start|stop|restart]"
echo " $0 menues [init]"
echo " $0 plugins [init|build|download]"
;;
esac

View File

@@ -1,19 +0,0 @@
#!/bin/sh
# source global variables
. ../../settings.sh
#
# Main Settings for this Plugin
#
P_NAME=Default pxelinux Menua
P_TYPE=menue
M_PATH=bios
M_TITLE=Default Boot Menue
M_BACKGROUND=splash.png

View File

@@ -1,13 +0,0 @@
#
# Menue Header
#
rootprompt 0
PATH __M_PATH__
default __M_PATH__/vesamenu.c32
TIMEOUT 300
MENU TITLE __M_TITLE__
MENU BACKGROUND __M_BACKGROUND__
MENU ROWS 15
MENU TABMSGROW 20
MENU TIMEOUTROW 22

View File

@@ -0,0 +1,25 @@
rootprompt 0
path bios
default bios/vesamenu.c32
#TIMEOUT 300
MENU TITLE Minimal PXE Bootmenue
LABEL disk0
localboot 0
MENU LABEL Boot from first Harddisk
LABEL -
MENU LABEL --------------------------
LABEL ipxe
MENU LABEL * iPXE Shell
KERNEL ipxe dhcp && shell
LABEL demo
MENU LABEL * iPXE Demonstration
KERNEL ipxe dhcp && chain http://boot.ipxe.org/demo/boot.php
LABEL fdos
MENU LABEL * iPXE FreeDOS over HTTP and Internet
KERNEL ipxe dhcp && sanboot http://boot.ipxe.org/freedos/fdfullcd.iso

View File

@@ -0,0 +1,11 @@
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
__D_TFTP__ *(ro,nohide,no_root_squash,no_subtree_check,insecure)

View File

@@ -0,0 +1,19 @@
[global]
workgroup = PXE
map to guest = bad user
usershare allow guests = yes
[tftp]
browsable = true
read only = false
guest ok = yes
force user = root
path = __D_TFTP__
[rootdir]
browsable = true
read only = false
guest ok = yes
force user = root
path = /root

View File

@@ -9,12 +9,60 @@ D_TFTP=/srv/tftp
# Full path of this project:
D_ROOTDIR=/root/pxe-bootserver
D_RESRC=${D_ROOTDIR}/resrc.d
# the ip and FQDN for this server
HOST_IP=192.168.75.3
HOST_FQDN=tftp.ostrach.tld
# directories
D_MENUES=${D_ROOTDIR}/menues
D_SERVICES=${D_ROOTDIR}/services
D_PLUGINS=${D_ROOTDIR}/plugins
#
# Functions
#
fservice (){
# $1 is enabled yes/no
# $2 is the command
# $3 is the program name
# $4 is a list of packages
if [ "$1" = "yes" ] || [ "$1" = "YES" ]; then
echo "$3 is enabled:"
case $2 in
# INIT
# Install needed Debian Packages:
init)
echo " installing: $4"
apt install -y $4
;;
start)
if ! [ "$3" = "none" ]; then
echo " starting $3 ..."
systemctl start $3
fi
;;
stop)
if ! [ "$3" = "none" ]; then
echo " stopping $3 ..."
systemctl stop $3
fi
;;
restart)
if ! [ "$3" = "none" ]; then
echo " restarting $3 ..."
systemctl restart $3
fi
;;
esac
else
echo "$3 is disabled. "
if ! [ "$3" = "none" ]; then
systemctl stop $3
fi
fi
}

22
todo.md
View File

@@ -70,6 +70,7 @@
* create menu sections: (maybe a kind of hook for plugin-types?)
* put plugins into sections
* types: livesystem, rescue, tools, installer, etc.
* priority: sort stanzas
### ./plugins
* plugin contains all needed files
@@ -82,7 +83,28 @@
* depends: nfs, samba, etc.
* plugin specific variables and settings
# Central config file approach
a main script with a conf.d/ directory. config files are sorted by numbers
and special names: menu_20_pxelinux.conf, service_10_nfs.conf, plugin_30_knoppix.conf
each .conf file contains the needed variables
the main script can select files by name (menu,service,plugin) and sort them by number
for the desired lineup.
menu* files build the menu and processes all plugin* files to fill the menu
### File structure
* main.sh
* ./conf.d/
* menu_10_default.conf
* service_10_tftp.conf
* plugin_10_knoppix.conf
* plugin_20_rescuezilla.conf
### menu*.conf
* find all enabled plugins and read them in a sorted array