void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

update-desktopdb (895B)


      1#!/bin/sh
      2#
      3# Updates the MIME database that connects with applications, through
      4# the update-desktop-database(1) utility.
      5#
      6# Arguments:	$ACTION = [run/targets]
      7#		$TARGET = [post-install/post-remove]
      8#		$PKGNAME
      9#		$VERSION
     10#		$UPDATE = [yes/no]
     11#
     12ACTION="$1"
     13TARGET="$2"
     14PKGNAME="$3"
     15VERSION="$4"
     16UPDATE="$5"
     17
     18desktopdb_bin=usr/bin/update-desktop-database
     19desktopdb_dir=usr/share/applications
     20desktopdb_cache=${desktopdb_dir}/mimeinfo.cache
     21
     22case "$ACTION" in
     23targets)
     24	echo "post-install post-remove"
     25	;;
     26run)
     27	if [ "$TARGET" = "post-remove" -a "${PKGNAME}" = "desktop-file-utils" ]; then
     28		[ -f ${desktopdb_cache} ] && rm -f ${desktopdb_cache}
     29		exit 0
     30	fi
     31	case "$TARGET" in
     32	post-*)
     33		if [ ! -x $desktopdb_bin ]; then
     34			exit 0
     35		fi
     36
     37		if [ -d $desktopdb_dir ]; then
     38			echo "Updating MIME database..."
     39			${desktopdb_bin} ${desktopdb_dir}
     40		fi
     41		;;
     42	esac
     43	;;
     44*)
     45	exit 1
     46	;;
     47esac
     48
     49exit 0