aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorIvan <ivan@quad4.io>2026-03-18 08:12:03 +0300
committerfrosty <gabriel@bwaaa.monster>2026-03-18 02:08:24 -0400
commit3e0365e7588f0f8f5dbd4a4251806f652b31d7b7 (patch)
tree8acaa853141375b13d370906d47fec89f3f37bb1 /Makefile
parent0d8c4570d26a34c3c6bbad84c719a062802554c1 (diff)
downloadomnisearch-3e0365e7588f0f8f5dbd4a4251806f652b31d7b7.tar.gz
feat: add dinit support
Signed-off-by: Ivan <ivan@quad4.io>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 22 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 8dbc2d8..3d87d12 100644
--- a/Makefile
+++ b/Makefile
@@ -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