#!/bin/sh # Runs inside the forum image: writes /out/forum.tar.gz, a complete Flarum tree with the museum # extension, ready to copy to a server that has PHP but no Composer (see forum/README.md). set -e cd /var/www/flarum rm -rf packages/oc-museum && mkdir -p packages && cp -r /extension packages/oc-museum composer config repositories.oc '{"type": "path", "url": "packages/*", "options": {"symlink": false}}' composer require --no-interaction --update-no-dev --optimize-autoloader "oc/flarum-museum:*@dev" >/dev/null # the forum lives in a sub-folder of the web root: route everything into public/, so that # config.php, storage/ and vendor/ are never served printf '# Everything is served from public/: nothing else of the forum is reachable.\nRewriteEngine On\nRewriteRule ^(.*)$ public/$1 [L]\n' > .htaccess tar czf /out/forum.tar.gz --exclude=./config.php --exclude='./storage/logs/*' --exclude='./storage/cache/*' --exclude='./storage/sessions/*' . chown "$(stat -c %u:%g /out)" /out/forum.tar.gz