appimagetool 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/sh
  2. APP=appimagetool
  3. # CREATE THE FOLDER
  4. mkdir /opt/$APP
  5. cd /opt/$APP
  6. # ADD THE REMOVER
  7. echo '#!/bin/sh' >> /opt/$APP/remove
  8. echo "rm -R -f /opt/$APP /usr/bin/$APP" >> /opt/$APP/remove
  9. chmod a+x /opt/$APP/remove
  10. # DOWNLOAD THE APPIMAGE
  11. mkdir tmp
  12. cd ./tmp
  13. wget https://github.com/$(wget https://github.com/AppImage/AppImageKit/releases/latest | grep -E '/.*/.*/.*aarch64.AppImage' -o);
  14. version=$(ls /opt/$APP/tmp)
  15. echo "$version" >> /opt/$APP/version
  16. cd ..
  17. mv ./tmp/*mage ./$APP
  18. chmod a+x /opt/$APP/$APP
  19. rmdir ./tmp
  20. # LINK
  21. ln -s /opt/$APP/$APP /usr/bin/$APP
  22. # SCRIPT TO UPDATE THE PROGRAM
  23. echo '#!/bin/sh' >> /opt/$APP/AM-updater
  24. echo "APP=$APP" >> /opt/$APP/AM-updater
  25. echo "cd /opt/$APP" /usr/local/bin/$APP
  26. echo 'version0=$(cat /opt/$APP/version)
  27. url=https://github.com/AppImage/AppImageKit/releases/latest' >> /opt/$APP/AM-updater
  28. echo 'if curl -L -s $url | grep -ioF "$version0"; then' >> /opt/$APP/AM-updater
  29. echo ' echo "Update not needed!".' >> /opt/$APP/AM-updater
  30. echo 'else' >> /opt/$APP/AM-updater
  31. echo " notify-send 'A new version of $APP is available, please wait'" >> /opt/$APP/AM-updater
  32. echo " mkdir /opt/$APP/tmp
  33. cd /opt/$APP/tmp" >> /opt/$APP/AM-updater
  34. ########################################################################################
  35. function1='$(wget https://github.com/AppImage/AppImageKit/releases/latest -O -'
  36. function2="grep -E '/.*/.*/.*aarch64.AppImage' -o)"
  37. function3='$(ls /opt/$APP/tmp)'
  38. echo " wget https://github.com/$function1 | $function2
  39. version=$function3" >> /opt/$APP/AM-updater
  40. ########################################################################################
  41. echo ' cd ..
  42. if test -f ./tmp/*mage; then rm ./version
  43. fi
  44. echo "$version" >> ./version' >> /opt/$APP/AM-updater
  45. echo " mv ./tmp/*mage ./$APP
  46. chmod a+x /opt/$APP/$APP
  47. rmdir ./tmp
  48. fi" >> /opt/$APP/AM-updater
  49. chmod a+x /opt/$APP/AM-updater