Mastodon customisations for queer.party
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

111 lines
3.4 KiB

  1. #!/bin/sh
  2. if [ "x$1" != "x" ]; then MASTODON_VERSION=$1; fi
  3. if [ "x$MASTODON_VERSION" = "x" ]; then
  4. echo "Please specify a version as the first argument or via env. var. MASTODON_VERSION">/dev/stderr
  5. exit 1
  6. fi
  7. if [ "x$TAG_VERSION" = "x" ]; then TAG_VERSION=$MASTODON_VERSION; fi
  8. if [ "x$DOCKER_UPSTREAM_VERSION" = "x" ]; then DOCKER_UPSTREAM_VERSION="v$MASTODON_VERSION"; fi
  9. GIT_ARG_DEFAULTS="--recursive --jobs 4 --depth 1 --shallow-submodules --single-branch"
  10. prep_untainted() {
  11. git clone $GIT_ARG_DEFAULTS --branch v$MASTODON_VERSION https://git.maff.scot/mirrors/mastodon untainted
  12. }
  13. prep_tainted_meemu() {
  14. git clone $GIT_ARG_DEFAULTS https://github.com/meemudotorg/theemu modifications/theemu
  15. }
  16. prep_tainted_w95() {
  17. git clone $GIT_ARG_DEFAULTS --branch theme_win95 https://cybre.tech/cybrespace/mastodon modifications/w95
  18. }
  19. prep_tainted() {
  20. mkdir deploy/fonts
  21. mkdir deploy/images
  22. cp -pr untainted tainted
  23. mkdir modifications
  24. prep_tainted_meemu
  25. prep_tainted_w95
  26. }
  27. build_assets_meemu() {
  28. rsync -av --files-from modifications/theemu/meemu-theme.txt modifications/theemu tainted
  29. cp -pr untainted/app/javascript/mastodon/locales/en.json tainted/app/javascript/mastodon/locales/en.json
  30. cp -pr untainted/config/locales/en.yml tainted/config/locales/en.yml
  31. mv tainted/app/javascript/fonts/pressstart2p deploy/fonts/
  32. }
  33. build_assets_w95() {
  34. #stylesheet deps
  35. cp -pr modifications/w95/app/javascript/styles/cybre-base.scss tainted/app/javascript/styles/cybre-base.scss
  36. cp -pr modifications/w95/app/javascript/styles/fullwidth-media.scss tainted/app/javascript/styles/fullwidth-media.scss
  37. #image deps
  38. cp -pr modifications/w95/app/javascript/images/icon_*.png deploy/images/
  39. cp -pr modifications/w95/app/javascript/images/alert_badge.png deploy/images/alert_badge.png
  40. cp -pr modifications/w95/app/javascript/images/start.png deploy/images/start.png
  41. cp -pr modifications/w95/app/javascript/images/clippy_frame.png deploy/images/clippy_frame.png
  42. cp -pr modifications/w95/app/javascript/images/clippy_wave.gif deploy/images/clippy_wave.gif
  43. #font deps
  44. cp -pr modifications/w95/app/javascript/fonts/premillenium deploy/fonts/
  45. #theme
  46. cp -pr modifications/w95/app/javascript/styles/win95.scss tainted/app/javascript/styles/win95.scss
  47. }
  48. build_assets_local() {
  49. mkdir deploy/loader
  50. cp -pr assets/loader.sh deploy/loader/loader
  51. cp -pr assets/libloader.sh deploy/loader/
  52. cp -pr assets/themes.yml tainted/config/themes.yml
  53. cp -pr assets/source.rb tainted/config/initializers/source.rb
  54. }
  55. build_assets() {
  56. build_assets_meemu
  57. build_assets_w95
  58. build_assets_local
  59. }
  60. build_patch() {
  61. diff -ruN untainted tainted > deploy/queer.party.patch
  62. }
  63. build_image() {
  64. docker build --build-arg MASTODON_VERSION=$DOCKER_UPSTREAM_VERSION -t maffsie/qp-mastodon:latest -t maffsie/qp-mastodon:v$TAG_VERSION deploy/
  65. }
  66. push_image() {
  67. docker push maffsie/qp-mastodon
  68. }
  69. cleanup_prebuild() {
  70. rm -rf untainted tainted modifications
  71. }
  72. cleanup_postbuild() {
  73. rm -rf deploy/queer.party.patch deploy/fonts deploy/images deploy/loader
  74. }
  75. prep() {
  76. case "$1" in
  77. untainted) prep_untainted;;
  78. tainted) prep_tainted;;
  79. esac
  80. }
  81. build() {
  82. case "$1" in
  83. assets) build_assets;;
  84. patch) build_patch;;
  85. image) build_image;;
  86. esac
  87. }
  88. push() {
  89. case "$1" in
  90. image) push_image;;
  91. esac
  92. }
  93. cleanup() {
  94. case "$1" in
  95. prebuild) cleanup_prebuild;;
  96. postbuild) cleanup_postbuild;;
  97. esac
  98. }
  99. main() {
  100. prep untainted
  101. prep tainted
  102. build assets
  103. build patch
  104. cleanup prebuild
  105. build image
  106. push image
  107. cleanup postbuild
  108. }