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.
157 lines
4.7 KiB
157 lines
4.7 KiB
#!/bin/sh |
|
if [ "x$1" != "x" ]; then MASTODON_VERSION=$1; fi |
|
if [ "x$MASTODON_VERSION" = "x" ]; then |
|
echo "Please specify a version as the first argument or via env. var. MASTODON_VERSION">/dev/stderr |
|
exit 1 |
|
fi |
|
if [ "x$2" = "x--no-build" ]; then NO_BUILD=1; fi |
|
if [ "x$2" = "x--cleanup" ]; then CLEANUP=1; fi |
|
if [ "x$TAG_VERSION" = "x" ]; then TAG_VERSION=$MASTODON_VERSION; fi |
|
if [ "x$DOCKER_UPSTREAM_VERSION" = "x" ]; then DOCKER_UPSTREAM_VERSION="v$MASTODON_VERSION"; fi |
|
HASH=`git rev-parse --short HEAD` |
|
DT=`date -u '+%0y%0j%0H%0M%0S'` |
|
GIT_ARG_DEFAULTS="--recursive --jobs 4 --depth 1 --shallow-submodules --single-branch" |
|
prep_untainted() { |
|
git clone $GIT_ARG_DEFAULTS --branch v$MASTODON_VERSION https://commit.pup.cloud/mirrors/mastodon untainted |
|
} |
|
prep_tainted_meemu() { |
|
git clone $GIT_ARG_DEFAULTS https://commit.pup.cloud/mirrors/mirror-meemudotorg-theemu modifications/theemu |
|
} |
|
prep_tainted_w95() { |
|
git clone $GIT_ARG_DEFAULTS --branch theme_win95 https://commit.pup.cloud/mirrors/mirror-cybre-space modifications/w95 |
|
} |
|
prep_tainted() { |
|
mkdir deploy/fonts |
|
mkdir deploy/images |
|
cp -pr untainted tainted |
|
mkdir modifications |
|
prep_tainted_meemu |
|
prep_tainted_w95 |
|
} |
|
prep_pinafore() { |
|
git clone $GIT_ARG_DEFAULTS --branch v$PINAFORE_VERSION https://commit.pup.cloud/mirrors/pinafore pinafore |
|
} |
|
build_assets_meemu() { |
|
rsync -av --files-from modifications/theemu/meemu-theme.txt modifications/theemu tainted |
|
cp -pr untainted/app/javascript/mastodon/locales/en.json tainted/app/javascript/mastodon/locales/en.json |
|
cp -pr untainted/config/locales/en.yml tainted/config/locales/en.yml |
|
mv tainted/app/javascript/fonts/pressstart2p deploy/fonts/ |
|
} |
|
build_assets_w95() { |
|
#stylesheet deps |
|
cp -pr modifications/w95/app/javascript/styles/cybre-base.scss tainted/app/javascript/styles/cybre-base.scss |
|
cp -pr modifications/w95/app/javascript/styles/fullwidth-media.scss tainted/app/javascript/styles/fullwidth-media.scss |
|
#image deps |
|
cp -pr modifications/w95/app/javascript/images/icon_*.png deploy/images/ |
|
cp -pr modifications/w95/app/javascript/images/alert_badge.png deploy/images/alert_badge.png |
|
cp -pr modifications/w95/app/javascript/images/start.png deploy/images/start.png |
|
cp -pr modifications/w95/app/javascript/images/clippy_frame.png deploy/images/clippy_frame.png |
|
cp -pr modifications/w95/app/javascript/images/clippy_wave.gif deploy/images/clippy_wave.gif |
|
#font deps |
|
cp -pr modifications/w95/app/javascript/fonts/premillenium deploy/fonts/ |
|
#theme |
|
cp -pr modifications/w95/app/javascript/styles/win95.scss tainted/app/javascript/styles/win95.scss |
|
} |
|
build_assets_local() { |
|
mkdir deploy/loader |
|
cp -pr assets/loader.sh deploy/loader/loader |
|
cp -pr assets/libloader.sh deploy/loader/ |
|
cp -pr assets/themes.yml tainted/config/themes.yml |
|
cp -pr assets/source.rb tainted/config/initializers/source.rb |
|
sed -i -e "s/HASH/$HASH/" -e "s/DT/$DT/" tainted/config/initializers/source.rb |
|
} |
|
build_assets() { |
|
build_assets_meemu |
|
build_assets_w95 |
|
build_assets_local |
|
} |
|
build_patch() { |
|
diff -ruN untainted tainted > deploy/queer.party.patch |
|
} |
|
build_image() { |
|
docker build --build-arg MASTODON_VERSION=$DOCKER_UPSTREAM_VERSION -t maffsie/qp-mastodon:latest -t maffsie/qp-mastodon:v$TAG_VERSION deploy/ |
|
} |
|
build_pinafore() { |
|
docker build -t maffsie/qp-pinafore:latest -t maffsie/qp-pinafore:v$PINAFORE_VERSION pinafore/ |
|
} |
|
push_image() { |
|
docker push -a maffsie/qp-mastodon |
|
} |
|
push_pinafore() { |
|
docker push -a maffsie/qp-pinafore |
|
} |
|
cleanup_prebuild() { |
|
rm -rf untainted tainted modifications |
|
} |
|
cleanup_postbuild() { |
|
rm -rf deploy/queer.party.patch deploy/fonts deploy/images deploy/loader |
|
} |
|
cleanup_pinafore() { |
|
rm -rf pinafore |
|
} |
|
cleanup_docker() { |
|
docker image prune -af |
|
} |
|
prep() { |
|
case "$1" in |
|
untainted) prep_untainted;; |
|
tainted) prep_tainted;; |
|
pinafore) prep_pinafore;; |
|
patch) prep_untainted; prep_tainted;; |
|
esac |
|
} |
|
build() { |
|
case "$1" in |
|
assets) build_assets;; |
|
patch) build_patch;; |
|
image) build_image;; |
|
pinafore) build_pinafore;; |
|
esac |
|
} |
|
push() { |
|
case "$1" in |
|
image) push_image;; |
|
pinafore) push_pinafore;; |
|
all) push_image; push_pinafore;; |
|
esac |
|
} |
|
cleanup() { |
|
case "$1" in |
|
prebuild) cleanup_prebuild;; |
|
postbuild) cleanup_postbuild;; |
|
pinafore) cleanup_pinafore;; |
|
docker) cleanup_docker;; |
|
all) cleanup_prebuild; cleanup_postbuild; cleanup_pinafore; cleanup_docker;; |
|
esac |
|
} |
|
main() { |
|
if [ "x$CLEANUP" != "x" ]; then |
|
cleanup postbuild |
|
exit |
|
fi |
|
prep untainted |
|
prep tainted |
|
build assets |
|
build patch |
|
cleanup prebuild |
|
if [ "x$NO_BUILD" != "x" ]; then |
|
exit |
|
fi |
|
build image |
|
if [ "x$PINAFORE_VERSION" != "x" ]; then |
|
pinafore_main |
|
fi |
|
push image |
|
cleanup postbuild |
|
} |
|
pinafore_main() { |
|
if [ "x$PINAFORE_VERSION" == "x" ]; then |
|
echo "Please specify a pinafore version with variable PINAFORE_VERSION" > /dev/stderr |
|
exit 1 |
|
fi |
|
prep pinafore |
|
build pinafore |
|
push pinafore |
|
cleanup pinafore |
|
} |
|
|
|
|