diff options
| author | Leonardo Bishop <me@leonardobishop.net> | 2025-07-16 18:42:50 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.net> | 2025-07-16 18:42:50 +0100 |
| commit | 3af8911d46913b8e47c2bf18536a1ec4b7c21596 (patch) | |
| tree | 51944840b5d12f2088ef9d0f982557e72d19205a /Makefile | |
| parent | 4c3e5c256930249798768b0195c42efca1428586 (diff) | |
Add systemd service files and fixes
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -1,6 +1,7 @@ BINARY_NAME=scrapbook SYS_CONF_DIR=/etc/scrapbook -SYS_CONF_DIR=/var/lib/scrapbook +SYS_DATA_DIR=/var/lib/scrapbook +SYSTEMD_DIR=/etc/systemd/system all: build @@ -9,9 +10,19 @@ build: runlocal: PWD=$(shell pwd) - mkdir -p out - go build -ldflags "-X 'github.com/LMBishop/scrapbook/pkg/constants.SysConfDir=${PWD}/out/config' -X 'github.com/LMBishop/scrapbook/pkg/constants.SysDataDir=${PWD}/out/data'" -o out/${BINARY_NAME} main.go - cd out; ./${BINARY_NAME} + mkdir -p runlocal + go build -ldflags "-X 'github.com/LMBishop/scrapbook/pkg/constants.SysConfDir=${PWD}/runlocal/config' -X 'github.com/LMBishop/scrapbook/pkg/constants.SysDataDir=${PWD}/runlocal/data'" -o runlocal/${BINARY_NAME} main.go + cd runlocal; ./${BINARY_NAME} + +install: build + install -Dm755 ${BINARY_NAME} /usr/local/bin/${BINARY_NAME} + +installconf: + install -Dm755 dist/scrapbook.service ${SYSTEMD_DIR}/ + install -Dm755 dist/config.toml ${SYS_CONF_DIR}/config.toml + if ! getent passwd scrapbook > /dev/null; then \ + useradd --system --create-home --shell /usr/sbin/nologin --home-dir ${SYS_DATA_DIR} scrapbook ;\ + fi clean: go clean |
