filezilla 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/sh
  2. # AM INSTALL SCRIPT VERSION 3.5
  3. set -u
  4. APP=filezilla
  5. SITE="https://filezilla-project.org"
  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=$(wget -q https://filezilla-project.org/download.php?platform=linux32 -O - | grep https://dl | cut -d '"' -f 4)
  13. wget "$version" || exit 1
  14. [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
  15. [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
  16. [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
  17. cd ..
  18. if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi
  19. rm -R -f ./tmp || exit 1
  20. echo "$version" > ./version
  21. chmod a+x ./bin/$APP || exit 1
  22. # LINK TO PATH
  23. echo '#!/bin/sh
  24. HERE="$(dirname "$(readlink -f "${0}")")"
  25. export PATH="${HERE}"/bin/:"${PATH}"
  26. export LD_LIBRARY_PATH="${HERE}"/lib/:"${LD_LIBRARY_PATH}"
  27. export XDG_DATA_DIRS="${HERE}"/usr/share/:"${HERE}"/usr/share/filezilla/:"${XDG_DATA_DIRS}"
  28. exec "${HERE}"/bin/filezilla' > ./"$APP"
  29. chmod a+x ./"$APP"
  30. ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
  31. # SCRIPT TO UPDATE THE PROGRAM
  32. cat >> ./AM-updater << 'EOF'
  33. #!/bin/sh
  34. set -u
  35. APP=filezilla
  36. SITE="https://filezilla-project.org"
  37. version0=$(cat "/opt/$APP/version")
  38. version=$(wget -q https://filezilla-project.org/download.php?platform=linux32 -O - | grep https://dl | cut -d '"' -f 4)
  39. [ -n "$version" ] || { echo "Error getting link"; exit 1; }
  40. if [ "$version" != "$version0" ]; then
  41. mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
  42. notify-send "A new version of $APP is available, please wait"
  43. wget "$version" || exit 1
  44. [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
  45. [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
  46. [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
  47. cd ..
  48. if [ -d ./tmp/* 2>/dev/null ]; then mv --backup=t ./tmp/*/* ./; else mv --backup=t ./tmp/* ./"$APP" 2>/dev/null || mv --backup=t ./tmp/* ./; fi
  49. chmod a+x ./bin/"$APP" || exit 1
  50. echo "$version" > ./version
  51. rm -R -f ./tmp ./*~
  52. notify-send "$APP is updated!"
  53. else
  54. echo "Update not needed!"
  55. fi
  56. EOF
  57. chmod a+x ./AM-updater || exit 1
  58. # ICON
  59. mkdir -p icons
  60. wget https://portable-linux-apps.github.io/icons/filezilla.png -O ./icons/"$APP" 2> /dev/null
  61. # LAUNCHER
  62. echo "[Desktop Entry]
  63. Name=FileZilla
  64. GenericName=FTP client
  65. GenericName[da]=FTP-klient
  66. GenericName[de]=FTP-Client
  67. GenericName[fr]=Client FTP
  68. Comment=Download and upload files via FTP, FTPS and SFTP
  69. Comment[da]=Download og upload filer via FTP, FTPS og SFTP
  70. Comment[de]=Dateien über FTP, FTPS und SFTP übertragen
  71. Comment[fr]=Transférer des fichiers via FTP, FTPS et SFTP
  72. Exec=filezilla
  73. Terminal=false
  74. Icon=/opt/$APP/icons/$APP
  75. Type=Application
  76. Categories=Network;FileTransfer;
  77. Version=1.0" > /usr/local/share/applications/"$APP"-AM.desktop