[Lunar-commits] <moonbase-other> shared-mime-info: add plugin to automatically build the mimecache
v4hn
me at v4hn.de
Mon Jun 3 23:45:27 CEST 2013
commit 554b6b76d285c2c53ea15dc0042887734d45a033
Author: v4hn <me at v4hn.de>
Date: Mon, 03 Jun 2013 14:44:49 -0700
URL: https://github.com/lunar-linux/moonbase-other/commit/554b6b76d285c2c53ea15dc0042887734d45a033
shared-mime-info: add plugin to automatically build the mimecache
---
utils/shared-mime-info/POST_INSTALL | +0/-2
utils/shared-mime-info/plugin.d/postbuild-mimecache.plugin | +29/-0
2 files changed, 29 insertions(+), 2 deletions(-)
--- a/utils/shared-mime-info/POST_INSTALL
+++ /dev/null
@@ -1,2 +0,0 @@
-message "Running update-mime-database..." &&
-update-mime-database /usr/share/mime
--- /dev/null
+++ b/utils/shared-mime-info/plugin.d/postbuild-mimecache.plugin
@@ -0,0 +1,29 @@
+#!/bin/bash
+####################################################################
+# #
+# postbuild-mimecache.plugin - postbuild mime cache refreshing #
+# #
+####################################################################
+# #
+# Copyright 2013 by v4hn @v4hn.de under GPLv2 #
+# #
+####################################################################
+
+
+plugin_mimecache_post_build()
+{
+ if ! type update-mime-database >/dev/null 2>&1; then
+ #just skip this plugin if update-mime-database is not available
+ return 2;
+ fi
+
+ parse_iw | grep -q "^/usr/share/mime/.*"
+ if [ $? -eq 0 ]; then
+ update-mime-database /usr/share/mime
+ fi
+
+ return 2;
+}
+
+
+plugin_register BUILD_POST_BUILD plugin_mimecache_post_build
More information about the Lunar-commits
mailing list