From c31e5c9e0e237567095b367e165ef4dcc068da6e Mon Sep 17 00:00:00 2001 From: hitlerrip Date: Tue, 5 Aug 2025 18:15:12 +0200 Subject: pub.sh added an actual wrapper around the build script, which was my intention with `run.sh` --- README.md | 4 ++-- pub.sh | 8 ++++++++ run.sh | 13 +++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100755 pub.sh diff --git a/README.md b/README.md index 8f7340a..090d474 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,10 @@ This project includes a build script that builds the website. ./build.sh ``` -It also includes a wrapper around the build script that automatically configures my Debian/Nginx server, builds the website and publishes it. +It also contains a wrapper around the build script that automatically publishes the website when the server is configured using `run.sh` (which yours probably isn't) ```sh -./run.sh +./pub.sh ``` Please note that you should place static content (such as images you link to) in `./dir/`. anything in `./dir/` will get copied without any modification to the `./web/` directory, which will be the root of your web page. diff --git a/pub.sh b/pub.sh new file mode 100755 index 0000000..18df7ee --- /dev/null +++ b/pub.sh @@ -0,0 +1,8 @@ +#!/bin/sh +source ./build.sh +echo "=== publishing website! ===" +rm -rf /srv/web/ +sudo mkdir -p /srv/web/ +sudo chown -R $(whoami):$(whoami) /srv/web/ +cp ./web/* /srv/web/ +sudo systemctl restart nginx diff --git a/run.sh b/run.sh index de92498..2e7ba85 100755 --- a/run.sh +++ b/run.sh @@ -5,6 +5,7 @@ echo "# WEBSERVER RUNNER #" echo "# »» hitler.rip «« #" echo "####################" echo +echo "[run] This script sets up my web servers the way I like it." echo "[run] Note:" echo "[run] this script assumes you already have an openssh server set up properly." echo @@ -169,7 +170,9 @@ server { } EOF sudo mkdir -p /srv/web/ -sudo chown -R $(whoami) /srv/web/ +sudo mkdir -p /srv/build/ +sudo chown -R $(whoami):$(whoami) /srv/web/ +sudo chown -R $(whoami):$(whoami) /srv/build/ sudo systemctl restart nginx sudo systemctl enable nginx @@ -177,10 +180,12 @@ echo "[run] setting up git server..." sudo adduser --shell $(which git-shell) git sudo mkdir /home/git/.ssh/ sudo cp ~/.ssh/authorized_keys /home/git/.ssh/ -sudo chown -R git /home/git/.ssh/ +sudo chown -R git:git /home/git/.ssh/ sudo chmod 700 /home/git/.ssh/ sudo chmod 600 /home/git/.ssh/authorized_keys sudo mkdir -p /srv/git/ -sudo chown -R git /srv/git/ +sudo chown -R git:git /srv/git/ sudo mkdir -p /srv/pgit/ -sudo chown -R git /srv/pgit/ +sudo chown -R git:git /srv/pgit/ +git config --global --add safe.directory '*' # to allow the server to clone its own repos +echo "[run] git server created. you may now clone the website build script to /srv/build/ and push your website." -- cgit v1.2.3