]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - Plugson/pack.sh
VentoyPlugson ---- A GUI ventoy.json configurator
[Ventoy.git] / Plugson / pack.sh
1 #!/bin/sh
2
3 output_hex_u32() {
4 hexval=$(printf '%08x' $1)
5 hex_B0=${hexval:0:2}
6 hex_B1=${hexval:2:2}
7 hex_B2=${hexval:4:2}
8 hex_B3=${hexval:6:2}
9 echo -en "\x$hex_B3\x$hex_B2\x$hex_B1\x$hex_B0"
10 }
11
12 if [ -n "$PKG_DATE" ]; then
13 plugson_verion=$PKG_DATE
14 else
15 plugson_verion=$(date '+%Y%m%d %H:%M:%S')
16 fi
17
18 sed "s#.*plugson_build_date.*# <b id=\"plugson_build_date\">$plugson_verion</b>#" -i ./www/index.html
19
20 if [ ! -f ./vs/VentoyPlugson/Release/VentoyPlugson.exe ]; then
21 echo "NO VentoyPlugson.exe found"
22 exit 1
23 fi
24
25 if [ -f ./www.tar.xz ]; then
26 rm -f ./www.tar.xz
27 fi
28
29 echo -n "$plugson_verion" > ./www/buildtime
30
31 tar cf www.tar www
32 xz --check=crc32 www.tar
33
34 xzdec=$(stat -c '%s' ./www.tar.xz)
35 echo xzdec=$xzdec
36
37 output_hex_u32 0x54535251 > ex.bin
38 output_hex_u32 $xzdec >> ex.bin
39 output_hex_u32 0xa4a3a2a1 >> ex.bin
40
41 cat ./vs/VentoyPlugson/Release/VentoyPlugson.exe ./www.tar.xz ex.bin > VentoyPlugson.exe
42 rm -f ./ex.bin
43
44 rm -f ../INSTALL/VentoyPlugson.exe
45 cp -a ./VentoyPlugson.exe ../INSTALL/VentoyPlugson.exe
46
47 rm -f ../INSTALL/tool/plugson.tar.xz
48 mv ./www.tar.xz ../INSTALL/tool/plugson.tar.xz
49
50 echo ""
51 echo "========= SUCCESS ==========="
52 echo ""
53
54