ventoy 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. APP=ventoy
  3. SITE="ventoy/Ventoy"
  4. # CREATE THE FOLDER
  5. mkdir /opt/$APP
  6. cd /opt/$APP
  7. # ADD THE REMOVER
  8. echo '#!/bin/sh' >> /opt/$APP/remove
  9. echo "rm -R -f /usr/local/share/applications/$APP-AM.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove
  10. chmod a+x /opt/$APP/remove
  11. # DOWNLOAD THE ARCHIVE
  12. mkdir tmp
  13. cd ./tmp
  14. version=$(curl -Ls https://api.github.com/repos/ventoy/Ventoy/releases | grep browser_download_url | grep -i linux.tar.gz | cut -d '"' -f 4 | head -1)
  15. wget $version
  16. echo "$version" >> /opt/$APP/version
  17. tar fx ./*; rm -R -f ./*tar*
  18. cd ..
  19. mv --backup=t ./tmp/ventoy-*/* ./
  20. rm -R -f ./tmp
  21. # SCRIPT TO LAUNCH THE PROGRAM
  22. echo '#!/bin/sh
  23. exec /opt/'$APP'/VentoyGUI.aarch64' >> /usr/local/bin/$APP
  24. chmod a+x /usr/local/bin/$APP
  25. # SCRIPT TO UPDATE THE PROGRAM
  26. cat >> /opt/$APP/AM-updater << 'EOF'
  27. #!/usr/bin/env bash
  28. APP=ventoy
  29. version0=$(cat /opt/$APP/version)
  30. version=$(curl -Ls https://api.github.com/repos/ventoy/Ventoy/releases | grep browser_download_url | grep -i linux.tar.gz | cut -d '"' -f 4 | head -1)
  31. if [ $version = $version0 ]; then
  32. echo "Update not needed!"
  33. else
  34. notify-send "A new version of $APP is available, please wait"
  35. mkdir /opt/$APP/tmp
  36. cd /opt/$APP/tmp
  37. wget $version
  38. tar fx ./*; rm -R -f ./*tar*
  39. cd ..
  40. mv --backup=t ./tmp/ventoy-*/* ./
  41. rm ./version
  42. echo $version >> ./version
  43. rm -R -f ./tmp ./*~
  44. notify-send "$APP is updated!"
  45. fi
  46. EOF
  47. chmod a+x /opt/$APP/AM-updater
  48. # ICON
  49. mkdir icons
  50. wget https://www.ventoy.net/static/img/ventoy.png -O ./icons/$APP 2> /dev/null
  51. # LAUNCHER
  52. rm -f /usr/local/share/applications/$APP-AM.desktop
  53. echo "[Desktop Entry]
  54. Name=Ventoy
  55. Comment=Open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files.
  56. Exec=$APP
  57. Icon=/opt/$APP/icons/$APP
  58. Type=Application
  59. Categories=System;" >> /usr/local/share/applications/$APP-AM.desktop