]>
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 | egrep -q 'aarch64|arm64'; then
28 elif uname
-m | egrep -q 'x86_64|amd64'; then
34 if [ ! -f .
/tool
/$TOOLDIR/V2DServer
]; then
35 if [ -f ${0%VentoyWeb.sh}/tool
/$TOOLDIR/V2DServer
]; then
40 PATH
=.
/tool
/$TOOLDIR:$PATH
42 if [ ! -f .
/boot
/boot.img
]; then
43 if [ -d .
/grub
]; then
44 echo "Don't run VentoyWeb.sh here, please download the released install package, and run the script in it."
46 echo "Please run under the correct directory!"
55 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
58 elif [ "$1" = "-H" ]; then
60 if echo $1 | grep -q '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'; then
63 print_err
"Invalid host $1"
66 elif [ "$1" = "-p" ]; then
68 if [ $1 -gt 0 -a $1 -le 65535 ]; then
71 print_err
"Invalid port $1"
80 if ps
-ef | grep "V2DServer.*$HOST.*$PORT" | grep -q -v grep; then
81 print_err
"Another ventoy server is running now, please close it first."
86 #delete the log.txt if it's more than 8MB
87 if [ -f $LOGFILE ]; then
88 logsize
=$(stat -c '%s' $LOGFILE)
89 if [ $logsize -gt 8388608 ]; then
95 if [ -f .
/tool
/$TOOLDIR/V2DServer.xz
]; then
96 xz
-d .
/tool
/$TOOLDIR/V2DServer.xz
97 chmod +x .
/tool
/$TOOLDIR/V2DServer
101 V2DServer
"$HOST" "$PORT" &
105 vtVer
=$(cat ventoy/version)
107 echo "==============================================================="
108 if [ "$LANG" = "zh_CN.UTF-8" ]; then
109 echo " Ventoy Server $vtVer 已经启动 ..."
110 echo " 请打开浏览器,访问 http://${HOST}:${PORT}"
112 echo " Ventoy Server $vtVer is running ..."
113 echo " Please open your browser and visit http://${HOST}:${PORT}"
115 echo "==============================================================="
117 echo "################## Press Ctrl + C to exit #####################"
122 if [ -n "$OLDDIR" ]; then
124 if [ "$CURDIR" != "$OLDDIR" ]; then