]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/ventoy_pack.sh
Fix the resolution issue when boot Windows/WinPE in UEFI mode.
[Ventoy.git] / INSTALL / ventoy_pack.sh
index 9e3b48411880588dff38f144b40f3cb93c76282a..e03e8b02eb27866b489f4755c5f39b5d16e3f95b 100644 (file)
@@ -1,7 +1,15 @@
 #!/bin/sh
 
+if [ "$1" = "CI" ]; then
+    OPT='-dR'
+else
+    OPT='-a'
+fi
+
 dos2unix -q ./tool/ventoy_lib.sh
 dos2unix -q ./tool/VentoyWorker.sh
+dos2unix -q ./tool/VentoyGTK.glade
+dos2unix -q ./tool/distro_gui_type.json
 
 . ./tool/ventoy_lib.sh
 
@@ -16,6 +24,26 @@ fi
 
 cd ../IMG
 sh mkcpio.sh
+sh mkloopex.sh
+cd -
+
+cd ../Unix
+sh pack_unix.sh
+cd -
+
+cd ../LinuxGUI
+sh language.sh || exit 1
+sh build.sh
+cd -
+
+cd ../Plugson
+sh build.sh
+sh pack.sh
+cd -
+
+cd ../Vlnk
+sh build.sh
+sh pack.sh
 cd -
 
 
@@ -31,7 +59,7 @@ while ! grep -q 524288 /sys/block/${LOOP#/dev/}/size 2>/dev/null; do
     sleep 1
 done
 
-format_ventoy_disk $LOOP fdisk
+format_ventoy_disk_mbr 0 $LOOP fdisk
 
 $GRUB_DIR/sbin/grub-bios-setup  --skip-fs-probe  --directory="./grub/i386-pc"  $LOOP
 
@@ -48,21 +76,59 @@ mount ${LOOP}p2  $tmpmnt
 mkdir -p $tmpmnt/grub
 
 # First copy grub.cfg file, to make it locate at front of the part2
-cp -a ./grub/grub.cfg     $tmpmnt/grub/
+cp $OPT ./grub/grub.cfg     $tmpmnt/grub/
 
 ls -1 ./grub/ | grep -v 'grub\.cfg' | while read line; do
-    cp -a ./grub/$line $tmpmnt/grub/
+    cp $OPT ./grub/$line $tmpmnt/grub/
 done
 
-cp -a ./ventoy   $tmpmnt/
-cp -a ./EFI   $tmpmnt/
-cp -a ./tool/ENROLL_THIS_KEY_IN_MOKMANAGER.cer $tmpmnt/
+#tar help txt
+cd $tmpmnt/grub/
+tar czf help.tar.gz ./help/
+rm -rf ./help
+cd ../../
+
+#tar menu txt & update menulang.cfg
+cd $tmpmnt/grub/
+
+vtlangtitle=$(grep VTLANG_LANGUAGE_NAME menu/zh_CN.json | awk -F\" '{print $4}')
+echo "menuentry \"zh_CN  -  $vtlangtitle\" --class=menu_lang_item --class=debug_menu_lang --class=F5tool {" >> menulang.cfg
+echo "    vt_load_menu_lang zh_CN"  >> menulang.cfg
+echo "}"  >> menulang.cfg
+
+ls -1 menu/ | grep -v 'zh_CN' | sort | while read vtlang; do
+    vtlangname=${vtlang%.*}
+    vtlangtitle=$(grep VTLANG_LANGUAGE_NAME menu/$vtlang | awk -F\" '{print $4}')
+    echo "menuentry \"$vtlangname  -  $vtlangtitle\" --class=menu_lang_item --class=debug_menu_lang --class=F5tool {" >> menulang.cfg
+    echo "    vt_load_menu_lang $vtlangname"  >> menulang.cfg
+    echo "}"  >> menulang.cfg
+done
+echo "menuentry \"\$VTLANG_RETURN_PREVIOUS\" --class=vtoyret VTOY_RET {" >> menulang.cfg
+echo "        echo \"Return ...\"" >> menulang.cfg
+echo "}" >> menulang.cfg
+
+tar czf menu.tar.gz ./menu/
+rm -rf ./menu
+cd ../../
+
+
+
+cp $OPT ./ventoy   $tmpmnt/
+cp $OPT ./EFI   $tmpmnt/
+cp $OPT ./tool/ENROLL_THIS_KEY_IN_MOKMANAGER.cer $tmpmnt/
 
 
 mkdir -p $tmpmnt/tool
-cp -a ./tool/mount*     $tmpmnt/tool/
+# 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
+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
+
 
-rm -f $tmpmnt/grub/i386-pc/*
+rm -f $tmpmnt/grub/i386-pc/*.img
 
 
 umount $tmpmnt && rm -rf $tmpmnt
@@ -76,44 +142,133 @@ 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
 
-cp -a ./tool $tmpdir/
-cp -a Ventoy2Disk.sh $tmpdir/
-cp -a CreatePersistentImg.sh $tmpdir/
+cp $OPT ./tool $tmpdir/
+rm -f $tmpdir/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
+cp $OPT Ventoy2Disk.sh $tmpdir/
+cp $OPT VentoyWeb.sh $tmpdir/
+cp $OPT VentoyPlugson.sh $tmpdir/
+cp $OPT VentoyVlnk.sh $tmpdir/
+cp $OPT VentoyGUI* $tmpdir/
+
+
+cp $OPT README $tmpdir/
+cp $OPT plugin $tmpdir/
+cp $OPT CreatePersistentImg.sh $tmpdir/
+cp $OPT ExtendPersistentImg.sh $tmpdir/
 dos2unix -q $tmpdir/Ventoy2Disk.sh
+dos2unix -q $tmpdir/VentoyWeb.sh
+dos2unix -q $tmpdir/VentoyPlugson.sh
+dos2unix -q $tmpdir/VentoyVlnk.sh
+
+
 dos2unix -q $tmpdir/CreatePersistentImg.sh
+dos2unix -q $tmpdir/ExtendPersistentImg.sh
+
+cp $OPT ../LinuxGUI/WebUI $tmpdir/
+sed 's/.*SCRIPT_DEL_THIS \(.*\)/\1/g' -i $tmpdir/WebUI/index.html
 
 #32MB disk img
 dd status=none if=$LOOP of=$tmpdir/ventoy/ventoy.disk.img bs=512 count=$VENTOY_SECTOR_NUM skip=$part2_start_sector
+
+
+#4k image
+# echo "make 4K img ..."
+# dd status=none if=/dev/zero of=$tmpdir/ventoy/ventoy_4k.disk.img bs=1M count=32
+# mkfs.vfat -F 16 -n VTOYEFI -s 1 -S 4096 $tmpdir/ventoy/ventoy_4k.disk.img
+# vDIR1=$(mktemp -d)
+# vDIR2=$(mktemp -d)
+# mount $tmpdir/ventoy/ventoy.disk.img $vDIR1
+# mount $tmpdir/ventoy/ventoy_4k.disk.img $vDIR2
+# cp -a $vDIR1/* $vDIR2/
+# umount $vDIR1
+# umount $vDIR2
+# rm -rf $vDIR1 $vDIR2
+
+# xz --check=crc32 $tmpdir/ventoy/ventoy_4k.disk.img
+
 xz --check=crc32 $tmpdir/ventoy/ventoy.disk.img
 
+
+
 losetup -d $LOOP && rm -f img.bin
 
 rm -f ventoy-${curver}-linux.tar.gz
 
 
 CurDir=$PWD
-cd $tmpdir/tool
 
-for file in $(ls); do
-    if [ "$file" != "xzcat" ] && [ "$file" != "ventoy_lib.sh" ]; then
-        xz --check=crc32 $file
-    fi
+for d in i386 x86_64 aarch64 mips64el; do
+    cd $tmpdir/tool/$d
+    for file in $(ls); do
+        if [ "$file" != "xzcat" ]; then
+            if echo "$file" | grep -q '^Ventoy2Disk'; then
+                chmod +x $file
+            else
+                xz --check=crc32 $file
+            fi
+        fi
+    done
+    cd $CurDir
 done
 
-cd $CurDir
+#chmod 
+find $tmpdir/ -type d -exec chmod 755 "{}" +
+find $tmpdir/ -type f -exec chmod 644 "{}" +
+chmod +x $tmpdir/Ventoy2Disk.sh
+chmod +x $tmpdir/VentoyWeb.sh
+chmod +x $tmpdir/VentoyPlugson.sh
+chmod +x $tmpdir/VentoyVlnk.sh
+chmod +x $tmpdir/VentoyGUI*
+chmod +x $tmpdir/tool/*.sh
+
+for d in i386 x86_64 aarch64 mips64el; do
+    chmod +x $tmpdir/tool/$d/xzcat
+    chmod +x $tmpdir/tool/$d/Ventoy2Disk.*
+done
+
+
+cp $OPT $LANG_DIR/languages.json $tmpdir/tool/
+
+
+chmod +x $tmpdir/CreatePersistentImg.sh
+chmod +x $tmpdir/ExtendPersistentImg.sh
+
 tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir
 
+
+
 rm -f ventoy-${curver}-windows.zip
-cp -a Ventoy2Disk.exe $tmpdir/
-cp -a $LANG_DIR/languages.ini $tmpdir/ventoy/
+
+cp $OPT Ventoy2Disk.exe $tmpdir/
+cp $OPT VentoyPlugson.exe $tmpdir/
+cp $OPT VentoyVlnk.exe $tmpdir/
+cp $OPT FOR_X64_ARM.txt $tmpdir/
+mkdir -p $tmpdir/altexe
+cp $OPT Ventoy2Disk_*.exe $tmpdir/altexe/
+cp $OPT VentoyPlugson_*.exe $tmpdir/altexe/
+
+
+
+cp $OPT $tmpdir/tool/plugson.tar.xz $tmpdir/ventoy/
+cp $OPT $LANG_DIR/languages.json $tmpdir/ventoy/
 rm -rf $tmpdir/tool
 rm -f $tmpdir/*.sh
+rm -f $tmpdir/VentoyGUI.*
+rm -rf $tmpdir/WebUI
+rm -f $tmpdir/README
 
 
 zip -r ventoy-${curver}-windows.zip $tmpdir/
 
 rm -rf $tmpdir
 
+echo "=============== run livecd.sh ==============="
+cd ../LiveCDGUI
+sh livecd.sh $1
+cd $CurDir
+
+mv ../LiveCDGUI/ventoy*.iso ./
+
 if [ -e ventoy-${curver}-windows.zip ] && [ -e ventoy-${curver}-linux.tar.gz ]; then
     echo -e "\n ============= SUCCESS =================\n"
 else
@@ -122,4 +277,6 @@ else
 fi
 
 rm -f log.txt
+rm -f sha256.txt
+sha256sum ventoy-${curver}-* > sha256.txt