"doc/doc_en/models_and_config_en.md" did not exist on "72dbeee87cad47a31a8ee05f9f9f8921a94031c6"
ventoy_pack.sh 4.73 KB
Newer Older
1
2
#!/bin/sh

longpanda's avatar
longpanda committed
3
if [ "$1" = "CI" ]; then
longpanda's avatar
longpanda committed
4
    OPT='-dR'
longpanda's avatar
longpanda committed
5
6
7
8
else
    OPT='-a'
fi

longpanda's avatar
longpanda committed
9
dos2unix -q ./tool/ventoy_lib.sh
longpanda's avatar
longpanda committed
10
dos2unix -q ./tool/VentoyWorker.sh
11
dos2unix -q ./tool/VentoyGTK.glade
longpanda's avatar
longpanda committed
12
dos2unix -q ./tool/distro_gui_type.json
longpanda's avatar
longpanda committed
13

14
15
16
17
18
19
20
21
22
23
24
25
26
. ./tool/ventoy_lib.sh

GRUB_DIR=../GRUB2/INSTALL
LANG_DIR=../LANGUAGES

if ! [ -d $GRUB_DIR ]; then
    echo "$GRUB_DIR not exist"
    exit 1
fi


cd ../IMG
sh mkcpio.sh
longpanda's avatar
longpanda committed
27
sh mkloopex.sh
28
29
cd -

30
31
32
33
cd ../Unix
sh pack_unix.sh
cd -

34
35
36
37
38
cd ../LinuxGUI
sh language.sh || exit 1
sh build.sh
cd -

39
40
41
42
43
cd ../Plugson
sh build.sh
sh pack.sh
cd -

44
45
46
47
48
49
50
51
52
53
54
55
56

LOOP=$(losetup -f)

rm -f img.bin
dd if=/dev/zero of=img.bin bs=1M count=256 status=none

losetup -P $LOOP img.bin 

while ! grep -q 524288 /sys/block/${LOOP#/dev/}/size 2>/dev/null; do
    echo "wait $LOOP ..."
    sleep 1
done

longpanda's avatar
longpanda committed
57
format_ventoy_disk_mbr 0 $LOOP fdisk
58

59
$GRUB_DIR/sbin/grub-bios-setup  --skip-fs-probe  --directory="./grub/i386-pc"  $LOOP
60
61
62
63
64
65
66
67
68
69
70
71
72
73

curver=$(get_ventoy_version_from_cfg ./grub/grub.cfg)

tmpmnt=./ventoy-${curver}-mnt
tmpdir=./ventoy-${curver}

rm -rf $tmpmnt
mkdir -p $tmpmnt

mount ${LOOP}p2  $tmpmnt 

mkdir -p $tmpmnt/grub

# First copy grub.cfg file, to make it locate at front of the part2
longpanda's avatar
longpanda committed
74
cp $OPT ./grub/grub.cfg     $tmpmnt/grub/
75
76

ls -1 ./grub/ | grep -v 'grub\.cfg' | while read line; do
longpanda's avatar
longpanda committed
77
    cp $OPT ./grub/$line $tmpmnt/grub/
78
79
done

longpanda's avatar
longpanda committed
80
81
82
83
84
85
86
#tar help txt
cd $tmpmnt/grub/
tar czf help.tar.gz ./help/
rm -rf ./help
cd ../../


longpanda's avatar
longpanda committed
87
88
89
cp $OPT ./ventoy   $tmpmnt/
cp $OPT ./EFI   $tmpmnt/
cp $OPT ./tool/ENROLL_THIS_KEY_IN_MOKMANAGER.cer $tmpmnt/
90
91
92


mkdir -p $tmpmnt/tool
longpanda's avatar
longpanda committed
93
94
95
96
# cp $OPT ./tool/i386/mount.exfat-fuse     $tmpmnt/tool/mount.exfat-fuse_i386
# cp $OPT ./tool/x86_64/mount.exfat-fuse   $tmpmnt/tool/mount.exfat-fuse_x86_64
# cp $OPT ./tool/aarch64/mount.exfat-fuse  $tmpmnt/tool/mount.exfat-fuse_aarch64
# to save space
longpanda's avatar
longpanda committed
97
98
99
dd status=none bs=1024 count=16  if=./tool/i386/vtoycli    of=$tmpmnt/tool/mount.exfat-fuse_i386
dd status=none bs=1024 count=16  if=./tool/x86_64/vtoycli  of=$tmpmnt/tool/mount.exfat-fuse_x86_64
dd status=none bs=1024 count=16  if=./tool/aarch64/vtoycli of=$tmpmnt/tool/mount.exfat-fuse_aarch64
100

longpanda's avatar
longpanda committed
101

longpanda's avatar
longpanda committed
102
rm -f $tmpmnt/grub/i386-pc/*.img
103
104
105
106
107
108
109
110
111
112
113
114
115


umount $tmpmnt && rm -rf $tmpmnt


rm -rf $tmpdir
mkdir -p $tmpdir/boot
mkdir -p $tmpdir/ventoy
echo $curver > $tmpdir/ventoy/version
dd if=$LOOP of=$tmpdir/boot/boot.img bs=1 count=512  status=none
dd if=$LOOP of=$tmpdir/boot/core.img bs=512 count=2047 skip=1 status=none
xz --check=crc32 $tmpdir/boot/core.img

longpanda's avatar
longpanda committed
116
cp $OPT ./tool $tmpdir/
longpanda's avatar
longpanda committed
117
rm -f $tmpdir/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
longpanda's avatar
longpanda committed
118
cp $OPT Ventoy2Disk.sh $tmpdir/
119
cp $OPT VentoyWeb.sh $tmpdir/
120
cp $OPT VentoyPlugson.sh $tmpdir/
121
cp $OPT VentoyGUI* $tmpdir/
longpanda's avatar
longpanda committed
122

longpanda's avatar
longpanda committed
123

longpanda's avatar
longpanda committed
124
125
126
cp $OPT README $tmpdir/
cp $OPT plugin $tmpdir/
cp $OPT CreatePersistentImg.sh $tmpdir/
longpanda's avatar
longpanda committed
127
cp $OPT ExtendPersistentImg.sh $tmpdir/
longpanda's avatar
longpanda committed
128
dos2unix -q $tmpdir/Ventoy2Disk.sh
129
dos2unix -q $tmpdir/VentoyWeb.sh
130
dos2unix -q $tmpdir/VentoyPlugson.sh
longpanda's avatar
longpanda committed
131

longpanda's avatar
longpanda committed
132

longpanda's avatar
longpanda committed
133
dos2unix -q $tmpdir/CreatePersistentImg.sh
longpanda's avatar
longpanda committed
134
dos2unix -q $tmpdir/ExtendPersistentImg.sh
135

136
137
138
cp $OPT ../LinuxGUI/WebUI $tmpdir/
sed 's/.*SCRIPT_DEL_THIS \(.*\)/\1/g' -i $tmpdir/WebUI/index.html

139
140
141
142
143
144
145
146
147
148
149
#32MB disk img
dd status=none if=$LOOP of=$tmpdir/ventoy/ventoy.disk.img bs=512 count=$VENTOY_SECTOR_NUM skip=$part2_start_sector
xz --check=crc32 $tmpdir/ventoy/ventoy.disk.img

losetup -d $LOOP && rm -f img.bin

rm -f ventoy-${curver}-linux.tar.gz


CurDir=$PWD

150
for d in i386 x86_64 aarch64 mips64el; do
longpanda's avatar
longpanda committed
151
152
153
    cd $tmpdir/tool/$d
    for file in $(ls); do
        if [ "$file" != "xzcat" ]; then
154
155
156
157
158
            if echo "$file" | grep -q '^Ventoy2Disk'; then
                chmod +x $file
            else
                xz --check=crc32 $file
            fi
longpanda's avatar
longpanda committed
159
160
161
        fi
    done
    cd $CurDir
162
163
done

longpanda's avatar
longpanda committed
164
165
166
167
#chmod 
find $tmpdir/ -type d -exec chmod 755 "{}" +
find $tmpdir/ -type f -exec chmod 644 "{}" +
chmod +x $tmpdir/Ventoy2Disk.sh
168
chmod +x $tmpdir/VentoyWeb.sh
169
chmod +x $tmpdir/VentoyPlugson.sh
170
171
172
chmod +x $tmpdir/VentoyGUI*

cp $OPT $LANG_DIR/languages.json $tmpdir/tool/
longpanda's avatar
longpanda committed
173

longpanda's avatar
longpanda committed
174

longpanda's avatar
longpanda committed
175
chmod +x $tmpdir/CreatePersistentImg.sh
176
chmod +x $tmpdir/ExtendPersistentImg.sh
longpanda's avatar
longpanda committed
177

178
179
tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir

longpanda's avatar
longpanda committed
180
181


182
rm -f ventoy-${curver}-windows.zip
longpanda's avatar
longpanda committed
183
184

cp $OPT Ventoy2Disk.exe $tmpdir/
185
cp $OPT VentoyPlugson.exe $tmpdir/
longpanda's avatar
longpanda committed
186
187
188
189
190
191
cp $OPT FOR_X64_ARM.txt $tmpdir/
mkdir -p $tmpdir/altexe
cp $OPT Ventoy2Disk_*.exe $tmpdir/altexe/



192
cp $OPT $LANG_DIR/languages.json $tmpdir/ventoy/
193
194
rm -rf $tmpdir/tool
rm -f $tmpdir/*.sh
longpanda's avatar
longpanda committed
195
rm -f $tmpdir/VentoyGUI.*
196
rm -rf $tmpdir/WebUI
longpanda's avatar
longpanda committed
197
rm -f $tmpdir/README
198
199
200
201
202
203


zip -r ventoy-${curver}-windows.zip $tmpdir/

rm -rf $tmpdir

longpanda's avatar
longpanda committed
204
echo "=============== run livecd.sh ==============="
longpanda's avatar
longpanda committed
205
cd ../LiveCDGUI
longpanda's avatar
longpanda committed
206
sh livecd.sh $1
longpanda's avatar
update  
longpanda committed
207
208
cd $CurDir

longpanda's avatar
longpanda committed
209
mv ../LiveCDGUI/ventoy*.iso ./
longpanda's avatar
update  
longpanda committed
210

211
212
213
214
215
216
217
if [ -e ventoy-${curver}-windows.zip ] && [ -e ventoy-${curver}-linux.tar.gz ]; then
    echo -e "\n ============= SUCCESS =================\n"
else
    echo -e "\n ============= FAILED =================\n"
    exit 1
fi

longpanda's avatar
longpanda committed
218
rm -f log.txt
219