From db6ed9d0e45bae3e9b8c9e1c06b3daa99b797b0d Mon Sep 17 00:00:00 2001
From: Pranav Jerry <libreinator@disroot.org>
Date: Thu, 13 Feb 2025 10:44:29 +0530
Subject: [PATCH] fixed Makefile

Makefile did not remove install systemd service and timers before
---
 Makefile | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 71be756..59cc529 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,30 @@
 USRBIN := /usr/local/bin
+SYSTEMD_DIR := /etc/systemd/system
+CONFIG_FILE := /etc/plymouth-themes.json
 
 install:
+	@echo "Installing..."
 	install -m755 plymouth-random-theme $(USRBIN)
+	install plymouth-theme.service plymouth-theme.timer $(SYSTEMD_DIR)
+	@echo "Done"
+	@echo -n "Reloading systemd..."
+	systemctl daemon-reload
+	@echo "Done"
+	@echo "Type 'systemctl enable --now plymouth-theme.timer' to enable the timer"
 
 uninstall:
-	rm -rf $(USRBIN)/plymouth-random-theme
-	@echo "make uninstall will not remove anything in /etc/plymouth-themes.json" && \
-	echo "Do 'sudo make purge' to remove it."
+	@echo -n "Removing installed files..."
+	rm -rf $(USRBIN)/plymouth-random-theme $(SYSTEMD_DIR)/plymouth-theme.service $(SYSTEMD_DIR)/plymouth-theme.timer
+	@echo "Done"
+	@echo -n "Reloading systemd..."
+	systemctl daemon-reload
+	@echo "Done"
+	@echo "NOTE: make uninstall will not remove anything in $(CONFIG_FILE)" && \
+	echo "Do 'sudo make purge' to remove it. Ignore if you are already running sudo make purge"
 
 # Remove config files, like apt purge. Purge should first do what
 # uninstall does, so we add uninstall as a dependency to this rule.
 purge: uninstall
-	rm -rf /etc/plymouth-themes.json
+	@echo "Removing config files..."
+	rm -rf $(CONFIG_FILE)
+	@echo "Done"
-- 
GitLab