build-transmission.sh 990 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. set -euxo pipefail
  4. install_dependencies(){
  5. sudo apt-get install -y \
  6. git \
  7. build-essential \
  8. cmake \
  9. libcurl4-openssl-dev \
  10. libssl-dev \
  11. python3 \
  12. libgtkmm-3.0-dev \
  13. gettext \
  14. libappindicator3-0.1-cil-dev
  15. }
  16. build_transmission(){
  17. dir=$(find -maxdepth 1 -type d -name 'transmission-*' | head -n1)
  18. cd "$dir"
  19. mkdir -p build && cd build
  20. cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. -DENABLE_GTK=ON
  21. make
  22. sudo make install
  23. }
  24. download_latest_release(){
  25. latest_release="https://github.com/transmission/transmission/releases/latest"
  26. latest_tag=$(curl -I "$latest_release" | grep 'location: ' | tr -d '\r')
  27. latest_tag="${latest_tag##*/}"
  28. archive="transmission-${latest_tag}.tar.xz"
  29. wget "${latest_release}/download/${archive}"
  30. tar xvf "$archive"
  31. }
  32. download_latest_release
  33. install_dependencies
  34. build_transmission