From 7998c196af6df9f36de9427d465372eafdb68730 Mon Sep 17 00:00:00 2001 From: "leon.bohnwagner" <leon.bohnwagner@informatik.hs-fulda.de> Date: Fri, 14 Feb 2025 03:10:46 +0100 Subject: [PATCH] feat: add makefile and update systemd services --- .gitignore | 1 - Makefile | 37 +++++++++++++++++++ README.md | 2 +- systemd/clients/cpu-temp.service | 10 ----- systemd/clients/dummy.service | 10 ----- systemd/clients/sibyl-cpu-temp.service | 11 ++++++ systemd/clients/sibyl-dummy.service | 11 ++++++ .../{daemon.service => sibyl-daemon.service} | 4 +- 8 files changed, 62 insertions(+), 24 deletions(-) create mode 100644 Makefile delete mode 100644 systemd/clients/cpu-temp.service delete mode 100644 systemd/clients/dummy.service create mode 100644 systemd/clients/sibyl-cpu-temp.service create mode 100644 systemd/clients/sibyl-dummy.service rename systemd/{daemon.service => sibyl-daemon.service} (61%) diff --git a/.gitignore b/.gitignore index e4bc8a8..9df9018 100644 --- a/.gitignore +++ b/.gitignore @@ -62,7 +62,6 @@ CMakeCache.txt CMakeFiles CMakeScripts Testing -Makefile cmake_install.cmake install_manifest.txt compile_commands.json diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a13c90d --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +CMAKE_BUILD_DIR = build + +BINARY_DIR = /usr/bin +SYSTEMD_DIR = /etc/systemd/system + +DAEMON = daemon +CLIENTS = dummy cpu_temp + +SYSTEM_NAME = sibyl + +all: build install + +build: + mkdir -p $(CMAKE_BUILD_DIR) + cd $(CMAKE_BUILD_DIR) && cmake .. + cd $(CMAKE_BUILD_DIR) && make + +install: + install -m 755 $(CMAKE_BUILD_DIR)/$(DAEMON)/$(DAEMON) $(BINARY_DIR)/$(SYSTEM_NAME)-$(DAEMON) + + $(foreach client, $(CLIENTS), install -m 755 $(CMAKE_BUILD_DIR)/clients/$(client)/$(client) $(BINARY_DIR)/$(SYSTEM_NAME)-$(subst _,-,$(client));) + + install -m 644 systemd/$(SYSTEM_NAME)-$(DAEMON).service $(SYSTEMD_DIR)/$(SYSTEM_NAME)-$(DAEMON).service + + $(foreach client, $(CLIENTS), install -m 644 systemd/clients/$(SYSTEM_NAME)-$(subst _,-,$(client)).service $(SYSTEMD_DIR)/$(SYSTEM_NAME)-$(subst _,-,$(client)).service;) + +uninstall: + rm -f $(BINARY_DIR)/$(SYSTEM_NAME)-$(DAEMON) + + $(foreach client, $(CLIENTS), rm -f $(BINARY_DIR)/$(SYSTEM_NAME)-$(subst _,-,$(client));) + + rm -f $(SYSTEMD_DIR)/$(SYSTEM_NAME)-$(DAEMON).service + + $(foreach client, $(CLIENTS), rm -f $(SYSTEMD_DIR)/$(SYSTEM_NAME)-$(subst _,-,$(client)).service;) + +clean: + rm -rf $(CMAKE_BUILD_DIR) diff --git a/README.md b/README.md index 541e574..0c3368d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Embedded Linux Project (sibyl) +# Embedded Linux Project (Sibyl) ## Building diff --git a/systemd/clients/cpu-temp.service b/systemd/clients/cpu-temp.service deleted file mode 100644 index 1392566..0000000 --- a/systemd/clients/cpu-temp.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=CPU Temp -After=daemon.service - -[Service] -ExecStart=/usr/bin/cpu-temp 2 250 -Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/systemd/clients/dummy.service b/systemd/clients/dummy.service deleted file mode 100644 index 9c75c1d..0000000 --- a/systemd/clients/dummy.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Dummy -After=daemon.service - -[Service] -ExecStart=/usr/bin/dummy 1 250 -Restart=always - -[Install] -WantedBy=multi-user.target diff --git a/systemd/clients/sibyl-cpu-temp.service b/systemd/clients/sibyl-cpu-temp.service new file mode 100644 index 0000000..bd55b4e --- /dev/null +++ b/systemd/clients/sibyl-cpu-temp.service @@ -0,0 +1,11 @@ +[Unit] +Description=Sibyl Client CPU Temperature +Wants=sibyl-daemon.service +After=sibyl-daemon.service + +[Service] +ExecStart=/usr/bin/sibyl-cpu-temp 2 250 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/systemd/clients/sibyl-dummy.service b/systemd/clients/sibyl-dummy.service new file mode 100644 index 0000000..fc17eb2 --- /dev/null +++ b/systemd/clients/sibyl-dummy.service @@ -0,0 +1,11 @@ +[Unit] +Description=Sibyl Client Dummy +Wants=sibyl-daemon.service +After=sibyl-daemon.service + +[Service] +ExecStart=/usr/bin/sibyl-dummy 1 250 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/systemd/daemon.service b/systemd/sibyl-daemon.service similarity index 61% rename from systemd/daemon.service rename to systemd/sibyl-daemon.service index d8e294a..75ed27d 100644 --- a/systemd/daemon.service +++ b/systemd/sibyl-daemon.service @@ -1,9 +1,9 @@ [Unit] -Description=Daemon +Description=Sibyl Daemon After=network.target [Service] -ExecStart=/usr/bin/daemon +ExecStart=/usr/bin/sibyl-daemon Restart=always [Install] -- GitLab