AM-SAMPLE-for-appimageupdate 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/sh
  2. APP=SAMPLE
  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 /usr/share/applications/AM-$APP.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove
  9. chmod a+x /opt/$APP/remove
  10. # DOWNLOAD THE APPIMAGE
  11. mkdir tmp
  12. cd ./tmp
  13. WGET-THE-APPIMAGE
  14. cd ..
  15. mv ./tmp/*mage ./$APP
  16. chmod a+x /opt/$APP/$APP
  17. cd ./tmp
  18. wget https://github.com/AppImage/AppImageUpdate/releases/download/continuous/appimageupdatetool-x86_64.AppImage 2> /dev/null
  19. cd ..
  20. mv ./tmp/appimageupdatetool-x86_64.AppImage ./updater 2> /dev/null
  21. chmod a+x ./updater
  22. # LINK
  23. ln -s /opt/$APP/$APP /usr/local/bin/$APP
  24. # SCRIPT TO UPDATE
  25. echo '#!/bin/sh
  26. APP='$APP'
  27. cd /opt/$APP
  28. ./updater -O ./$APP
  29. chmod a+x /opt/$APP/$APP
  30. rm -R -f /opt/$APP/*zs-old && rm -R -f /opt/$APP/*.part' >> /opt/$APP/AM-updater
  31. chmod a+x /opt/$APP/AM-updater
  32. # LAUNCHER & ICON
  33. app=$(echo $APP | cut -c -3)
  34. cd /opt/$APP
  35. ./$APP --appimage-extract *.desktop 1>/dev/null
  36. ./$APP --appimage-extract share/applications/*.desktop 1>/dev/null
  37. ./$APP --appimage-extract usr/share/applications/*.desktop 1>/dev/null
  38. mv squashfs-root/*.desktop ./$APP.desktop
  39. mv squashfs-root/share/applications/*.desktop ./$APP.desktop
  40. mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
  41. if [ ! -e ./$APP.desktop ]; then
  42. rm ./$APP.desktop; ./$APP --appimage-extract usr/share/applications/*$app*.desktop
  43. mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
  44. fi
  45. if [ ! -e ./$APP.desktop ]; then
  46. rm ./$APP.desktop; ./$APP --appimage-extract share/applications/*$app*.desktop 1>/dev/null
  47. mv squashfs-root/share/applications/*.desktop ./$APP.desktop
  48. fi
  49. CHANGEEXEC=$(cat ./$APP.desktop | grep Exec= | tr ' ' '\n' | tr '=' '\n' | tr '/' '\n' | grep $app | head -1)
  50. sed -i "s#$CHANGEEXEC#$APP#g" ./$APP.desktop
  51. sed -i "s#AppRun#$APP#g" ./$APP.desktop
  52. sed -i "s#Exec=/bin/#Exec=#g" ./$APP.desktop
  53. sed -i "s#Exec=/usr/bin/#Exec=#g" ./$APP.desktop
  54. CHANGEICON=$(cat ./$APP.desktop | grep Icon= | head -1)
  55. sed -i "s#$CHANGEICON#Icon=/opt/$APP/icons/$APP#g" ./$APP.desktop
  56. mkdir icons
  57. mv $(./$APP --appimage-extract *.png) ./icons/$APP 2>/dev/null
  58. mv $(./$APP --appimage-extract *.svg) ./icons/$APP 2>/dev/null
  59. ./$APP --appimage-extract share/icons/*/*/* 1>/dev/null
  60. ./$APP --appimage-extract usr/share/icons/*/*/* 1>/dev/null
  61. ./$APP --appimage-extract share/icons/*/*/*/* 1>/dev/null
  62. ./$APP --appimage-extract usr/share/icons/*/*/*/* 1>/dev/null
  63. mv ./squashfs-root/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
  64. mv ./squashfs-root/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
  65. mv ./squashfs-root/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
  66. mv ./squashfs-root/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
  67. mv ./squashfs-root/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
  68. mv ./squashfs-root/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
  69. mv ./squashfs-root/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
  70. mv ./squashfs-root/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
  71. mv ./squashfs-root/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null
  72. mv ./squashfs-root/usr/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
  73. mv ./squashfs-root/usr/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
  74. mv ./squashfs-root/usr/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
  75. mv ./squashfs-root/usr/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
  76. mv ./squashfs-root/usr/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
  77. mv ./squashfs-root/usr/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
  78. mv ./squashfs-root/usr/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
  79. mv ./squashfs-root/usr/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
  80. mv ./squashfs-root/usr/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null
  81. rm -R -f /opt/$APP/squashfs-root
  82. mv ./$APP.desktop /usr/share/applications/AM-$APP.desktop
  83. # CHANGE THE PERMISSIONS
  84. currentuser=$(who | awk '{print $1}')
  85. chown -R $currentuser /opt/$APP
  86. # MESSAGE
  87. echo "
  88. $APP is provided by REPLACETHIS
  89. "