Torrent queuing pod

Makefile 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. IMAGE_NAME=unixvoid/seedpod
  2. WEB_THEME=https://github.com/Secretmapper/combustion/archive/v0.6.2.tar.gz
  3. ALPINE_FS=https://cryo.unixvoid.com/bin/filesystem/alpine/linux-latest-amd64.rootfs.tar.gz
  4. OS_PERMS=sudo
  5. ROOT_DIR:=$(shell pwd)
  6. all:
  7. test -s deps/rootfs.tar.gz || $(MAKE) build_filesystem
  8. $(MAKE) docker_build_web
  9. build_filesystem:
  10. mkdir -p filesystem.tmp/
  11. cd filesystem.tmp/ && \
  12. wget -O rootfs.tar.gz $(ALPINE_FS) && \
  13. tar -xzf rootfs.tar.gz && \
  14. rm -f rootfs.tar.gz
  15. cp deps/filesystem_setup.sh filesystem.tmp/
  16. $(OS_PERMS) systemd-nspawn -D filesystem.tmp/ /filesystem_setup.sh
  17. rm -rf filesystem.tmp/filesystem_setup.sh
  18. cd filesystem.tmp/ && \
  19. tar -czf rootfs.tar.gz *
  20. mv filesystem.tmp/rootfs.tar.gz deps/
  21. aci_build: pull_actool
  22. mkdir -p seedpod-layout/rootfs/
  23. tar -xzf deps/rootfs.tar.gz -C seedpod-layout/rootfs/
  24. cp deps/config.ovpn seedpod-layout/rootfs/
  25. cp deps/creds.x seedpod-layout/rootfs/
  26. cp deps/settings.json seedpod-layout/rootfs/transmission/
  27. cp deps/start_server.sh seedpod-layout/rootfs/
  28. cp deps/manifest.json seedpod-layout/manifest
  29. ./appc-v0.8.7/actool build seedpod-layout seedpod.aci
  30. ./appc-v0.8.7/actool --debug validate seedpod.aci
  31. rm -rf appc*
  32. aci_build_web: pull_actool
  33. cd deps/ && \
  34. mkdir -p stage.tmp/theme && \
  35. wget -O stage.tmp/theme.tar.gz $(WEB_THEME) && \
  36. tar -xzf stage.tmp/theme.tar.gz -C stage.tmp/theme --strip-components 1
  37. mkdir -p seedpod-layout/rootfs/
  38. tar -xzf deps/rootfs.tar.gz -C seedpod-layout/rootfs/
  39. cp deps/config.ovpn seedpod-layout/rootfs/
  40. cp deps/creds.x seedpod-layout/rootfs/
  41. cp deps/settings.json seedpod-layout/rootfs/transmission/
  42. cp -R deps/stage.tmp/theme/ seedpod-layout/rootfs/usr/share/transmission/web/
  43. cp deps/start_server.sh seedpod-layout/rootfs/
  44. cp deps/manifest.json seedpod-layout/manifest
  45. ./appc-v0.8.7/actool build seedpod-layout seedpod.aci
  46. ./appc-v0.8.7/actool --debug validate seedpod.aci
  47. rm -rf appc*
  48. run_aci:
  49. $(OS_PERMS) rkt run \
  50. --net=host \
  51. --insecure-options=image \
  52. ./seedpod.aci
  53. docker_build:
  54. cd deps/ && \
  55. $(OS_PERMS) docker build -t $(IMAGE_NAME) .
  56. docker_build_web:
  57. cd deps/ && \
  58. mkdir -p stage.tmp/theme && \
  59. wget -O stage.tmp/theme.tar.gz $(WEB_THEME) && \
  60. tar -xzf stage.tmp/theme.tar.gz -C stage.tmp/theme --strip-components 1 && \
  61. $(OS_PERMS) docker build -t $(IMAGE_NAME) -f Dockerfile.web .
  62. docker_run:
  63. $(OS_PERMS) docker run \
  64. -d \
  65. --name seedpod \
  66. --cap-add=NET_ADMIN \
  67. --cap-add=NET_RAW \
  68. --device=/dev/net/tun \
  69. --dns=8.8.8.8 \
  70. -p 9091:9091 \
  71. -v $(ROOT_DIR)/deps/creds.x:/openvpn/creds.x:ro \
  72. -v ~/Downloads/transmission/downloads:/transmission/downloads:rw \
  73. -v ~/Downloads/transmission/incomplete:/transmission/incomplete:rw \
  74. $(IMAGE_NAME)
  75. pull_actool:
  76. wget https://github.com/appc/spec/releases/download/v0.8.7/appc-v0.8.7.tar.gz
  77. tar -zxf appc-v0.8.7.tar.gz
  78. clean:
  79. rm -rf deps/stage.tmp/
  80. rm -rf seedpod-layout/
  81. rm -rf appc-v0.8.7*
  82. rm -rf seedpod.aci
  83. @if [ -d "filesystem.tmp/" ]; then \
  84. $(OS_PERMS) rm -rf filesystem.tmp; \
  85. fi