Ventoy2Disk.sh 1.2 KB
Newer Older
longpanda's avatar
longpanda committed
1
2
3
4
5
6
7
8
9
10
#!/bin/sh


echo ''
echo '***********************************************************'
echo '*                Ventoy2Disk Script                       *'
echo '*             longpanda  admin@ventoy.net                 *'
echo '***********************************************************'
echo ''

11
OLDDIR=$PWD
longpanda's avatar
longpanda committed
12

13
14
15
if ! [ -f ./tool/xzcat ]; then
    if [ -f ${0%Ventoy2Disk.sh}/tool/xzcat ]; then
        cd ${0%Ventoy2Disk.sh}    
longpanda's avatar
longpanda committed
16
    fi
longpanda's avatar
longpanda committed
17
18
fi

longpanda's avatar
longpanda committed
19
20
if ! [ -f ./boot/boot.img ]; then
    if [ -d ./grub ]; then
21
        echo "Don't run Ventoy2Disk.sh here, please download the released install package, and run the script in it."
longpanda's avatar
longpanda committed
22
    else
23
        echo "Please run under the correct directory!" 
longpanda's avatar
longpanda committed
24
    fi
longpanda's avatar
longpanda committed
25
26
27
    exit 1
fi

28
echo "############# Ventoy2Disk $* ################" >> ./log.txt
longpanda's avatar
longpanda committed
29

30
31
32
33
34
35
36
#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}
longpanda's avatar
longpanda committed
37
    done
38
    cd ../
longpanda's avatar
longpanda committed
39

40
41
    if ! [ -f ./tool/ash ]; then
        echo 'Failed to decompress tools ...'
longpanda's avatar
longpanda committed
42
43
44
        if [ -n "$OLDDIR" ]; then 
            cd $OLDDIR
        fi
longpanda's avatar
longpanda committed
45
46
47
48
        exit 1
    fi
fi

49
50
./tool/ash ./tool/VentoyWorker.sh $*

longpanda's avatar
longpanda committed
51
52
53
54
if [ -n "$OLDDIR" ]; then 
    cd $OLDDIR
fi

55