-DISK=$2
-
-if ! [ -b "$DISK" ]; then
- vterr "Disk $DISK does not exist"
- exit 1
-fi
-
-
-if [ -e /sys/class/block/${DISK#/dev/}/start ]; then
- vterr "$DISK is a partition, please use the whole disk"
- exit 1
-fi
-
-if grep "$DISK" /proc/mounts; then
- vterr "$DISK is already mounted, please umount it first!"
- exit 1
-fi
-
-
-if [ "$MODE" = "install" ]; then
- vtdebug "install ventoy ..."
-
- if ! fdisk -v >/dev/null 2>&1; then
- vterr "fdisk is needed by ventoy installation, but is not found in the system."
- exit 1
- fi
-
- version=$(get_disk_ventoy_version $DISK)
- if [ $? -eq 0 ]; then
- if [ -z "$FORCE" ]; then
- vtwarn "$DISK already contains a Ventoy with version $version"
- vtwarn "Use -u option to do a safe upgrade operation."
- vtwarn "OR if you really want to reinstall ventoy to $DISK, please use -I option."
- vtwarn ""
- exit 1
- fi
- fi
-
- disk_sector_num=$(cat /sys/block/${DISK#/dev/}/size)
- disk_size_gb=$(expr $disk_sector_num / 2097152)
-
- if [ $disk_sector_num -gt 4294967296 ]; then
- vterr "$DISK is over 2TB size, MBR will not work on it."
- exit 1
- fi
-
- #Print disk info
- echo "Disk : $DISK"
- parted -s $DISK p 2>&1 | grep Model
- echo "Size : $disk_size_gb GB"
- echo ''
-
- vtwarn "Attention:"
- vtwarn "You will install Ventoy to $DISK."
- vtwarn "All the data on the disk $DISK will be lost!!!"
- echo ""
-
- read -p 'Continue? (y/n)' Answer
- if [ "$Answer" != "y" ]; then
- if [ "$Answer" != "Y" ]; then
- exit 0
- fi
- fi
-
- echo ""
- vtwarn "All the data on the disk $DISK will be lost!!!"
- read -p 'Double-check. Continue? (y/n)' Answer
- if [ "$Answer" != "y" ]; then
- if [ "$Answer" != "Y" ]; then
- exit 0
+#decompress tool
+if ! [ -f ./tool/ash ]; then
+ cd tool
+ chmod +x ./xzcat
+ for file in $(ls *.xz); do
+ ./xzcat $file > ${file%.xz}
+ chmod +x ${file%.xz}
+ done
+ cd ../
+
+ if ! [ -f ./tool/ash ]; then
+ echo 'Failed to decompress tools ...'
+ if [ -n "$OLDDIR" ]; then
+ cd $OLDDIR