Skip to content

Commit

Permalink
shared-mime-info: fix post-install behaviour
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dangowrt committed Nov 9, 2024
1 parent 0b1470b commit 1683d37
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
25 changes: 18 additions & 7 deletions utils/shared-mime-info/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PKG_SOURCE:=shared-mime-info-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/xdg/$(PKG_NAME)/-/archive/$(PKG_VERSION)
PKG_HASH:=32dc32ae39ff1c1bf8434dd3b36770b48538a1772bc0298509d034f057005992

PKG_BUILD_DEPENDS:=gettext-full/host
PKG_BUILD_DEPENDS:=gettext-full/host glib2/host libxml2/host shared-mime-info/host

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
Expand All @@ -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) \
Expand All @@ -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))
3 changes: 3 additions & 0 deletions utils/shared-mime-info/files/shared-mime-info.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

update-mime-database /usr/share/mime/

0 comments on commit 1683d37

Please sign in to comment.