]>
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
30 elif uname
-m | egrep -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 "Please run under the correct directory!"
57 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
60 elif [ "$1" = "-H" ]; then
62 if echo $1 | grep -q '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'; then
65 print_err
"Invalid host $1"
68 elif [ "$1" = "-p" ]; then
70 if [ $1 -gt 0 -a $1 -le 65535 ]; then
73 print_err
"Invalid port $1"
82 if ps
-ef | grep "V2DServer.*$HOST.*$PORT" | grep -q -v grep; then
83 print_err
"Another ventoy server is running now, please close it first."
88 #delete the log.txt if it's more than 8MB
89 if [ -f $LOGFILE ]; then
90 logsize
=$(stat -c '%s' $LOGFILE)
91 if [ $logsize -gt 8388608 ]; then
97 if [ -f .
/tool
/$TOOLDIR/V2DServer.xz
]; then
98 xz
-d .
/tool
/$TOOLDIR/V2DServer.xz
99 chmod +x .
/tool
/$TOOLDIR/V2DServer
103 V2DServer
"$HOST" "$PORT" &
107 vtVer
=$(cat ventoy/version)
109 echo "==============================================================="
110 if [ "$LANG" = "zh_CN.UTF-8" ]; then
111 echo " Ventoy Server $vtVer 已经启动 ..."
112 echo " 请打开浏览器,访问 http://${HOST}:${PORT}"
114 echo " Ventoy Server $vtVer is running ..."
115 echo " Please open your browser and visit http://${HOST}:${PORT}"
117 echo "==============================================================="
119 echo "################## Press Ctrl + C to exit #####################"
124 if [ -n "$OLDDIR" ]; then
126 if [ "$CURDIR" != "$OLDDIR" ]; then