-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrub.cfg.template
89 lines (78 loc) · 1.85 KB
/
grub.cfg.template
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
set default_color="white/black"
set color_normal="$default_color"
set log_level=$ENV_GRUB_LOG_LEVEL
function error {
if test $log_level -ge 1; then
set color_normal=white/red
echo "[ERROR] $1"
set color_normal="$default_color"
fi
}
function debug {
if test $log_level -ge 3; then
set color_normal=white/cyan
echo "[DEBUG] $1"
set color_normal="$default_color"
fi
}
for mod in $MODULES; do
debug "insmod $mod"
insmod $mod
done
function try_mount {
debug "function start"
if
cryptomount -u $ENV_GRUB_CRYPTODISK_UUID
then
if [ x$feature_platform_search_hint = xy ]; then
debug "feature_platform_search_hint"
search --no-floppy --fs-uuid --set=root --hint='$ENV_GRUB_HINT' $ENV_GRUB_FS_UUID
else
debug "no feature_platform_search_hint - set directly"
search --no-floppy --fs-uuid --set=root $ENV_GRUB_FS_UUID
fi
debug "root: $root"
set prefix=($root)'$ENV_GRUB_CHAINLOAD_PREFIX'
debug "prefix: $prefix"
return 0
else
error "cryptomount failed with $?"
return 1
fi
}
until try_mount; do
set color_normal=red/black
echo "Wrong password. Try again in..."
set color_normal="$default_color"
sleep --verbose $ENV_GRUB_RETRY_TIMEOUT
clear
done
debug "prefix: $prefix"
debug "root: $root"
function test_file {
if
test -f "$1"
then
debug "file exists: $1"
else
error "FILE DOES NOT EXIST: $1"
fi
}
if test $log_level -ge 1; then
test_file "$prefix$ENV_GRUB_CHAINLOAD_EFI"
sleep --interruptible --verbose 60
echo ''
if test $log_level -ge 4; then
set pager=1
set debug=all
fi
fi
chainloader $prefix$ENV_GRUB_CHAINLOAD_EFI
set chainload_return=$?
if test $chainload_return -ge 1; then
if test $log_level -ge 1; then
set debug=''
error "Failed to chainload with $chainload_return"
sleep --interruptible --verbose 12000
fi
fi