wok view ventoy/stuff/TazVentoyPlugson.sh @ rev 25284
roundup: added BUILD_DEPENDS
author | Hans-G?nter Theisgen |
---|---|
date | Mon Jul 18 16:14:38 2022 +0100 (2022-07-18) |
parents | dbc597fbeee5 |
children |
line source
1 #!/bin/sh
3 case "$1" in
4 -*) echo "Usage: $0 [device] [ip] [port]" && exit 1
5 esac
7 [ $(id -u) -ne 0 ] && exec tazbox su $0 $@
9 cd $(dirname $0)
10 dev="${1:-$(blkid | sed '/Ventoy/!d;s|:.*||;q')}"
11 DISK=${dev%[0-9]*}; DISK=${DISK%p}
12 HOST="${2:-127.0.0.1}:${3:-24681}"
13 fstype="$(blkid $dev | sed 's|.* TYPE="||;s|".*||')"
14 case "$fstype" in
15 exfat) fstype="exFAT";;
16 ntfs) fstype="NTFS";;
17 esac
18 mkdir /tmp/mnt$$
19 mount ${dev/1/2} /tmp/mnt$$
20 version="$(sed '/VERSION=/!d;s|.*="||;s|"||' /tmp/mnt$$/grub/grub.cfg)"
21 [ -e /tmp/mnt$$/EFI/BOOT/grubx64_real.efi ] && secureboot=1 || secureboot=0
22 umount /tmp/mnt$$
23 blkid $DISK | grep -q 'PTTYPE="gpt"' && partstyle=1 || partstyle=0
24 echo PATH=$(dirname $0)/tool/i386:$PATH Plugson ${HOST/:/ } $(dirname $0) "$DISK" $version "$fstype" $partstyle $secureboot > VentoyPlugson.log
25 mount $dev /tmp/mnt$$
26 cd /tmp/mnt$$
27 mkdir ventoy 2> /dev/null || true
29 PATH=$(dirname $0)/tool/i386:$PATH Plugson ${HOST/:/ } $(dirname $0) "$DISK" $version "$fstype" $partstyle $secureboot &
30 sleep 1
32 tazweb --notoolbar http://$HOST/ || browser http://$HOST/
33 kill %1
34 while !umount /tmp/mnt$$ 2> /dev/null; do sleep 1; done && rmdir /tmp/mnt$$