update_jdownloader.sh 939 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. application=jdownloader2
  7. repository=https://aur.archlinux.org/jdownloader2.git
  8. export compile=
  9. mkdir -p ~/bin
  10. cd ~/bin || return
  11. if [ ! -d $application ]; then
  12. git clone $repository
  13. cd $application || return
  14. export compile=true
  15. else
  16. cd $application || return
  17. #git pull
  18. pwd
  19. git fetch
  20. LOCAL=$(git rev-parse HEAD)
  21. REMOTE=$(git rev-parse @{u})
  22. if [ ! $LOCAL = $REMOTE ]; then
  23. pwd
  24. echo "Need to pull"
  25. git pull
  26. export compile=true
  27. fi
  28. fi
  29. if [ "$compile" = "true" ]; then
  30. ln -sf ~/bin/jdownloader2/JDownloader ~/bin/JDownloader
  31. ln -sf ~/bin/jdownloader2/JDownloader ~/bin/jdownloader
  32. ln -sf ~/bin/jdownloader2/JDownloaderHeadless ~/bin/JDownloaderHeadless
  33. ln -sf ~/bin/jdownloader2/JDownloaderHeadlessCtl ~/bin/JDownloaderHeadlessCtl
  34. ln -sf ~/bin/jdownloader2/JDownloaderHeadlessCleanLogin ~/bin/JDownloaderHeadlessCleanLogin
  35. fi