From b12bca186b8f285568b4d59a0c796e9872546f45 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Wed, 20 Jul 2011 14:51:38 +0200 Subject: [PATCH] hooks: change way of checking for binaries --- src/hooks.d/gdk-pixbuf-query-loaders.sh | 9 +++------ src/hooks.d/glib-compile-schemas.sh | 9 +++------ src/hooks.d/gtk-update-icon-cache.sh | 9 +++------ src/hooks.d/ldconfig.sh | 13 +++++++------ src/hooks.d/mkfontdir-mkfontscale.sh | 9 +++------ src/hooks.d/update-desktop-database.sh | 9 +++------ src/hooks.d/update-mime-database.sh | 9 +++------ 7 files changed, 25 insertions(+), 42 deletions(-) diff --git a/src/hooks.d/gdk-pixbuf-query-loaders.sh b/src/hooks.d/gdk-pixbuf-query-loaders.sh index 5539a48..078cc0b 100644 --- a/src/hooks.d/gdk-pixbuf-query-loaders.sh +++ b/src/hooks.d/gdk-pixbuf-query-loaders.sh @@ -7,12 +7,9 @@ if [ -z ${BEE_VERSION} ] ; then exit 1 fi -binaries="gdk-pixbuf-query-loaders" -for bin in ${binaries} ; do - if [ -z "$(which ${bin} 2>/dev/null)" ] ; then - exit 0 - fi -done +if ! which gdk-pixbuf-query-loaders >/dev/null 2>&1 ; then + exit 0 +fi gdk_pixbuf_moduledir=$(pkg-config --variable=gdk_pixbuf_moduledir gdk-pixbuf-2.0) gdk_pixbuf_cache_file=$(pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0) diff --git a/src/hooks.d/glib-compile-schemas.sh b/src/hooks.d/glib-compile-schemas.sh index 52e4bd5..ecc9176 100644 --- a/src/hooks.d/glib-compile-schemas.sh +++ b/src/hooks.d/glib-compile-schemas.sh @@ -7,12 +7,9 @@ if [ -z ${BEE_VERSION} ] ; then exit 1 fi -binaries="glib-compile-schemas" -for bin in ${binaries} ; do - if [ -z "$(which ${bin} 2>/dev/null)" ] ; then - exit 0 - fi -done +if ! which glib-compile-schemas >/dev/null 2>&1 ; then + exit 0 +fi for dir in ${XDG_DATA_DIRS//:/ } ; do schema_dir=${dir}/glib-2.0/schemas diff --git a/src/hooks.d/gtk-update-icon-cache.sh b/src/hooks.d/gtk-update-icon-cache.sh index 383036a..1acbc70 100644 --- a/src/hooks.d/gtk-update-icon-cache.sh +++ b/src/hooks.d/gtk-update-icon-cache.sh @@ -7,12 +7,9 @@ if [ -z ${BEE_VERSION} ] ; then exit 1 fi -binaries="gtk-update-icon-cache" -for bin in ${binaries} ; do - if [ -z "$(which ${bin} 2>/dev/null)" ] ; then - exit 0 - fi -done +if ! which gtk-update-icon-cache >/dev/null 2>&1 ; then + exit 0 +fi for dir in ${XDG_DATA_DIRS//:/ } ; do icon_base_dir=${dir}/icons diff --git a/src/hooks.d/ldconfig.sh b/src/hooks.d/ldconfig.sh index d459197..385b0fc 100644 --- a/src/hooks.d/ldconfig.sh +++ b/src/hooks.d/ldconfig.sh @@ -7,12 +7,13 @@ if [ -z ${BEE_VERSION} ] ; then exit 1 fi -binaries="ldconfig" -for bin in ${binaries} ; do - if [ -z "$(which ${bin} 2>/dev/null)" ] ; then - exit 0 - fi -done +if [ ${UID} -ne 0 ] ; then + exit 0 +fi + +if ! which ldconfig >/dev/null 2>&1 ; then + exit 0 +fi if grep -q "/lib/" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in diff --git a/src/hooks.d/mkfontdir-mkfontscale.sh b/src/hooks.d/mkfontdir-mkfontscale.sh index fb7f4e6..199c016 100644 --- a/src/hooks.d/mkfontdir-mkfontscale.sh +++ b/src/hooks.d/mkfontdir-mkfontscale.sh @@ -7,12 +7,9 @@ if [ -z ${BEE_VERSION} ] ; then exit 1 fi -binaries="mkfontscale mkfontdir" -for bin in ${binaries} ; do - if [ -z "$(which ${bin} 2>/dev/null)" ] ; then - exit 0 - fi -done +if ! which mkfontscale mkfontdir >/dev/null 2>&1 ; then + exit 0 +fi function clean_font_dirs() { local font_base_dir=${1} diff --git a/src/hooks.d/update-desktop-database.sh b/src/hooks.d/update-desktop-database.sh index 2f6cf01..fdb89a9 100644 --- a/src/hooks.d/update-desktop-database.sh +++ b/src/hooks.d/update-desktop-database.sh @@ -7,12 +7,9 @@ if [ -z ${BEE_VERSION} ] ; then exit 1 fi -binaries="update-desktop-database" -for bin in ${binaries} ; do - if [ -z "$(which ${bin} 2>/dev/null)" ] ; then - exit 0 - fi -done +if ! which update-desktop-database >/dev/null 2>&1 ; then + exit 0 +fi for dir in ${XDG_DATA_DIRS//:/ } ; do desktop_dir=${dir}/applications diff --git a/src/hooks.d/update-mime-database.sh b/src/hooks.d/update-mime-database.sh index 01a11a8..d9c75f2 100644 --- a/src/hooks.d/update-mime-database.sh +++ b/src/hooks.d/update-mime-database.sh @@ -7,12 +7,9 @@ if [ -z ${BEE_VERSION} ] ; then exit 1 fi -binaries="update-mime-database" -for bin in ${binaries} ; do - if [ -z "$(which ${bin} 2>/dev/null)" ] ; then - exit 0 - fi -done +if ! which update-mime-database >/dev/null 2>&1 ; then + exit 0 +fi for dir in ${XDG_DATA_DIRS//:/ } ; do mime_dir=${dir}/mime