Last active
January 26, 2024 12:50
-
-
Save yucellmustafa/c79ef02f74c3e9c93af2f9759c8d8550 to your computer and use it in GitHub Desktop.
Ventoy Installer for Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repo=github.com/repos/ventoy/Ventoy | |
link=$(curl -s https://api.$repo/releases/latest | jq -r ".assets[] | select(.name | test(\"linux\")) | .browser_download_url") | |
version=$(curl -s https://api.$repo/releases/latest | jq -r ".tag_name") | |
file=ventoy-$version | |
arch=$(uname -m) | |
download() { | |
if [ ! -f $file.tar.gz ]; then | |
echo "Downloading $file.tar.gz..." | |
curl -L $link -o $file.tar.gz | |
fi | |
} | |
install() { | |
download | |
echo "Installing $file..." | |
tar -xzf $file.tar.gz | |
rm -rf $file.tar.gz | |
sudo mv ./ventoy-* /opt/$file | |
echo "#!/bin/bash | |
/opt/$file/VentoyGUI.$arch" | sudo tee /usr/bin/ventoy | |
sudo chmod +x /usr/bin/ventoy | |
sudo echo "[Desktop Entry] | |
Name=Ventoy | |
Comment=Ventoy GUI | |
Exec=ventoy | |
Icon=ventoy | |
Terminal=false | |
Type=Application" | sudo tee /usr/share/applications/ventoy.desktop | |
sudo chmod +x /usr/share/applications/ventoy.desktop | |
} | |
remove() { | |
echo "Removing ventoy..." | |
sudo rm -rf /usr/bin/ventoy /usr/share/applications/ventoy.desktop /opt/ventoy* | |
} | |
update() { | |
echo "Updating $(echo /opt/ventoy*) to $file..." | |
remove && install | |
} | |
while getopts ":i?r?u?" options; do | |
case "${options}" in | |
i) if [ ! -d /opt/ventoy* ]; then | |
install | |
fi ;; | |
r) if [ -d /opt/ventoy* ]; then | |
remove | |
fi ;; | |
u) if [ /opt/$file != /opt/ventoy* ]; then | |
update | |
fi ;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ventoy Install Script
sudo chmod +x ./ventoy_install.sh
./ventoy_install.sh -i
./ventoy_install.sh -r
./ventoy_install.sh -u