diff options
| author | Ivan <ivan@quad4.io> | 2026-03-18 08:12:03 +0300 |
|---|---|---|
| committer | frosty <gabriel@bwaaa.monster> | 2026-03-18 02:08:24 -0400 |
| commit | 3e0365e7588f0f8f5dbd4a4251806f652b31d7b7 (patch) | |
| tree | 8acaa853141375b13d370906d47fec89f3f37bb1 | |
| parent | 0d8c4570d26a34c3c6bbad84c719a062802554c1 (diff) | |
| download | omnisearch-3e0365e7588f0f8f5dbd4a4251806f652b31d7b7.tar.gz | |
feat: add dinit support
Signed-off-by: Ivan <ivan@quad4.io>
| -rw-r--r-- | Makefile | 23 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | init/dinit/omnisearch | 9 |
3 files changed, 32 insertions, 2 deletions
@@ -56,6 +56,7 @@ GROUP := omnisearch SYSTEMD_DIR := /etc/systemd/system OPENRC_DIR := /etc/init.d +DINIT_DIR := /etc/dinit.d install: @echo "Available install targets:" @@ -63,6 +64,7 @@ install: @echo " make install-openrc" @echo " make install-runit" @echo " make install-s6" + @echo " make install-dinit" @echo "" @echo "Example: doas/sudo make install-openrc" @@ -144,15 +146,34 @@ install-s6: $(TARGET) @echo "Installed s6 service to /var/service/omnisearch" @echo "Service will start automatically" +install-dinit: $(TARGET) + @mkdir -p $(DATA_DIR)/templates $(DATA_DIR)/static $(LOG_DIR) $(CACHE_DIR) + @cp -rf templates/* $(DATA_DIR)/templates/ + @cp -rf static/* $(DATA_DIR)/static/ + @cp -n example-config.ini $(DATA_DIR)/config.ini + install -m 755 $(TARGET) $(INSTALL_BIN_DIR)/omnisearch + @echo "Setting up user '$(USER)'..." + @(grep -q '^$(GROUP):' /etc/group || groupadd $(GROUP)) 2>/dev/null || true + @id -u $(USER) >/dev/null 2>&1 || useradd --system --home $(DATA_DIR) --shell /usr/sbin/nologin -g $(GROUP) $(USER) + @chown -R $(USER):$(GROUP) $(LOG_DIR) $(CACHE_DIR) $(VAR_DIR) $(DATA_DIR) 2>/dev/null || true + @chown $(USER):$(GROUP) $(DATA_DIR)/config.ini 2>/dev/null || true + install -m 644 init/dinit/omnisearch $(DINIT_DIR)/omnisearch + @echo "" + @echo "Config: $(DATA_DIR)/config.ini" + @echo "Edit config with: nano $(DATA_DIR)/config.ini" + @echo "Installed dinit service to $(DINIT_DIR)/omnisearch" + @echo "Run 'dinitctl enable omnisearch' to start" + uninstall: rm -f $(INSTALL_BIN_DIR)/omnisearch rm -rf $(DATA_DIR) rm -f $(SYSTEMD_DIR)/omnisearch.service rm -f $(OPENRC_DIR)/omnisearch + rm -f $(DINIT_DIR)/omnisearch rm -rf /etc/service/omnisearch rm -rf /var/service/omnisearch @id -u $(USER) >/dev/null 2>&1 && userdel $(USER) 2>/dev/null || true @grep -q '^$(GROUP):' /etc/group 2>/dev/null && groupdel $(GROUP) 2>/dev/null || true @echo "Uninstalled omnisearch" -.PHONY: all run clean rebuild info install install-systemd install-openrc install-runit install-s6 uninstall +.PHONY: all run clean rebuild info install install-systemd install-openrc install-runit install-s6 install-dinit uninstall @@ -60,7 +60,7 @@ $ cd omnisearch $ make # make install-<init> ``` -Replace `<init>` with your init system (openrc,systemd,runit,s6) +Replace `<init>` with your init system (openrc,systemd,runit,s6,dinit) ## Hosting Run it normally behind a reverse proxy (like nginx) diff --git a/init/dinit/omnisearch b/init/dinit/omnisearch new file mode 100644 index 0000000..de470af --- /dev/null +++ b/init/dinit/omnisearch @@ -0,0 +1,9 @@ +type = process +command = /usr/bin/omnisearch +working-dir = /etc/omnisearch +run-as = omnisearch +logfile = /var/log/omnisearch/omnisearch.log +logfile-uid = omnisearch +logfile-gid = omnisearch +restart = yes +restart-delay = 5 |
