]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - INSTALL/VentoyWeb.sh
4 echo 'Usage: VentoyWeb.sh [ OPTION ]'
5 echo ' OPTION: (optional)'
6 echo ' -H x.x.x.x http server IP address (default is 127.0.0.1)'
7 echo ' -p PORT http server PORT (default is 24680)'
8 echo ' -h print this help'
19 if [ $uid -ne 0 ]; then
20 print_err
"Please use sudo or run the script as root."
26 if uname
-m | grep -E -q 'aarch64|arm64'; then
28 elif uname
-m | grep -E -q 'x86_64|amd64'; then
30 elif uname
-m | grep -E -q 'mips64'; then
36 if [ ! -f .
/tool
/$TOOLDIR/V2DServer
]; then
37 if [ -f ${0%VentoyWeb.sh}/tool
/$TOOLDIR/V2DServer
]; then
42 PATH
=.
/tool
/$TOOLDIR:$PATH
44 if [ ! -f .
/boot
/boot.img
]; then
45 if [ -d .
/grub
]; then
46 echo "Don't run VentoyWeb.sh here, please download the released install package, and run the script in it."
48 echo "Current directory is $PWD"
49 echo "Please run under the correct directory!"
58 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
61 elif [ "$1" = "-H" ]; then
63 if echo $1 | grep -q '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'; then
66 print_err
"Invalid host $1"
69 elif [ "$1" = "-p" ]; then
71 if [ $1 -gt 0 -a $1 -le 65535 ]; then
74 print_err
"Invalid port $1"
83 if ps
-ef | grep "V2DServer.*$HOST.*$PORT" | grep -q -v grep; then
84 print_err
"Another ventoy server is running now, please close it first."
89 #delete the log.txt if it's more than 8MB
90 if [ -f $LOGFILE ]; then
91 logsize
=$(stat -c '%s' $LOGFILE)
92 if [ $logsize -gt 8388608 ]; then
98 if [ -f .
/tool
/$TOOLDIR/V2DServer.xz
]; then
99 xz
-d .
/tool
/$TOOLDIR/V2DServer.xz
100 chmod +x .
/tool
/$TOOLDIR/V2DServer
104 V2DServer
"$HOST" "$PORT" &
108 vtVer
=$(cat ventoy/version)
110 echo "==============================================================="
111 if [ "$LANG" = "zh_CN.UTF-8" ]; then
112 echo " Ventoy Server $vtVer 已经启动 ..."
113 echo " 请打开浏览器,访问 http://${HOST}:${PORT}"
115 echo " Ventoy Server $vtVer is running ..."
116 echo " Please open your browser and visit http://${HOST}:${PORT}"
118 echo "==============================================================="
120 echo "################## Press Ctrl + C to exit #####################"
125 if [ -n "$OLDDIR" ]; then
127 if [ "$CURDIR" != "$OLDDIR" ]; then