refactor: copy maintainer scripts instead of generating them
All checks were successful
Build and Release Zed Editor / check-version (push) Successful in 3s
Build and Release Zed Editor / build-and-release (push) Has been skipped

This commit is contained in:
Lawrence Deneiple
2025-10-14 11:41:24 +02:00
parent 8aa30934e5
commit 21baf34558
3 changed files with 25 additions and 25 deletions

View File

@@ -116,32 +116,10 @@ $(DEB_FILE): $(EXTRACT_DIR)/.extracted
echo " This package uses system libraries instead of bundled ones." >> $(CONTROL_DIR)/control; \ echo " This package uses system libraries instead of bundled ones." >> $(CONTROL_DIR)/control; \
echo "Homepage: https://zed.dev" >> $(CONTROL_DIR)/control echo "Homepage: https://zed.dev" >> $(CONTROL_DIR)/control
# Create postinst script to update icon cache # Copy maintainer scripts
@echo "Creating maintainer scripts..." @echo "Creating maintainer scripts..."
@echo "#!/bin/sh" > $(CONTROL_DIR)/postinst @cp postinst $(CONTROL_DIR)/postinst
@echo "set -e" >> $(CONTROL_DIR)/postinst @cp postrm $(CONTROL_DIR)/postrm
@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 # Set permissions
@echo "Setting permissions..." @echo "Setting permissions..."

11
postinst Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
set -e
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ]; then
if command -v gtk-update-icon-cache >/dev/null 2>&1; then
gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor || true
fi
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database -q /usr/share/applications || true
fi
fi
exit 0

11
postrm Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
set -e
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
if command -v gtk-update-icon-cache >/dev/null 2>&1; then
gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor || true
fi
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database -q /usr/share/applications || true
fi
fi
exit 0