From 5a7db107ae9bb2bf8c627712d70bcc538a4d657c Mon Sep 17 00:00:00 2001 From: Secret Specter Date: Tue, 1 Aug 2023 14:14:16 -0600 Subject: [PATCH] make install --- Makefile | 26 +++++++++++++++++++++++--- README.md | 38 ++++++++++++++++++++++++++------------ geml.service | 10 ++++++++++ 3 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 geml.service diff --git a/Makefile b/Makefile index e04ccf9..f6cd30c 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,29 @@ clean: -rm bin/geml-server install: bin/geml-server - cp bin/geml-server /usr/local/bin/geml-server - #cp geml.service /etc/systemd/system + id -u geml &>/dev/null || useradd geml --system + install \ + --target-directory /usr/local/bin/ \ + --mode 744 \ + --owner geml \ + --group geml \ + bin/geml-server + install \ + --target-directory /etc/systemd/system/ \ + --mode 644 \ + --owner geml \ + --group geml \ + geml.service + mkdir -p /etc/geml/ + install \ + --target-directory /etc/geml/ \ + --owner geml \ + --group geml \ + --mode 644 \ + geml.ini uninstall: + id -u geml &>/dev/null && userdel geml rm /usr/local/bin/geml-server - #rm /etc/systemd/system/geml.service + rm /etc/systemd/system/geml.service + rm -rf /etc/geml/ diff --git a/README.md b/README.md index 3a42675..b1a8314 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,32 @@ openssl req -x509 \ ## Usage +### Standalone Executable + +To get an executable `bin/geml-server` run `make`. + +```sh +make && bin/geml-server -h +``` + +### Systemd + +Install the build to `/usr/local/bin/geml-server` with +`sudo make install` which will also wire up systemd so you can `sudo systemctl +enable --now geml` + +You'll need to `sudo systemctl restart geml` whenever you update +`/etc/geml/geml.ini`... you did do that didn't you? + +### yeet it + +To undo all that run these: + +```sh +sudo make uninstall +make clean +``` + ### SBCL Start sbcl with proper readline support: `rlwrap sbcl` @@ -42,15 +68,3 @@ Start sbcl with proper readline support: `rlwrap sbcl` (ql:quickload "geml") (gemini.server:start-server "/etc/geml/geml.ini") ``` - -### Standalone Executable - -To get a `geml-server` binary run: - -```sh -./build.sh && ./bin/geml-server -h -``` - -### Systemd - -- [ ] geml.service diff --git a/geml.service b/geml.service new file mode 100644 index 0000000..a19df02 --- /dev/null +++ b/geml.service @@ -0,0 +1,10 @@ +[Unit] +Description=Gemini Server written in Common Lisp +After=network.target + +[Service] +User=geml +ExecStart=/usr/local/bin/geml-server --config /etc/geml/geml.ini + +[Install] +WantedBy=multi-user.target