-
Notifications
You must be signed in to change notification settings - Fork 14
/
menu.ipxe
executable file
·184 lines (157 loc) · 5.64 KB
/
menu.ipxe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!ipxe
# Variables are specified in boot.ipxe.cfg
# Some menu defaults
# set menu-timeout 0 if no client-specific settings found
isset ${menu-timeout} || set menu-timeout 0
set submenu-timeout ${menu-timeout}
isset ${menu-default} || set menu-default exit
# Figure out if client is 64-bit capable
cpuid --ext 29 && set arch x64 || set arch x86
cpuid --ext 29 && set archl amd64 || set archl i386
###################### MAIN MENU ####################################
:start
menu iPXE boot menu for ${initiator-iqn}
item --gap -- ------------------------- Operating systems ------------------------------
item --key w windows Boot Windows from iSCSI
item --key u ubuntu Boot Ubuntu from iSCSI
item --key u centos Boot CentOS from iSCSI
item --key u esxi Boot ESXi from iSCSI
item --gap -- ------------------------- Tools and utilities ----------------------------
item --key d menu-diag System tools...
item --key i menu-install Installers...
item --gap -- ------------------------- Advanced options -------------------------------
item --key c config Configure settings
item shell Drop to iPXE shell
item reboot Reboot computer
item
item --key x exit Exit iPXE and continue BIOS boot
choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
set menu-timeout 0
goto ${selected}
:cancel
echo You cancelled the menu, dropping you to a shell
:shell
echo Type 'exit' to get the back to the menu
shell
set menu-timeout 0
set submenu-timeout 0
goto start
:failed
echo Booting failed, dropping to shell
goto shell
:reboot
reboot
:exit
exit
:config
config
goto start
:back
set submenu-timeout 0
clear submenu-default
goto start
############ MAIN MENU ITEMS ############
:windows
echo Booting Windows from iSCSI for ${initiator-iqn}
set netX/gateway ${iscsi-server}
set root-path ${base-iscsi}:${hostname}.Windows
set keep-san 1
sanboot ${root-path} || goto failed
goto start
:ubuntu
echo Booting Ubuntu from iSCSI for ${initiator-iqn}
set root-path ${base-iscsi}:${hostname}.Ubuntu
set keep-san 1
sanboot ${root-path} || goto failed
goto start
:centos
echo Booting CentOS from iSCSI for ${initiator-iqn}
set root-path ${base-iscsi}:${hostname}.CentOS
set keep-san 1
sanboot ${root-path} || goto failed
goto start
:esxi
echo Booting ESXi from iSCSI for iqn.2000-01.com.synology:ipxe.ESXI
set root-path iscsi:10.10.10.250:::1:iqn.2000-01.com.synology:ipxe.ESXI
set keep-san 1
sanboot ${root-path} || goto failed
goto start
###################### SYSTEM TOOL MENU #############################
:menu-diag
menu Diagnostic tools
item memtest Memtest86+
item winpe WinPE
item
item --key 0x08 back Back to top menu...
iseq ${menu-default} menu-diag && isset ${submenu-default} && goto menu-diag-timed ||
choose selected && goto ${selected} || goto start
:menu-diag-timed
choose --timeout ${submenu-timeout} --default ${submenu-default} selected && goto ${selected} || goto start
:memtest
set base-url http://${nas_ip}:88/tools
initrd ${base-url}/memtest86_5.01.iso
chain memdisk iso raw || goto failed
goto start
:winpe
set base-url http://${nas_ip}:88/tools
initrd ${base-url}/UQi_USBsys_10th.iso
chain memdisk iso raw || goto failed
goto start
############################ INSTALLER MENU #########################
:menu-install
menu Installers for ${initiator-iqn}
item winpe-install Hook Windows iSCSI and boot WinPE for intallation
item ubuntu-install Hook Ubuntu ${archl} iSCSI and install
item centos-install Hook CentOS ${archl} iSCSI and install
item esxi-install Hook ESXi ${archl} iSCSI and install
item
item --key 0x08 back Back to top menu...
iseq ${menu-default} menu-install && isset ${submenu-default} && goto menu-install-timed ||
choose selected && goto ${selected} || goto start
:menu-install-timed
choose --timeout ${submenu-timeout} --default ${submenu-default} selected && goto ${selected} || goto start
:winpe-install
echo Booting Windows PE ${arch} installer for ${initiator-iqn}
echo (for installing Windows)
set netX/gateway ${iscsi-server}
set root-path ${base-iscsi}:${hostname}.Windows
set keep-san 1
echo sanhook start...
sanhook ${root-path} || goto failed
echo set base url starting
set base-url http://${nas_ip}:88/Install/WinPE
kernel wimboot
initrd ${base-url}/x64/Boot/BCD bcd
initrd ${base-url}/x64/Boot/boot.sdi boot.sdi
initrd ${base-url}/x64/sources/boot.wim boot.wim
boot || goto failed
goto start
:ubuntu-install
echo Starting Ubuntu 16.04 ${archl} installer for ${initiator-iqn}
set root-path ${base-iscsi}:${hostname}.Ubuntu
cpuid --ext 29 && set arch amd64 || set arch x86
set base-url ${sanboot-url}Ubuntu16/${arch}
kernel ${base-url}/netboot/linux
initrd ${base-url}/netboot/initrd.gz
imgargs linux auto=true fb=false url=${base-url}/./preseed.cfg DEBCONF_DEBUG=5 netcfg/get_hostname=${hostname}.Ubuntu partman-iscsi/login/address=${iscsi-server} partman-iscsi/login/targets=${base-iqn}:${hostname}.Ubuntu
boot || goto failed
goto start
:centos-install
echo Starting CentOS 7 ${archl} installer for ${initiator-iqn}
set root-path ${base-iscsi}:${hostname}.CentOS
set base-url ${sanboot-url}CentOS/x86_64
set keep-san 1
sanhook ${root-path} || goto failed
kernel ${base-url}/images/pxeboot/vmlinuz initrd=initrd.img repo=${base-url}
initrd ${base-url}/images/pxeboot/initrd.img
boot || goto failed
goto start
:esxi-install
echo Starting ESXi 6.7 installer for iqn.2000-01.com.synology:ipxe.ESXI
set root-path iscsi:10.10.10.250:::1:iqn.2000-01.com.synology:ipxe.ESXI
set base-url http://10.10.10.250:88/Install/ESXI
set keep-san 1
sanhook ${root-path} || goto failed
initrd ${base-url}/123.iso
chain memdisk iso raw || goto failed
goto start