forked from a1ive/grub2-filemanager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·198 lines (188 loc) · 5.07 KB
/
build.sh
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
#!/usr/bin/env sh
echo -n "checking for gettext ... "
if [ -e "$(which msgfmt)" ]
then
echo "ok"
else
echo "not found\nPlease install gettext."
exit
fi
echo -n "checking for xorriso ... "
if [ -e "$(which xorriso)" ]
then
echo "ok"
else
echo "not found\nPlease install xorriso."
exit
fi
echo -n "checking for grub ... "
if [ -e "$(which grub-mkimage)" ]
then
echo "ok"
else
echo "not found\nPlease install grub."
exit
fi
echo -n "checking for mtools ... "
if [ -e "$(which mtools)" ]
then
echo "ok"
else
echo "not found\nPlease install mtools."
exit
fi
if [ -d "build" ]
then
rm -r build
fi
mkdir build
echo "common files"
cp -r boot build/
cp grub/locale/*.mo build/boot/grubfm/locale/
cd lang
for po in */fm.po; do
msgfmt ${po} -o ../build/boot/grubfm/locale/fm/${po%/*}.mo
done
cd ..
echo "Language"
echo "1. Simplified Chinese"
echo "2. Traditional Chinese"
echo "3. English (United States)"
echo "4. Turkish"
echo "5. German"
echo "6. Vietnamese"
echo "7. Russian"
echo "8. Hebrew"
echo "9. Spanish"
echo "10. Polish"
echo "11. Ukrainian"
echo "12. French"
echo "13. Danish"
echo "14. Portuguese (Brazil)"
read -p "Please make a choice: " choice
case "$choice" in
2)
echo "zh_TW"
cp lang/zh_TW/lang.sh build/boot/grubfm/
;;
3)
echo "en_US"
;;
4)
echo "tr_TR"
cp lang/tr_TR/lang.sh build/boot/grubfm/
;;
5)
echo "de_DE"
cp lang/de_DE/lang.sh build/boot/grubfm/
;;
6)
echo "vi_VN"
cp lang/vi_VN/lang.sh build/boot/grubfm/
;;
7)
echo "ru_RU"
cp lang/ru_RU/lang.sh build/boot/grubfm/
;;
8)
echo "he_IL"
cp lang/he_IL/lang.sh build/boot/grubfm/
;;
9)
echo "es_ES"
cp lang/es_ES/lang.sh build/boot/grubfm/
;;
10)
echo "pl_PL"
cp lang/pl_PL/lang.sh build/boot/grubfm/
;;
11)
echo "uk_UA"
cp lang/uk_UA/lang.sh build/boot/grubfm/
;;
12)
echo "fr_FR"
cp lang/fr_FR/lang.sh build/boot/grubfm/
;;
13)
echo "da_DK"
cp lang/da_DK/lang.sh build/boot/grubfm/
;;
14)
echo "pt_BR"
cp lang/pt_BR/lang.sh build/boot/grubfm/
;;
*)
echo "zh_CN"
cp lang/zh_CN/lang.sh build/boot/grubfm/
;;
esac
echo "x86_64-efi"
mkdir build/boot/grubfm/x86_64-efi
for modules in $(cat arch/x64/optional.lst)
do
echo "copying ${modules}.mod"
cp grub/x86_64-efi/${modules}.mod build/boot/grubfm/x86_64-efi/
done
# cp arch/x64/*.efi build/boot/grubfm
cp arch/x64/*.xz build/boot/grubfm
cd build
find ./boot | cpio -o -H newc > ./memdisk.cpio
cd ..
rm -r build/boot/grubfm/x86_64-efi
# rm build/boot/grubfm/*.efi
rm build/boot/grubfm/*.xz
modules=$(cat arch/x64/builtin.lst)
grub-mkimage -m ./build/memdisk.cpio -d ./grub/x86_64-efi -p "(memdisk)/boot/grubfm" -c arch/x64/config.cfg -o grubfmx64.efi -O x86_64-efi $modules
echo "i386-efi"
mkdir build/boot/grubfm/i386-efi
for modules in $(cat arch/ia32/optional.lst)
do
echo "copying ${modules}.mod"
cp grub/i386-efi/${modules}.mod build/boot/grubfm/i386-efi/
done
# cp arch/ia32/*.efi build/boot/grubfm
cp arch/ia32/*.xz build/boot/grubfm
cd build
find ./boot | cpio -o -H newc > ./memdisk.cpio
cd ..
rm -r build/boot/grubfm/i386-efi
# rm build/boot/grubfm/*.efi
rm build/boot/grubfm/*.xz
modules=$(cat arch/ia32/builtin.lst)
grub-mkimage -m ./build/memdisk.cpio -d ./grub/i386-efi -p "(memdisk)/boot/grubfm" -c arch/ia32/config.cfg -o grubfmia32.efi -O i386-efi $modules
rm build/memdisk.cpio
echo "i386-pc"
builtin=$(cat arch/legacy/builtin.lst)
mkdir build/boot/grubfm/i386-pc
modlist="$(cat arch/legacy/insmod.lst) $(cat arch/legacy/optional.lst)"
for modules in $modlist
do
echo "copying ${modules}.mod"
cp grub/i386-pc/${modules}.mod build/boot/grubfm/i386-pc/
done
cp arch/legacy/insmod.lst build/boot/grubfm/
cp arch/legacy/grub.exe build/boot/grubfm/
cp arch/legacy/memdisk build/boot/grubfm/
cp arch/legacy/duet64.iso build/boot/grubfm/
cp arch/legacy/winvblk.img build/boot/grubfm/
cp arch/legacy/*.xz build/boot/grubfm/
cd build
find ./boot | cpio -o -H newc | gzip -9 > ./fm.loop
cd ..
rm -r build/boot
grub-mkimage -d ./grub/i386-pc -p "(memdisk)/boot/grubfm" -c arch/legacy/config.cfg -o ./build/core.img -O i386-pc $builtin
cat grub/i386-pc/cdboot.img build/core.img > build/fmldr
rm build/core.img
cp arch/legacy/MAP build/
cp -r arch/legacy/ntboot/* build/
touch build/ventoy.dat
xorriso -as mkisofs -R -hide-joliet boot.catalog -b fmldr -no-emul-boot -allow-lowercase -boot-load-size 4 -boot-info-table -o grubfm.iso build
dd if=/dev/zero of=build/efi.img bs=1M count=16
mkfs.vfat build/efi.img
mmd -i build/efi.img ::EFI
mmd -i build/efi.img ::EFI/BOOT
mcopy -i build/efi.img grubfmx64.efi ::EFI/BOOT/BOOTX64.EFI
mcopy -i build/efi.img grubfmia32.efi ::EFI/BOOT/BOOTIA32.EFI
xorriso -as mkisofs -R -hide-joliet boot.catalog -b fmldr -no-emul-boot -allow-lowercase -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e efi.img -no-emul-boot -o grubfm_multiarch.iso build
rm -r build