VentoyPlugson ---- A GUI ventoy.json configurator

This commit is contained in:
longpanda
2021-12-01 20:43:35 +08:00
parent 9eeb94e8b5
commit 4bf43ab9d4
227 changed files with 67510 additions and 33 deletions

View File

@@ -22,6 +22,11 @@ Please refer https://www.ventoy.net/en/doc_start.html for details.
2. open your browser and visit http://127.0.0.1:24680
========== VentoyPlugson.sh ===============
1. sudo sh VentoyPlugson.sh
2. open your browser and visit http://127.0.0.1:24681
========= VentoyGUI ===================
VentoyGUI is native GUI program for Linux (GTK/QT)
1. Just double-click the file (e.g. VentoyGUI.x86_64)

Binary file not shown.

View File

@@ -46,23 +46,25 @@ echo "############# Ventoy2Disk $* [$TOOLDIR] ################" >> ./log.txt
date >> ./log.txt
#decompress tool
if [ -f ./tool/$TOOLDIR/ash ]; then
echo "no need to decompress tools" >> ./log.txt
else
cd ./tool/$TOOLDIR
echo "decompress tools" >> ./log.txt
cd ./tool/$TOOLDIR
ls *.xz > /dev/null 2>&1
if [ $? -eq 0 ]; then
[ -f ./xzcat ] && chmod +x ./xzcat
for file in $(ls *.xz); do
echo "decompress $file" >> ./log.txt
xzcat $file > ${file%.xz}
[ -f ./${file%.xz} ] && chmod +x ./${file%.xz}
[ -f ./$file ] && rm -f ./$file
done
cd ../../
chmod +x -R ./tool/$TOOLDIR
fi
cd ../../
chmod +x -R ./tool/$TOOLDIR
if [ -f /bin/bash ]; then
/bin/bash ./tool/VentoyWorker.sh $*
else

Binary file not shown.

Binary file not shown.

Binary file not shown.

218
INSTALL/VentoyPlugson.sh Normal file
View File

@@ -0,0 +1,218 @@
#!/bin/sh
. ./tool/ventoy_lib.sh
print_usage() {
echo 'Usage: sudo sh VentoyPlugson.sh [OPTION] /dev/sdX'
echo ' OPTION: (optional)'
echo ' -H x.x.x.x http server IP address (default is 127.0.0.1)'
echo ' -P PORT http server PORT (default is 24681)'
echo ' -h print this help'
echo ''
}
uid=$(id -u)
if [ $uid -ne 0 ]; then
echo "Please use sudo or run the script as root."
exit 1
fi
OLDDIR=$(pwd)
machine=$(uname -m)
if echo $machine | egrep -q 'aarch64|arm64'; then
TOOLDIR=aarch64
elif echo $machine | egrep -q 'x86_64|amd64'; then
TOOLDIR=x86_64
elif echo $machine | egrep -q 'mips64'; then
TOOLDIR=mips64el
elif echo $machine | egrep -q 'i[3-6]86'; then
TOOLDIR=i386
else
echo "Unsupported machine type $machine"
exit 1
fi
if ! [ -f "$OLDDIR/tool/plugson.tar.xz" ]; then
echo "Please run under the correct directory!"
exit 1
fi
echo "############# VentoyPlugson $* [$TOOLDIR] ################" >> ./VentoyPlugson.log
date >> ./VentoyPlugson.log
echo "decompress tools" >> ./VentoyPlugson.log
cd ./tool/$TOOLDIR
ls *.xz > /dev/null 2>&1
if [ $? -eq 0 ]; then
[ -f ./xzcat ] && chmod +x ./xzcat
for file in $(ls *.xz); do
echo "decompress $file" >> ./VentoyPlugson.log
xzcat $file > ${file%.xz}
[ -f ./${file%.xz} ] && chmod +x ./${file%.xz}
[ -f ./$file ] && rm -f ./$file
done
fi
cd ../../
chmod +x -R ./tool/$TOOLDIR
if ! [ -f "$OLDDIR/tool/$TOOLDIR/Plugson" ]; then
echo "$OLDDIR/tool/$TOOLDIR/Plugson does not exist!"
exit 1
fi
PATH=./tool/$TOOLDIR:$PATH
HOST="127.0.0.1"
PORT=24681
while [ -n "$1" ]; do
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
print_usage
exit 0
elif [ "$1" = "-H" ]; then
shift
if echo $1 | grep -q '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'; then
HOST="$1"
else
echo "Invalid host $1"
exit 1
fi
elif [ "$1" = "-P" ]; then
shift
if [ $1 -gt 0 -a $1 -le 65535 ]; then
PORT="$1"
else
echo "Invalid port $1"
exit 1
fi
else
DISK=$1
fi
shift
done
if [ -z "$DISK" ]; then
print_usage
exit 0
fi
if ps -ef | grep "tool/$TOOLDIR/Plugson.*$HOST.*$PORT" | grep -q -v grep; then
echo "Another ventoy server is running now, please close it first."
exit 1
fi
if echo $DISK | grep -q "[a-z]d[a-z][1-9]"; then
DISK=${DISK:0:-1}
fi
if echo $DISK | egrep -q "/dev/nvme|/dev/mmcblk/dev/nbd"; then
if echo $DISK | grep -q "p[1-9]$"; then
DISK=${DISK:0:-2}
fi
fi
if [ ! -b "$DISK" ]; then
echo "$DISK does NOT exist."
exit 1
fi
version=$(get_disk_ventoy_version $DISK)
if [ $? -eq 0 ]; then
echo "Ventoy version in Disk: $version"
vtPart1Type=$(dd if=$DISK bs=1 count=1 skip=450 status=none | hexdump -n1 -e '1/1 "%02X"')
if [ "$vtPart1Type" = "EE" ]; then
echo "Disk Partition Style : GPT"
partstyle=1
else
echo "Disk Partition Style : MBR"
partstyle=0
fi
if check_disk_secure_boot $DISK; then
echo "Secure Boot Support : YES"
secureboot=1
else
echo "Secure Boot Support : NO"
secureboot=0
fi
else
echo "$DISK is NOT Ventoy disk."
exit 1
fi
PART1=$(get_disk_part_name $DISK 1)
if grep -q "^$PART1 " /proc/mounts; then
mtpnt=$(grep "^$PART1 " /proc/mounts | awk '{print $2}')
fstype=$(grep "^$PART1 " /proc/mounts | awk '{print $3}')
if echo $fstype | grep -q -i 'fuse'; then
if hexdump -C -n 16 $PART1 | grep -q -i "EXFAT"; then
fstype="exFAT"
elif hexdump -C -n 16 $PART1 | grep -q -i "NTFS"; then
fstype="NTFS"
fi
fi
echo "$PART1 is mounted at $mtpnt $fstype"
else
echo "$PART1 is NOT mounted, please mount it first!"
exit 1
fi
if [ -d "$mtpnt/ventoy" ]; then
echo "ventoy directory exist OK"
else
echo "create ventoy directory"
mkdir -p "$mtpnt/ventoy"
if [ -d "$mtpnt/ventoy" ]; then
chmod -R 0755 "$mtpnt/ventoy"
else
echo "Failed to create directory $mtpnt/ventoy"
exit 1
fi
fi
#change current directory to Ventoy disk
cd "$mtpnt"
LANG=en_US $OLDDIR/tool/$TOOLDIR/Plugson "$HOST" "$PORT" "$OLDDIR" "$DISK" $version "$fstype" $partstyle $secureboot &
wID=$!
sleep 1
if [ -f /proc/$wID/maps ]; then
echo ""
echo "==============================================================="
if [ "$LANG" = "zh_CN.UTF-8" ]; then
echo " Ventoy Plugson Server 已经启动 ..."
echo " 请打开浏览器,访问 http://${HOST}:${PORT}"
else
echo " Ventoy Plugson Server is running ..."
echo " Please open your browser and visit http://${HOST}:${PORT}"
fi
echo "==============================================================="
echo ""
echo "################## Press Ctrl + C to exit #####################"
echo ""
wait $wID
fi
if [ -n "$OLDDIR" ]; then
CURDIR=$(pwd)
if [ "$CURDIR" != "$OLDDIR" ]; then
cd "$OLDDIR"
fi
fi

View File

@@ -36,6 +36,11 @@ sh language.sh || exit 1
sh build.sh
cd -
cd ../Plugson
sh build.sh
sh pack.sh
cd -
LOOP=$(losetup -f)
@@ -112,6 +117,7 @@ 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 VentoyGUI* $tmpdir/
@@ -121,6 +127,7 @@ 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/CreatePersistentImg.sh
@@ -159,6 +166,7 @@ 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/VentoyGUI*
cp $OPT $LANG_DIR/languages.json $tmpdir/tool/
@@ -174,6 +182,7 @@ tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir
rm -f ventoy-${curver}-windows.zip
cp $OPT Ventoy2Disk.exe $tmpdir/
cp $OPT VentoyPlugson.exe $tmpdir/
cp $OPT FOR_X64_ARM.txt $tmpdir/
mkdir -p $tmpdir/altexe
cp $OPT Ventoy2Disk_*.exe $tmpdir/altexe/