diff --git a/.env.example b/.env.example index 73352f1..18cefd2 100644 --- a/.env.example +++ b/.env.example @@ -2,6 +2,7 @@ REMOTE_USER=root REMOTE_HOST=example.com REMOTE_HOME=/home/example.com REPO=https://gitea.example.com/user/natascha-rieter.nl-user.git +GRAV_VERSION=1.7.49.5 GITEA_HOST=gitea.example.com GITEA_USER=natascha-deploy diff --git a/Makefile b/Makefile index 1fc5049..1873de3 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ content-pull: # Remote remote-install: - ssh $(SSH) "WEBROOT=$(WEBROOT) REPO=$(REPO) GITEA_HOST=$(GITEA_HOST) GITEA_USER=$(GITEA_USER) GITEA_TOKEN=$(GITEA_TOKEN) bash -s" < scripts/server-install.sh + ssh $(SSH) "WEBROOT=$(WEBROOT) REPO=$(REPO) GRAV_VERSION=$(GRAV_VERSION) PLUGINS='$(shell cat plugins.txt | tr '\n' ' ')' GITEA_HOST=$(GITEA_HOST) GITEA_USER=$(GITEA_USER) GITEA_TOKEN=$(GITEA_TOKEN) bash -s" < scripts/server-install.sh remote-install-plugins: ssh $(SSH) "cd $(WEBROOT) && php bin/gpm install $(shell cat plugins.txt | tr '\n' ' ') -y" diff --git a/scripts/server-install.sh b/scripts/server-install.sh index e8c95f7..a67e9e7 100755 --- a/scripts/server-install.sh +++ b/scripts/server-install.sh @@ -3,13 +3,15 @@ set -e : "${WEBROOT:?WEBROOT is not set}" : "${REPO:?REPO is not set}" +: "${GRAV_VERSION:?GRAV_VERSION is not set}" +: "${PLUGINS:?PLUGINS is not set}" : "${GITEA_HOST:?GITEA_HOST is not set}" : "${GITEA_USER:?GITEA_USER is not set}" : "${GITEA_TOKEN:?GITEA_TOKEN is not set}" -echo "==> Downloading Grav" +echo "==> Downloading Grav $GRAV_VERSION" cd "$WEBROOT" -wget -q https://getgrav.org/download/core/grav-admin/latest -O grav-admin.zip +wget -q "https://getgrav.org/download/core/grav-admin/$GRAV_VERSION" -O grav-admin.zip unzip -q grav-admin.zip mv grav-admin/* grav-admin/.htaccess . rm -rf grav-admin grav-admin.zip @@ -21,6 +23,9 @@ rm -rf user git clone "$REPO" user rm ~/.netrc +echo "==> Installing plugins" +php bin/gpm install $PLUGINS -y + echo "==> Setting permissions" find "$WEBROOT" -type f -exec chmod 664 {} \; find "$WEBROOT" -type d -exec chmod 775 {} \;