#!ipxe

##	gesetzte Variablen
#	set arch x86_64 || set arch i386
#	set keymap de
#	set ipxe-ver ${builtin/version}
#	set srv-name raspi4
##	Netzwerk
#	set gw-ip ${net0/gateway}
#	set mask ${net0/netmask}
#	set my-ip ${net0/ip}
#	set nxsrv-ip ${next-server}
#	set srv-ip ${dhcp-server}

#	set nfs-root /data/srv/tftp/
#	set nfs-url nfs://${srv-ip}${nfs-root}
#	set tftp-root /tftp/
#	set tftp-url http://${srv-ip}${tftp-root}
#	set ipxe-menu /tftp/menu/
#	set ipxe-url http://${srv-ip}${ipxe-menu}
#	set pxecfg-dir pxelinux.cfg/

#	isset ${server-ip} || set server-ip www.adriankoshka.xyz
goto start

:start
menu System Tools
item --gap --             ------------------------- Choose a option ------------------------------
item --key c chntpw	Start (C)hange NT Password
item --key h hdt	Start HDT
item pmagic	Start Parted Magic auto detect cpu
item pmagic32	Start Parted Magic 32
item pmagic64	Start Parted Magic 64
item --key r sysrescd	Enter System (R)escue CD area
item --gap --             ---------------------------- Options -----------------------------------
item --key g goback	(G)o Back to previous menu
item --key s shell	(S)hell
item --key p pwroff	(P)ower off
item --key r reboot	(R)eboot
choose --default pmagic target && goto ${target}
#choose version && goto ${version} || goto start
#	choose --default hdt --timeout 20000 target && goto ${target} || goto start

:pwroff
poweroff
:reboot
reboot
:shell
echo Type 'exit' to get the back to the menu
shell
goto start

:failed
	echo Ein Fehler ist aufgetreten!
	prompt
goto start

:goback
	chain ${ipxe-menu}menu.ipxe

:info
	chain ${ipxe-url}info.ipxe

:chntpw
	set chntpw-url ${tftp-url}chntpw/2014/
	kernel ${chntpw-url}vmlinuz
	initrd ${chntpw-url}initrd.cgz
	initrd ${chntpw-url}scsi.cgz
	imgargs vmlinuz rw vga=1 loglevel=1
	boot || imgfree

:hdt
# http://hdt-project.org/
	echo Booting ${cname}Hardware Detection Tool${reset}
#	sanboot --no-describe --drive 0x00 
prompt
	kernel ${tftp-url}memdisk
	initrd ${tftp-url}imgs/hdt-0.5.2.img || goto failed
#	boot || imgfree
goto start

:fdos
	kernel ${tftp-url}memdisk
	initrd ${tftp-url}fdos/fdubcd.img
#.gz
	boot || imgfree

:pmagic
	iseq ${arch} i386 && goto pmagic32 ||
	iseq ${arch} x86_64 && goto pmagic64 ||
goto start

:pmagic32
#	set pmagic-path ${nfs-url}pmagic/20130810/
	set pmagic-path ${tftp-url}pmagic/20130810/
	kernel ${pmagic-path}bzImage
	initrd ${pmagic-path}initrd.img
	imgargs bzImage edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=771 loglevel=9 max_loop=256 keymap=de-latin1
	boot || imgfree
goto start

:pmagic64
#	set pmagic-path ${nfs-url}pmagic/20130810/
	set pmagic-path ${tftp-url}pmagic/20130810/
	kernel ${pmagic-path}bzImage64
	initrd ${pmagic-path}initrd.img
	imgargs bzImage64 edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=771 loglevel=9 max_loop=256 keymap=de-latin1
	boot || imgfree
goto start

:sysrescd
	chain ${ipxe-menu}sysrescd.ipxe
#	boot || imgfree
goto start
