From c59793a6f453a14addcf39e3ba1910ab11168437 Mon Sep 17 00:00:00 2001 From: Rawleenc Date: Mon, 13 Oct 2025 14:39:22 +0200 Subject: [PATCH] fix: add postinst and postrm scripts --- Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Makefile b/Makefile index 14bde54..24b1abb 100644 --- a/Makefile +++ b/Makefile @@ -95,9 +95,37 @@ $(DEB_FILE): $(EXTRACT_DIR)/.extracted @echo " high-performance collaboration with humans and AI." >> $(CONTROL_DIR)/control @echo "Homepage: https://zed.dev" >> $(CONTROL_DIR)/control + # Create postinst script to update icon cache + @echo "#!/bin/sh" > $(CONTROL_DIR)/postinst + @echo "set -e" >> $(CONTROL_DIR)/postinst + @echo "if [ \"\$$1\" = \"configure\" ] || [ \"\$$1\" = \"abort-upgrade\" ] || [ \"\$$1\" = \"abort-deconfigure\" ] || [ \"\$$1\" = \"abort-remove\" ]; then" >> $(CONTROL_DIR)/postinst + @echo " if command -v gtk-update-icon-cache >/dev/null 2>&1; then" >> $(CONTROL_DIR)/postinst + @echo " gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor || true" >> $(CONTROL_DIR)/postinst + @echo " fi" >> $(CONTROL_DIR)/postinst + @echo " if command -v update-desktop-database >/dev/null 2>&1; then" >> $(CONTROL_DIR)/postinst + @echo " update-desktop-database -q /usr/share/applications || true" >> $(CONTROL_DIR)/postinst + @echo " fi" >> $(CONTROL_DIR)/postinst + @echo "fi" >> $(CONTROL_DIR)/postinst + @echo "exit 0" >> $(CONTROL_DIR)/postinst + + # Create postrm script to update icon cache on removal + @echo "#!/bin/sh" > $(CONTROL_DIR)/postrm + @echo "set -e" >> $(CONTROL_DIR)/postrm + @echo "if [ \"\$$1\" = \"remove\" ] || [ \"\$$1\" = \"purge\" ]; then" >> $(CONTROL_DIR)/postrm + @echo " if command -v gtk-update-icon-cache >/dev/null 2>&1; then" >> $(CONTROL_DIR)/postrm + @echo " gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor || true" >> $(CONTROL_DIR)/postrm + @echo " fi" >> $(CONTROL_DIR)/postrm + @echo " if command -v update-desktop-database >/dev/null 2>&1; then" >> $(CONTROL_DIR)/postrm + @echo " update-desktop-database -q /usr/share/applications || true" >> $(CONTROL_DIR)/postrm + @echo " fi" >> $(CONTROL_DIR)/postrm + @echo "fi" >> $(CONTROL_DIR)/postrm + @echo "exit 0" >> $(CONTROL_DIR)/postrm + # Set permissions @chmod 755 $(DEB_DIR)/opt/zed/bin/zed @chmod 755 $(DEB_DIR)/opt/zed/libexec/zed-editor + @chmod 755 $(CONTROL_DIR)/postinst + @chmod 755 $(CONTROL_DIR)/postrm @find $(DEB_DIR)/opt/zed/lib -type f -name "*.so*" -exec chmod 644 {} \; # Build the .deb package