shared-mime-info: fix post-install behaviour
authorDaniel Golle <daniel@makrotopia.org>
Tue, 5 Nov 2024 03:18:16 +0000 (03:18 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 12 Nov 2024 17:22:59 +0000 (17:22 +0000)
Move post-install script to /etc/uci-defaults so it always runs on the
target and doesn't require the host to provide 'update-mime-database'.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
utils/shared-mime-info/Makefile
utils/shared-mime-info/files/shared-mime-info.defaults [new file with mode: 0644]

index 5e25608de55259c99d51f2c2fa4c84113c9a7641..6be0a75c8fbf33cb74adec84e2511698f85ca31f 100644 (file)
@@ -36,6 +36,19 @@ define Package/shared-mime-info/description
        The shared-mime-info package contains a database of MIME types and their file extensions.
 endef
 
+MESON_ARG += \
+       -Dbuild-tests=false \
+       -Dupdate-mimedb=false \
+       -Dbuild-tools=true \
+       -Dbuild-translations=false
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/pkgconfig/shared-mime-info.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
 define Package/shared-mime-info/install
        $(INSTALL_DIR) $(1)/usr/bin/
        $(CP) \
@@ -45,12 +58,10 @@ define Package/shared-mime-info/install
        $(CP) \
                $(PKG_INSTALL_DIR)/usr/share/* \
                $(1)/usr/share/
-endef
-
-define Package/shared-mime-info/postinst
-#!/bin/sh
-
-update-mime-database /usr/share/mime/
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_DATA) \
+               ./files/shared-mime-info.defaults \
+               $(1)/etc/uci-defaults/90-shared-mime-info
 endef
 
 $(eval $(call BuildPackage,shared-mime-info))
diff --git a/utils/shared-mime-info/files/shared-mime-info.defaults b/utils/shared-mime-info/files/shared-mime-info.defaults
new file mode 100644 (file)
index 0000000..0a46727
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+update-mime-database /usr/share/mime/