forked from a1ive/grub2-filemanager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·163 lines (155 loc) · 4.12 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
#!/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 mkisofs ... "
if [ -e "$(which mkisofs)" ]
then
echo "ok"
geniso=$(which mkisofs)
else
echo -n "not found\nchecking for genisoimage ... "
if [ -e "$(which genisoimage)" ]
then
echo "ok"
geniso=$(which genisoimage)
else
echo "not found\nPlease install mkisofs or genisoimage."
exit
fi
fi
echo -n "checking for grub ... "
if [ -e "$(which grub-mkimage)" ]
then
echo "ok"
else
echo "not found\nPlease install grub."
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"
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/
;;
*)
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/*.gz 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/*.gz
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/*.gz 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/*.gz
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/duet64.iso build/boot/grubfm/
cp arch/legacy/memdisk build/boot/grubfm/
cp arch/legacy/ipxe.lkrn build/boot/grubfm/
cp arch/legacy/*.gz 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/
$geniso -R -hide-joliet boot.catalog -b fmldr -no-emul-boot -allow-lowercase -boot-load-size 4 -boot-info-table -o grubfm.iso build
rm -r build