-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgrub.menu.gary-os.cfg
executable file
·243 lines (217 loc) · 7.57 KB
/
grub.menu.gary-os.cfg
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
################################################################################
# grub gary-os menu
################################################################################
set debug="chain,linux,loader,relocator,tftp"
set timeout_default="5"
set grub_menu="/boot/grub/grub.cfg"
if [ -z "${options_root}" ]; then
set options_root="rootwait ro"
fi
if [ -z "${options_boot}" ]; then
set options_boot="${options_root}"
fi
################################################################################
set default="0"
set timeout=-1
########################################
set garyos_hint="hd0,1"
if [ -z "${garyos_root}" ]; then
set garyos_root="/dev/sda1"
fi
if [ -z "${garyos_size}" ]; then
set garyos_size="3584m"
fi
set garyos_grub="/gary-os/gary-os.grub.cfg"
set garyos_kern="/gary-os/gary-os.kernel"
set garyos_tiny="/gary-os/gary-os.tiny.kernel"
if [ -z "${garyos_file}" ]; then
set garyos_file="/gary-os/gary-os.rootfs"
fi
set garyos_inst="/boot/kernel"
set garyos_init="/boot/initrd"
################################################################################
function garyos_env {
for g in \
grub_menu \
options_serial \
; do
export ${g}
done
for g in \
options_root \
options_boot \
garyos_root \
garyos_size \
garyos_file \
garyos_pxesrv \
garyos_pxesrc \
garyos_pxeopt \
; do
if [ "${1}" == "reset" ]; then
eval set ${g}="\"\""
fi
export ${g}
done
if [ "${1}" != "load" ]; then
configfile (${root})${grub_menu}
fi
}
function garyos_read {
if [ "${1}" == "options_root" ]; then
echo "[options_boot]"
echo "= ${options_boot}"
fi
echo "[${1}]"
eval echo "\"= \$${1}\""
echo -en "> "
read g
if [ -n "${g}" ]; then
eval set ${1}="\"${g}\""
fi
garyos_env
}
function garyos_options {
garyos_env load
submenu "GaryOS Options" {
menuentry "# commands" { echo }
menuentry " # return" { garyos_env }
menuentry " # reset" { garyos_env reset }
menuentry " # dhcp" { net_dhcp; garyos_env }
#>>> menuentry "- kernel ......... ${options_root}" { garyos_read options_root }
menuentry "- kernel ......... ${options_boot}" { garyos_read options_root }
menuentry "- rootfs" { echo }
menuentry " - groot ........ ${garyos_root}" { garyos_read garyos_root }
menuentry " - groot_size ... ${garyos_size}" { garyos_read garyos_size }
menuentry " - groot_file ... ${garyos_file}" { garyos_read garyos_file }
menuentry "- install" { echo }
menuentry " - root ......... ${garyos_root}" { garyos_read garyos_root }
menuentry "- pxe" { echo }
menuentry " - server ....... ${garyos_pxesrv}" { garyos_read garyos_pxesrv }
menuentry " - source ....... ${garyos_pxesrc}" { garyos_read garyos_pxesrc }
menuentry " - options ...... ${garyos_pxeopt}" { garyos_read garyos_pxeopt }
menuentry " = rootfs" {
set garyos_boot="groot=${garyos_root} groot_size=${garyos_size} groot_file=${garyos_file} groot_hint=pxe"
set garyos_pxeopt="${garyos_boot}"
garyos_env
}
}
}
########################################
function garyos_error {
set pager="1"
echo "##############################################################################"
echo "#"
echo "# GaryOS: An Error Has Occurred!"
echo "#"
echo "# Hopefully, it is simply that the files for this entry are missing."
echo "# If so, please follow the README to download them into the correct location."
echo "#"
echo "# If the issue is another error, please:"
echo "# 1. Take a readable picture of the screen"
echo "# 2. Hit \"Enter\", and take another readable picture of the screen"
echo "# 3. Continue with \"Space\" or \"Enter\" and taking pictures until complete"
echo "# 4. Document the make and model of this system, including CPU and memory"
echo "# 5. Use the \"Support\" section of the README to submit everything"
echo "#"
echo "##############################################################################"
read continue
echo "##############################################################################"
echo "# lsmmap"
echo "##############################################################################"
lsmmap
echo "##############################################################################"
echo "#"
echo "# All done! Hit \"Enter\" to finish."
echo "#"
echo "# Thank you so much for your support."
echo "#"
echo "##############################################################################"
read continue
}
################################################################################
search --no-floppy --file --set garyos_custom ${garyos_grub}
search --no-floppy --file --set garyos_rescue ${garyos_kern}
search --no-floppy --file --set garyos_rootfs ${garyos_file}
if [ -z "${garyos_rescue}" ]; then
search --no-floppy --file --set garyos_rescue ${garyos_tiny}
fi
if [ -n "${garyos_custom}" ]; then
set default="garyos_custom"
set timeout="${timeout_default}"
else
set garyos_custom="${garyos_hint}"
fi
if [ -n "${garyos_rescue}" ]; then
set default="garyos_rescue"
set timeout="${timeout_default}"
else
set garyos_rescue="${garyos_hint}"
fi
if [ -n "${garyos_rootfs}" ]; then
set default="garyos_rootfs"
set timeout="${timeout_default}"
else
set garyos_rootfs="${garyos_hint}"
fi
menuentry "GaryOS Menu" --id garyos_custom {
configfile (${garyos_custom})${garyos_grub}
}
garyos_options
menuentry "GaryOS Boot" --id garyos_rescue {
if ! linux (${garyos_rescue})${garyos_kern} ${options_boot}; then
if ! linux (${garyos_rescue})${garyos_tiny} ${options_boot}; then
garyos_error
fi; fi
boot
}
menuentry "GaryOS Boot Rootfs" --id garyos_rootfs {
set garyos_boot="groot=${garyos_root} groot_size=${garyos_size} groot_file=${garyos_file} groot_hint=${garyos_rootfs}"
if ! linux (${garyos_rootfs})${garyos_kern} ${garyos_boot} ${options_boot}; then
if ! linux (${garyos_rootfs})${garyos_tiny} ${garyos_boot} ${options_boot}; then
garyos_error
fi; fi
boot
}
########################################
search --no-floppy --file --set garyos_install ${garyos_inst}
if [ -n "${garyos_install}" ]; then
if [ -f "(${garyos_install})${grub_menu}" ]; then
set default="garyos_install_menu"
else
set default="garyos_install"
fi
set timeout="${timeout_default}"
else
set garyos_install="${garyos_hint}"
fi
menuentry "GaryOS Install Menu" --id garyos_install_menu {
configfile (${garyos_install})${grub_menu}
}
menuentry "GaryOS Install Boot" --id garyos_install {
set garyos_boot="root=${garyos_root}"
linux (${garyos_install})${garyos_inst} ${garyos_boot} ${options_boot}
if [ -f "(${garyos_install})${garyos_init}" ]; then
initrd (${garyos_install})${garyos_init}
fi
}
########################################
if [ -z "${garyos_pxesrv}" ]; then set garyos_pxesrv="${net_efinet0_next_server}"; fi
if [ -z "${garyos_pxesrc}" ]; then set garyos_pxesrc="${net_efinet0_rootpath}"; fi
if [ -z "${garyos_pxeopt}" ]; then set garyos_pxeopt="${net_efinet0_extensionspath}"; fi
if [ -z "${garyos_pxesrv}" ]; then set garyos_pxesrv="${net_efinet0_dhcp_next_server}"; fi
if [ -z "${garyos_pxesrc}" ]; then set garyos_pxesrc="${net_efinet0_dhcp_rootpath}"; fi
if [ -z "${garyos_pxeopt}" ]; then set garyos_pxeopt="${net_efinet0_dhcp_extensionspath}"; fi
if [ -n "${garyos_pxesrv}" ]; then
set default="garyos_pxesrv"
set timeout="${timeout_default}"
if [ -z "${garyos_pxesrc}" ]; then
set garyos_pxesrc="${garyos_kern}"
fi
fi
menuentry "GaryOS PXE" --id garyos_pxesrv {
set garyos_boot="${garyos_pxeopt}"
linux (tftp,${garyos_pxesrv})${garyos_pxesrc} ${garyos_boot} ${options_boot}
}
################################################################################
# end of file
################################################################################