gimp 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. # AM INSTALL SCRIPT VERSION 3.5
  3. set -u
  4. APP=gimp
  5. SITE="ivan-hc/32-bit-AppImage-packages-database"
  6. # CREATE DIRECTORIES AND ADD REMOVER
  7. [ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
  8. printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
  9. printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
  10. chmod a+x ../remove || exit 1
  11. # DOWNLOAD AND PREPARE THE APP, $version is also used for updates
  12. version=$(curl -Ls https://api.github.com/repos/ivan-hc/32-bit-AppImage-packages-database/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*gimp.*mage$" | head -1)
  13. wget "$version" || exit 1
  14. # Keep this space in sync with other installation scripts
  15. # Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
  16. cd ..
  17. mv ./tmp/*mage ./"$APP"
  18. # Keep this space in sync with other installation scripts
  19. rm -R -f ./tmp || exit 1
  20. echo "$version" > ./version
  21. chmod a+x ./"$APP" || exit 1
  22. # LINK TO PATH
  23. ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
  24. # SCRIPT TO UPDATE THE PROGRAM
  25. cat >> ./AM-updater << 'EOF'
  26. #!/bin/sh
  27. set -u
  28. APP=gimp
  29. SITE="ivan-hc/32-bit-AppImage-packages-database"
  30. version0=$(cat "/opt/$APP/version")
  31. version=$(curl -Ls https://api.github.com/repos/ivan-hc/32-bit-AppImage-packages-database/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*gimp.*mage$" | head -1)
  32. [ -n "$version" ] || { echo "Error getting link"; exit 1; }
  33. if command -v appimageupdatetool >/dev/null 2>&1; then
  34. cd "/opt/$APP" || exit 1
  35. appimageupdatetool -Or ./"$APP" && chmod a+x ./"$APP" && echo "$version" > ./version && exit 0
  36. fi
  37. if [ "$version" != "$version0" ]; then
  38. mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
  39. wget "$version" || exit 1
  40. # Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
  41. cd ..
  42. mv --backup=t ./tmp/*mage ./"$APP"
  43. chmod a+x ./"$APP" || exit 1
  44. echo "$version" > ./version
  45. rm -R -f ./*zs-old ./*.part ./tmp ./*~
  46. notify-send "$APP is updated!"
  47. else
  48. echo "Update not needed!"
  49. fi
  50. EOF
  51. chmod a+x ./AM-updater || exit 1
  52. # LAUNCHER & ICON
  53. ./"$APP" --appimage-extract *.desktop 1>/dev/null && mv ./squashfs-root/*.desktop ./"$APP".desktop
  54. ./"$APP" --appimage-extract .DirIcon 1>/dev/null && mv ./squashfs-root/.DirIcon ./DirIcon
  55. COUNT=0
  56. while [ "$COUNT" -lt 10 ]; do # Tries to get the actual icon/desktop if it is a symlink to another symlink
  57. if [ -L ./"$APP".desktop ]; then
  58. LINKPATH="$(readlink ./"$APP".desktop | sed 's|^\./||' 2>/dev/null)"
  59. ./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./"$APP".desktop
  60. fi
  61. if [ -L ./DirIcon ]; then
  62. LINKPATH="$(readlink ./DirIcon | sed 's|^\./||' 2>/dev/null)"
  63. ./"$APP" --appimage-extract "$LINKPATH" 1>/dev/null && mv ./squashfs-root/"$LINKPATH" ./DirIcon
  64. fi
  65. [ ! -L ./"$APP".desktop ] && [ ! -L ./DirIcon ] && break
  66. COUNT=$((COUNT + 1))
  67. done
  68. sed -i "s#Exec=[^ ]*#Exec=$APP#g; s#Icon=.*#Icon=/opt/$APP/icons/$APP#g" ./"$APP".desktop
  69. mv ./"$APP".desktop /usr/local/share/applications/"$APP"-AM.desktop && mv ./DirIcon ./icons/"$APP" 1>/dev/null
  70. rm -R -f ./squashfs-root