#!/bin/bash

sudo clear
cd
echo "PXE SERVER SETUP"

#CONFIG
echo "SET SERVERS INTERFACE & IP SETTINGS:"
echo "INTERFACE:"
read iface; iface=${iface:-enp2s0}
echo "SERVER IP ADDRESS:"
read ip; ip=${ip:-10.42.0.1}
echo "ROUTERS:"
read routers; routers=${routers:-10.42.0.1}
echo "SUBNET:"
read subnet; subnet=${subnet:-10.42.0.0}
echo "NETMASK:"
read netmask; netmask=${netmask:-255.255.255.0}
echo "BROADCAST ADDRESS"
read bcast; bcast=${bcast:-10.42.0.255}
echo "DNS SERVERS:"
read dns; dns=${dns:-10.42.0.1}
echo "RANGE START:"
read rstart; rstart=${rstart:-10.42.0.20}
echo "RANGE END:"
read rend; rend=${rend:-10.42.0.80}

#INSTALL
sudo systemctl disable lighttpd
sudo systemctl stop lighttpd
sudo systemctl stop portsentry
sudo apt update
sudo apt install -y isc-dhcp-server tftpd-hpa nfs-kernel-server apache2 git liblzma-dev syslinux isolinux mkisofs mtools perl gcc binutils make

##DHCP
sudo echo "
ddns-update-style none;

option space ipxe;
option ipxe-encap-opts code 175 = encapsulate ipxe;
option ipxe.priority code 1 = signed integer 8;
option ipxe.keep-san code 8 = unsigned integer 8;
option ipxe.skip-san-boot code 9 = unsigned integer 8;
option ipxe.syslogs code 85 = string;
option ipxe.cert code 91 = string;
option ipxe.privkey code 92 = string;
option ipxe.crosscert code 93 = string;
option ipxe.no-pxedhcp code 176 = unsigned integer 8;
option ipxe.bus-id code 177 = string;
option ipxe.san-filename code 188 = string;
option ipxe.bios-drive code 189 = unsigned integer 8;
option ipxe.username code 190 = string;
option ipxe.password code 191 = string;
option ipxe.reverse-username code 192 = string;
option ipxe.reverse-password code 193 = string;
option ipxe.version code 235 = string;
option iscsi-initiator-iqn code 203 = string;
# Feature indicators
option ipxe.pxeext code 16 = unsigned integer 8;
option ipxe.iscsi code 17 = unsigned integer 8;
option ipxe.aoe code 18 = unsigned integer 8;
option ipxe.http code 19 = unsigned integer 8;
option ipxe.https code 20 = unsigned integer 8;
option ipxe.tftp code 21 = unsigned integer 8;
option ipxe.ftp code 22 = unsigned integer 8;
option ipxe.dns code 23 = unsigned integer 8;
option ipxe.bzimage code 24 = unsigned integer 8;
option ipxe.multiboot code 25 = unsigned integer 8;
option ipxe.slam code 26 = unsigned integer 8;
option ipxe.srp code 27 = unsigned integer 8;
option ipxe.nbi code 32 = unsigned integer 8;
option ipxe.pxe code 33 = unsigned integer 8;
option ipxe.elf code 34 = unsigned integer 8;
option ipxe.comboot code 35 = unsigned integer 8;
option ipxe.efi code 36 = unsigned integer 8;
option ipxe.fcoe code 37 = unsigned integer 8;
option ipxe.vlan code 38 = unsigned integer 8;
option ipxe.menu code 39 = unsigned integer 8;
option ipxe.sdi code 40 = unsigned integer 8;
option ipxe.nfs code 41 = unsigned integer 8;
option ipxe.no-pxedhcp 1;option space ipxe;
option ipxe-encap-opts code 175 = encapsulate ipxe;
option ipxe.priority code 1 = signed integer 8;
option ipxe.keep-san code 8 = unsigned integer 8;
option ipxe.skip-san-boot code 9 = unsigned integer 8;
option ipxe.syslogs code 85 = string;
option ipxe.cert code 91 = string;
option ipxe.privkey code 92 = string;
option ipxe.crosscert code 93 = string;
option ipxe.no-pxedhcp code 176 = unsigned integer 8;
option ipxe.bus-id code 177 = string;
option ipxe.san-filename code 188 = string;
option ipxe.bios-drive code 189 = unsigned integer 8;
option ipxe.username code 190 = string;
option ipxe.password code 191 = string;
option ipxe.reverse-username code 192 = string;
option ipxe.reverse-password code 193 = string;
option ipxe.version code 235 = string;
option iscsi-initiator-iqn code 203 = string;
# Feature indicators
option ipxe.pxeext code 16 = unsigned integer 8;
option ipxe.iscsi code 17 = unsigned integer 8;
option ipxe.aoe code 18 = unsigned integer 8;
option ipxe.http code 19 = unsigned integer 8;
option ipxe.https code 20 = unsigned integer 8;
option ipxe.tftp code 21 = unsigned integer 8;
option ipxe.ftp code 22 = unsigned integer 8;
option ipxe.dns code 23 = unsigned integer 8;
option ipxe.bzimage code 24 = unsigned integer 8;
option ipxe.multiboot code 25 = unsigned integer 8;
option ipxe.slam code 26 = unsigned integer 8;
option ipxe.srp code 27 = unsigned integer 8;
option ipxe.nbi code 32 = unsigned integer 8;
option ipxe.pxe code 33 = unsigned integer 8;
option ipxe.elf code 34 = unsigned integer 8;
option ipxe.comboot code 35 = unsigned integer 8;
option ipxe.efi code 36 = unsigned integer 8;
option ipxe.fcoe code 37 = unsigned integer 8;
option ipxe.vlan code 38 = unsigned integer 8;
option ipxe.menu code 39 = unsigned integer 8;
option ipxe.sdi code 40 = unsigned integer 8;
option ipxe.nfs code 41 = unsigned integer 8;
option ipxe.no-pxedhcp 1;

subnet $subnet netmask $netmask {
 range $rstart $rend;
 option domain-name-servers $dns;
 #option domain-name example.org;
 option routers $routers;
 option broadcast-address $bcast;
 default-lease-time 600; max-lease-time 7200;
 next-server $ip;
 #filename ipxe.efi;
}

option client-architecture code 93 = unsigned integer 16;
if exists user-class and option user-class = "\"iPXE\"" {
    filename "\"menu.ipxe\"";
} elsif option client-architecture = 00:00 {
    filename "\"undionly.kpxe\"";
} else {
    filename "\"ipxe.efi\"";
}
" > /etc/dhcp/dhcpd.conf

sudo echo "
INTERFACESv4="\"$iface\""
INTERFACESv6="\"\""
" > /etc/default/isc-dhcp-server

##TFTP
sudo echo "
TFTP_USERNAME="\"tftp\""
TFTP_DIRECTORY="\"/srv/tftp\""
TFTP_ADDRESS="\":69\""
TFTP_OPTIONS="\"--secure\""
" > /etc/default/tftpd-hpa

##NFS
sudo mkdir /srv/nfs
sudo echo "/srv/nfs $ip/$netmask(rw,sync,no_root_squash,no_subtree_check)" > /etc/exports
sudo exportfs -a -r -v
sudo showmount -e

#UFW
sudo ufw allow 22 #SSH
sudo ufw allow 53 #DNS
sudo ufw allow 67 #PXE
sudo ufw allow 68 #PXE
sudo ufw allow 69 #TFTP
sudo ufw allow 80 #HTTP
sudo ufw allow 443 #HTTPS
sudo ufw allow 2049 #NFS
sudo ufw allow 111 #NFS/RPC
sudo ufw allow 5353 #UPNP
sudo ufw reload

#iPXE
#sudo rm -rf /ipxe
git clone https://github.com/ipxe/ipxe.git --progress
cd ipxe/src
git pull
echo "
#define	NET_PROTO_IPV4		/* IPv4 protocol */
#define NET_PROTO_IPV6	    /* IPv6 protocol */
#define	NET_PROTO_FCOE		/* Fibre Channel over Ethernet protocol */
#define	NET_PROTO_STP		/* Spanning Tree protocol */
#define	NET_PROTO_LACP		/* Link Aggregation control protocol */
#define	NET_PROTO_EAPOL		/* EAP over LAN protocol */
#define NET_PROTO_LLDP	    /* Link Layer Discovery protocol */
#define	DOWNLOAD_PROTO_TFTP	/* Trivial File Transfer Protocol */
#define	DOWNLOAD_PROTO_HTTP	/* Hypertext Transfer Protocol */
#define	DOWNLOAD_PROTO_HTTPS	/* Secure Hypertext Transfer Protocol */
#define	DOWNLOAD_PROTO_FTP	/* File Transfer Protocol */
#define	DOWNLOAD_PROTO_SLAM	/* Scalable Local Area Multicast */
#define	DOWNLOAD_PROTO_NFS	/* Network File System Protocol */
#define DOWNLOAD_PROTO_FILE	/* Local filesystem access */
#define	SANBOOT_PROTO_ISCSI	/* iSCSI protocol */
#define	SANBOOT_PROTO_AOE	/* AoE protocol */
#define	SANBOOT_PROTO_IB_SRP	/* Infiniband SCSI RDMA protocol */
#define	SANBOOT_PROTO_FCP	/* Fibre Channel protocol */
#define	SANBOOT_PROTO_HTTP	/* HTTP SAN protocol */
//#define IMAGE_NBI	    /* NBI image support */
//#define IMAGE_ELF		/* ELF image support */
//#define IMAGE_MULTIBOOT		/* MultiBoot image support */
#define IMAGE_PXE		/* PXE image support */
#define IMAGE_SCRIPT		/* iPXE script image support */
#define IMAGE_LKRN		/* Linux kernel image support */
//#define IMAGE_COMBOOT	/* SYSLINUX COMBOOT image support */
//#define IMAGE_EFI		/* EFI image support */
//#define IMAGE_SDI		/* SDI image support */
#define IMAGE_PNM		/* PNM image support */
#define IMAGE_PNG		/* PNG image support */
#define IMAGE_DER		/* DER image support */
#define IMAGE_PEM		/* PEM image support */
#define IMAGE_EFISIG		/* EFI signature list image support */
#define IMAGE_ZLIB		/* ZLIB image support */
#define IMAGE_GZIP		/* GZIP image support */
#define IMAGE_UCODE     /* Microcode update image support */
#define AUTOBOOT_CMD		/* Automatic booting */
#define NVO_CMD			/* Non-volatile option storage commands */
#define CONFIG_CMD		/* Option configuration console */
#define IFMGMT_CMD		/* Interface management commands */
#define IWMGMT_CMD		/* Wireless interface management commands */
#define IBMGMT_CMD		/* Infiniband management commands */
#define FCMGMT_CMD		/* Fibre Channel management commands */
#define ROUTE_CMD		/* Routing table management commands */
#define IMAGE_CMD		/* Image management commands */
#define DHCP_CMD		/* DHCP management commands */
#define SANBOOT_CMD		/* SAN boot commands */
#define MENU_CMD		/* Menu commands */
#define FORM_CMD		/* Form commands */
#define LOGIN_CMD		/* Login command */
#define SYNC_CMD		/* Sync command */
#define SHELL_CMD		/* Shell command */
#define NSLOOKUP_CMD		/* DNS resolving command */
#define TIME_CMD		/* Time commands */
#define DIGEST_CMD		/* Image crypto digest commands */
#define LOTEST_CMD		/* Loopback testing commands */
#define VLAN_CMD		/* VLAN commands */
#define PXE_CMD		/* PXE commands */
#define REBOOT_CMD		/* Reboot command */
#define POWEROFF_CMD		/* Power off command */
#define IMAGE_TRUST_CMD	/* Image trust management commands */
#define IMAGE_CRYPT_CMD	/* Image encryption management commands */
#define PCI_CMD		/* PCI commands */
#define PARAM_CMD		/* Request parameter commands */
#define NEIGHBOUR_CMD		/* Neighbour management commands */
#define PING_CMD		/* Ping command */
#define CONSOLE_CMD		/* Console command */
#define IPSTAT_CMD		/* IP statistics commands */
#define PROFSTAT_CMD		/* Profiling commands */
#define NTP_CMD		/* NTP commands */
#define CERT_CMD		/* Certificate management commands */
#define IMAGE_MEM_CMD		/* Read memory command */
#define IMAGE_ARCHIVE_CMD	/* Archive image management commands */
#define SHIM_CMD		/* EFI shim command (or dummy command) */
#define USB_CMD		/* USB commands */
#define FDT_CMD		/* Flattened Device Tree commands */
" > ./config/local/general.h

#make bin/ipxe.pxe
#make bin/ipxe.iso
#make bin/undionly.kpxe

echo "
#define	NET_PROTO_IPV4		/* IPv4 protocol */
#define NET_PROTO_IPV6	    /* IPv6 protocol */
#define	NET_PROTO_FCOE		/* Fibre Channel over Ethernet protocol */
#define	NET_PROTO_STP		/* Spanning Tree protocol */
#define	NET_PROTO_LACP		/* Link Aggregation control protocol */
#define	NET_PROTO_EAPOL		/* EAP over LAN protocol */
#define NET_PROTO_LLDP	    /* Link Layer Discovery protocol */
#define	DOWNLOAD_PROTO_TFTP	/* Trivial File Transfer Protocol */
#define	DOWNLOAD_PROTO_HTTP	/* Hypertext Transfer Protocol */
#define	DOWNLOAD_PROTO_HTTPS	/* Secure Hypertext Transfer Protocol */
#define	DOWNLOAD_PROTO_FTP	/* File Transfer Protocol */
#define	DOWNLOAD_PROTO_SLAM	/* Scalable Local Area Multicast */
#define	DOWNLOAD_PROTO_NFS	/* Network File System Protocol */
#define DOWNLOAD_PROTO_FILE	/* Local filesystem access */
#define	SANBOOT_PROTO_ISCSI	/* iSCSI protocol */
#define	SANBOOT_PROTO_AOE	/* AoE protocol */
#define	SANBOOT_PROTO_IB_SRP	/* Infiniband SCSI RDMA protocol */
#define	SANBOOT_PROTO_FCP	/* Fibre Channel protocol */
#define	SANBOOT_PROTO_HTTP	/* HTTP SAN protocol */
//#define IMAGE_NBI	    /* NBI image support */
//#define IMAGE_ELF		/* ELF image support */
//#define IMAGE_MULTIBOOT		/* MultiBoot image support */
//#define IMAGE_PXE		/* PXE image support */
#define IMAGE_SCRIPT		/* iPXE script image support */
#define IMAGE_LKRN		/* Linux kernel image support */
//#define IMAGE_COMBOOT	/* SYSLINUX COMBOOT image support */
#define IMAGE_EFI		/* EFI image support */
//#define IMAGE_SDI		/* SDI image support */
#define IMAGE_PNM		/* PNM image support */
#define IMAGE_PNG		/* PNG image support */
#define IMAGE_DER		/* DER image support */
#define IMAGE_PEM		/* PEM image support */
#define IMAGE_EFISIG		/* EFI signature list image support */
#define IMAGE_ZLIB		/* ZLIB image support */
#define IMAGE_GZIP		/* GZIP image support */
#define IMAGE_UCODE     /* Microcode update image support */
#define AUTOBOOT_CMD		/* Automatic booting */
#define NVO_CMD			/* Non-volatile option storage commands */
#define CONFIG_CMD		/* Option configuration console */
#define IFMGMT_CMD		/* Interface management commands */
#define IWMGMT_CMD		/* Wireless interface management commands */
#define IBMGMT_CMD		/* Infiniband management commands */
#define FCMGMT_CMD		/* Fibre Channel management commands */
#define ROUTE_CMD		/* Routing table management commands */
#define IMAGE_CMD		/* Image management commands */
#define DHCP_CMD		/* DHCP management commands */
#define SANBOOT_CMD		/* SAN boot commands */
#define MENU_CMD		/* Menu commands */
#define FORM_CMD		/* Form commands */
#define LOGIN_CMD		/* Login command */
#define SYNC_CMD		/* Sync command */
#define SHELL_CMD		/* Shell command */
#define NSLOOKUP_CMD		/* DNS resolving command */
#define TIME_CMD		/* Time commands */
#define DIGEST_CMD		/* Image crypto digest commands */
#define LOTEST_CMD		/* Loopback testing commands */
#define VLAN_CMD		/* VLAN commands */
//#define PXE_CMD		/* PXE commands */
#define REBOOT_CMD		/* Reboot command */
#define POWEROFF_CMD		/* Power off command */
#define IMAGE_TRUST_CMD	/* Image trust management commands */
#define IMAGE_CRYPT_CMD	/* Image encryption management commands */
#define PCI_CMD		/* PCI commands */
#define PARAM_CMD		/* Request parameter commands */
#define NEIGHBOUR_CMD		/* Neighbour management commands */
#define PING_CMD		/* Ping command */
#define CONSOLE_CMD		/* Console command */
#define IPSTAT_CMD		/* IP statistics commands */
#define PROFSTAT_CMD		/* Profiling commands */
#define NTP_CMD		/* NTP commands */
#define CERT_CMD		/* Certificate management commands */
#define IMAGE_MEM_CMD		/* Read memory command */
#define IMAGE_ARCHIVE_CMD	/* Archive image management commands */
#define SHIM_CMD		/* EFI shim command (or dummy command) */
#define USB_CMD		/* USB commands */
#define FDT_CMD		/* Flattened Device Tree commands */
" > ./config/local/general.h

make bin-x86_64-efi/ipxe.efi
make bin-x86_64-efi/ipxe.iso
make bin-x86_64-efi/snp.efi
make bin-x86_64-efi/snponly.efi
#make bin-i386-efi/ipxe.efi
#make bin-i386-efi/ipxe.iso
#make bin-i386-efi/snp.efi
#make bin-i386-efi/snponly.efi

#sudo cp bin/ipxe.pxe /srv/tftp/
#sudo cp bin/ipxe.iso /srv/tftp/
#sudo cp bin/undionly.kpxe /srv/tftp/
sudo cp bin-x86_64-efi/ipxe.efi /srv/tftp/
sudo cp bin-x86_64-efi/ipxe.iso /srv/tftp/ipxe64.iso
sudo cp bin-x86_64-efi/snp.efi /srv/tftp/
sudo cp bin-x86_64-efi/snponly.efi /srv/tftp/
#sudo cp bin-i386-efi/ipxe.efi /srv/tftp/ipxe32.efi
#sudo cp bin-i386-efi/ipxe.iso /srv/tftp/ipxe32.iso
#sudo cp bin-i386-efi/snp.efi /srv/tftp/snp32.efi
#sudo cp bin-i386-efi/snponly.efi /srv/tftp/snponly32.efi

cd /srv/tftp/

sudo echo "#!ipxe

#imgfree
ifopen
#iflinkwait
#dhcp
chain --autofree menu.ipxe
" > autoexec.ipxe

sudo echo "#!ipxe

imgfree
ifopen
iflinkwait
#dhcp

set tftpboot tftp://$ip
# "'${tftpboot}'"
set httpboot http://$ip/boot
# "'${httpboot}'"
set nfsboot nfs://$ip
# "'${nfsboot}'"

:start
menu iPXE BOOT MENU
item IPXE IPXE
item NETBOOT-XYZ NETBOOT-XYZ[INTERNET]
item MEMTEST MEMTEST
item MEMTEST-GRUB MEMTEST-GRUB
item VENTOY VENTOY
item DEBIAN DEBIAN
item LMDE LMDE
item LINUX-MINT LINUX-MINT[WIP]
item ARCHLINUX ARCHLINUX[WIP]
item HBCD HBCD
item WINDOWS10 WINDOWS10
item WINDOWS11 WINDOWS11
item RELOAD RELOAD
item CONFIG CONFIG
item SHELL SHELL
item SETUP SETUP
item REBOOT REBOOT
item SHUTDOWN SHUTDOWN

choose target && goto "'${target}'"

:IPXE
imgfree
ifopen
#dhcp
sanboot "'${httpboot}'"/ipxe.iso
goto FAILED

:NETBOOT-XYZ
imgfree
ifopen
dhcp
sanboot "'${httpboot}'"/netboot.xyz-multiarch.iso 
goto FAILED

:MEMTEST
sanboot "'${httpboot}'"/memtest.iso 
goto FAILED

:MEMTEST-GRUB
sanboot "'${httpboot}'"/grub-memtest.iso 
goto FAILED

:VENTOY
sanboot "'${httpboot}'"/ventoy-1.1.09-livecd.iso 
goto FAILED

:DEBIAN
set os debian-live-13.2.0-amd64-mate 
kernel "'${httpboot}'"/"'${os}'"/live/vmlinuz
initrd "'${httpboot}'"/"'${os}'"/live/initrd.img
imgargs vmlinuz boot=live config hooks=filesystem username=live noeject fetch="'${httpboot}'"/"'${os}'"/live/filesystem.squashfs
#sanboot --no-describe --drive 0x81 "'${httpboot}'"/debian-live-13.2.0-amd64-mate.iso iso raw initrd=initrd
boot || goto FAILED

:LMDE
set os lmde-7-cinnamon-64bit 
kernel "'${httpboot}'"/"'${os}'"/live/vmlinuz
initrd "'${httpboot}'"/"'${os}'"/live/initrd.lz
imgargs vmlinuz boot=live config hooks=filesystem username=live noeject fetch="'${httpboot}'"/"'${os}'"/live/filesystem.squashfs
#sanboot --no-describe --drive 0x81 "'${httpboot}'"/debian-live-13.2.0-amd64-mate.iso iso raw initrd=initrd
boot || goto FAILED

:LINUX-MINT
set os linuxmint-22.2-cinnamon-64bit
kernel "'${httpboot}'"/"'${os}'"/casper/vmlinuz
initrd "'${httpboot}'"/"'${os}'"/casper/initrd.lz
initrd "'${httpboot}'"/"'${os}'"/casper/filesystem.squashfs
initrd "'${httpboot}'"/"'${os}'".iso
#imgargs vmlinuz initrd=initrd.lz boot=casper netboot=http root="'${httpboot}'":"'${os}'"/casper/filesystem.squashfs ip=dhcp splash quiet -- || read void
imgargs vmlinuz initrd=initrd.lz filesystem=filesystem.squashfs boot=casper netboot=http root="'${os}'".iso url="'${httpboot}'"/"'${os}'".iso config ip=dhcp hooks=filesystem username=mint noeject
sanboot --no-describe --drive 0x81 "'${httpboot}'"/"'${os}'".iso iso raw initrd=initrd memtest
boot || goto FAILED

:ARCHLINUX
set os archlinux-x86_64
kernel "'${httpboot}'"/"'${os}'"/arch/boot/x86_64/vmlinuz-linux
initrd "'${httpboot}'"/"'${os}'"/arch/boot/x86_64/initramfs-linux.img
initrd "'${httpboot}'"/"'${os}'"/arch/x86_64/airootfs.sfs
imgargs vmlinuz-linux initrd=initramfs-linux.img filesystem=airootfs.sfs boot=arch archisobasedir=arch ip=dhcp
sanboot --no-describe --drive 0x81 "'${httpboot}'"/"'${os}'".iso iso raw initrd=initrd
boot || goto FAILED

:HBCD
set os HBCD_PE_x64-11
sanboot --no-describe --drive 0x81 "'${httpboot}'"/"'${os}'".iso || goto FAILED
goto FAILED

:WINDOWS10
set os Win10_22H2_English_x64v1
sanboot --no-describe --drive 0x81 "'${httpboot}'"/"'${os}'".iso || goto FAILED
goto FAILED

:WINDOWS11
set os Win11_24H2_English_x64
sanboot --no-describe --drive 0x81 "'${httpboot}'"/"'${os}'".iso || goto FAILED
goto FAILED

:RELOAD
ifopen
chain --autofree menu.ipxe
goto FAILED

:CONFIG
config
goto FAILED

:SHELL
shell
goto FAILED

:SETUP
reboot --setup
goto FAILED

:REBOOT
reboot
goto FAILED

:SHUTDOWN
poweroff
goto FAILED

:FAILED
echo "\"FAILED\""
sleep 10
goto start
" > menu.ipxe

sudo mkdir /var/www/html/boot/
cd /var/www/html/boot/
sudo wget https://boot.ipxe.org/ipxe.iso -O ipxe.iso
sudo wget https://boot.netboot.xyz/ipxe/netboot.xyz-multiarch.iso -O netboot.xyz-multiarch.iso
sudo wget https://memtest.org/download/v8.00/mt86plus_8.00_x86_64.iso.zip
sudo wget https://memtest.org/download/v8.00/mt86plus_8.00_x86_64.grub.iso.zip
sudo 7z x mt86plus_8.00_x86_64.iso.zip
sudo 7z x mt86plus_8.00_x86_64.grub.iso.zip
sudo rm mt86plus_8.00_x86_64.iso.zip
sudo rm mt86plus_8.00_x86_64.grub.iso.zip
sudo chown -R www-data:www-data /var/www/html/boot/ /var/www/html/boot/*; sudo chmod -R +0775 /var/www/html/boot/ /var/www/html/boot/*
echo "COPY ISO IMAGES TO /var/www/html/boot"
read -n1
sudo chown -R www-data:www-data /var/www/html/boot/ /var/www/html/boot/*; sudo chmod -R +0775 /var/www/html/boot/ /var/www/html/boot/*

#RESTART SERVICES
sudo systemctl restart isc-dhcp-server
sudo systemctl restart tftpd-hpa
sudo systemctl restart nfs-kernel-server
sudo systemctl restart apache2
