From c059ea8bcdf9a93e6ef3b638452c93114a60b105 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Tue, 19 Jul 2011 16:11:35 +0200 Subject: [PATCH 01/13] Makefile/bee-install/bee-remove: added auto execution of hooks --- Makefile | 8 ++++++++ src/bee-install.sh.in | 13 +++++++++++++ src/bee-remove.sh.in | 13 +++++++++++++ 3 files changed, 34 insertions(+) diff --git a/Makefile b/Makefile index 9e0df37..6306905 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,8 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module +HELPER_HOOKS_SHELL= + CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc @@ -130,6 +132,12 @@ install-core: build install -m 0644 src/beesh.d/$${i}.sh ${DESTDIR}${LIBEXECDIR}/bee/beesh.d/$${i}.sh ; \ done + @mkdir -p ${DESTDIR}${LIBEXECDIR}/bee/hooks.d + @for i in ${HELPER_HOOKS_SHELL} ; do \ + echo "installing ${DESTDIR}${LIBEXECDIR}/bee/hooks.d/$${i}.sh" ; \ + install -m 0755 src/hooks.d/$${i}.sh ${DESTDIR}${LIBEXECDIR}/bee/hooks.d/$${i}.sh ; \ + done + install-config: @mkdir -p ${DESTDIR}${DEFCONFDIR}/bee diff --git a/src/bee-install.sh.in b/src/bee-install.sh.in index 3898c25..551738a 100755 --- a/src/bee-install.sh.in +++ b/src/bee-install.sh.in @@ -247,6 +247,8 @@ do_install() { # create bee-filename BEE="$(@BINDIR@/beeversion ${pkg} --format="%F").bee" + [ "${NOOP}" != "yes" ] && run_hooks pre-install ${pkg} + taraction="-x" [ "${NOOP}" = "yes" ] && taraction="-t" @@ -260,9 +262,20 @@ do_install() { --transform="s,^PATCHES,${BEE_METADIR}/${pkg}/PATCHES," \ --show-transformed-names + [ "${NOOP}" != "yes" ] && run_hooks post-install ${pkg} + exit $? } +function run_hooks() { + local action=${1} + local pkg=${2} + + for t in ${BEE_LIBEXECDIR}/bee/hooks.d/*.sh ; do + ${t} ${action} ${pkg} + done +} + ############################################################################### ### print_pkg_list ### ## diff --git a/src/bee-remove.sh.in b/src/bee-remove.sh.in index fff3b06..85b3b29 100755 --- a/src/bee-remove.sh.in +++ b/src/bee-remove.sh.in @@ -39,6 +39,8 @@ do_remove() { FILES=$(@BINDIR@/beefind.pl --dump ${pkg}/FILES) + [ "${NOOP}" != "yes" ] && run_hooks pre-remove ${pkg} + # removing files for f in $FILES ; do # test for other pkg @@ -63,12 +65,23 @@ do_remove() { fi done + [ "${NOOP}" != "yes" ] && run_hooks post-remove ${pkg} + #cleaning up meta directory if [ -f ${pkg}/FILES ] ; then ${NOOP:+echo} rm -vfr ${pkg} fi } +function run_hooks() { + local action=${1} + local pkg=${2##*/} + + for t in ${BEE_LIBEXECDIR}/bee/hooks.d/*.sh ; do + ${t} ${action} ${pkg} + done +} + usage() { cat <<-EOF bee-remove v${VERSION} 2009-2011 From cad918481d08b8d56c6140659482da902917341b Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Tue, 19 Jul 2011 16:13:47 +0200 Subject: [PATCH 02/13] hook-tools: update-mime-database.sh - added updating of mime databases --- Makefile | 2 +- src/hooks.d/update-mime-database.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/hooks.d/update-mime-database.sh diff --git a/Makefile b/Makefile index 6306905..f1bbf69 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module -HELPER_HOOKS_SHELL= +HELPER_HOOKS_SHELL=update-mime-database CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc diff --git a/src/hooks.d/update-mime-database.sh b/src/hooks.d/update-mime-database.sh new file mode 100644 index 0000000..01a11a8 --- /dev/null +++ b/src/hooks.d/update-mime-database.sh @@ -0,0 +1,29 @@ +#!/bin/bash +action=${1} +pkg=${2} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + exit 1 +fi + +binaries="update-mime-database" +for bin in ${binaries} ; do + if [ -z "$(which ${bin} 2>/dev/null)" ] ; then + exit 0 + fi +done + +for dir in ${XDG_DATA_DIRS//:/ } ; do + mime_dir=${dir}/mime + if grep -q "${mime_dir}/packages" ${BEE_METADIR}/${pkg}/FILES ; then + case "${action}" in + "post-install") + update-mime-database -V ${mime_dir} + ;; + "post-remove") + update-mime-database -V ${mime_dir} + ;; + esac + fi +done From b96625c88f2d168ac521658de1360bc82de7d88d Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Tue, 19 Jul 2011 16:15:20 +0200 Subject: [PATCH 03/13] hook-tools: glib-compile-schemas.sh - tool to update schemas --- Makefile | 2 +- src/hooks.d/glib-compile-schemas.sh | 33 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/hooks.d/glib-compile-schemas.sh diff --git a/Makefile b/Makefile index f1bbf69..228e50c 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module -HELPER_HOOKS_SHELL=update-mime-database +HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc diff --git a/src/hooks.d/glib-compile-schemas.sh b/src/hooks.d/glib-compile-schemas.sh new file mode 100644 index 0000000..52e4bd5 --- /dev/null +++ b/src/hooks.d/glib-compile-schemas.sh @@ -0,0 +1,33 @@ +#!/bin/bash +action=${1} +pkg=${2} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + exit 1 +fi + +binaries="glib-compile-schemas" +for bin in ${binaries} ; do + if [ -z "$(which ${bin} 2>/dev/null)" ] ; then + exit 0 + fi +done + +for dir in ${XDG_DATA_DIRS//:/ } ; do + schema_dir=${dir}/glib-2.0/schemas + if grep -q ${schema_dir} ${BEE_METADIR}/${pkg}/FILES ; then + case "${action}" in + "post-install") + rm -f ${schema_dir}/gschemas.compiled + glib-compile-schemas ${schema_dir} + ;; + "pre-remove") + rm -f ${schema_dir}/gschemas.compiled + ;; + "post-remove") + glib-compile-schemas ${schema_dir} + ;; + esac + fi +done From ab742fd7c73189e5263dda03482f478b70aa6530 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Tue, 19 Jul 2011 16:16:18 +0200 Subject: [PATCH 04/13] hook-tools: mkfontdir-mkfontscale.sh - tool to update fonts --- Makefile | 2 +- src/hooks.d/mkfontdir-mkfontscale.sh | 52 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/hooks.d/mkfontdir-mkfontscale.sh diff --git a/Makefile b/Makefile index 228e50c..f074e82 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module -HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas +HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas mkfontdir-mkfontscale CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc diff --git a/src/hooks.d/mkfontdir-mkfontscale.sh b/src/hooks.d/mkfontdir-mkfontscale.sh new file mode 100644 index 0000000..fb7f4e6 --- /dev/null +++ b/src/hooks.d/mkfontdir-mkfontscale.sh @@ -0,0 +1,52 @@ +#!/bin/bash +action=${1} +pkg=${2} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + exit 1 +fi + +binaries="mkfontscale mkfontdir" +for bin in ${binaries} ; do + if [ -z "$(which ${bin} 2>/dev/null)" ] ; then + exit 0 + fi +done + +function clean_font_dirs() { + local font_base_dir=${1} + + font_dirs=$(find ${font_base_dir} -mindepth 1 -type d) + for d in ${font_dirs} ; do + rm -f ${d}/fonts.{scale,dir} + done +} + +function update_fonts() { + local font_base_dir=${1} + + font_dirs=$(find ${font_base_dir} -mindepth 1 -type d) + for d in ${font_dirs} ; do + mkfontscale ${d} + mkfontdir ${d} + done +} + +for dir in ${XDG_DATA_DIRS//:/ } ; do + font_base_dir=${dir}/fonts + if grep -q ${font_base_dir} ${BEE_METADIR}/${pkg}/FILES ; then + case "${action}" in + "post-install") + clean_font_dirs ${font_base_dir} + update_fonts ${font_base_dir} + ;; + "pre-remove") + clean_font_dirs ${font_base_dir} + ;; + "post-remove") + update_fonts ${font_base_dir} + ;; + esac + fi +done From fb0c1200830c18771f64bb74e240fa22ca937736 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Tue, 19 Jul 2011 16:17:06 +0200 Subject: [PATCH 05/13] hook-tools: gtk-update-icon-cache.sh - tool to update icon cache --- Makefile | 2 +- src/hooks.d/gtk-update-icon-cache.sh | 32 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/hooks.d/gtk-update-icon-cache.sh diff --git a/Makefile b/Makefile index f074e82..f0e8278 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module -HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas mkfontdir-mkfontscale +HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas mkfontdir-mkfontscale gtk-update-icon-cache CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc diff --git a/src/hooks.d/gtk-update-icon-cache.sh b/src/hooks.d/gtk-update-icon-cache.sh new file mode 100644 index 0000000..383036a --- /dev/null +++ b/src/hooks.d/gtk-update-icon-cache.sh @@ -0,0 +1,32 @@ +#!/bin/bash +action=${1} +pkg=${2} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + 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 + +for dir in ${XDG_DATA_DIRS//:/ } ; do + icon_base_dir=${dir}/icons + for line in $(grep -h "${icon_base_dir}/.*/index.theme" ${BEE_METADIR}/${pkg}/FILES) ; do + eval $(beesep ${line}) + icon_dir=${file%%/index.theme} + case "${action}" in + "post-install") + rm -f ${icon_dir}/icon-theme.cache + gtk-update-icon-cache -f ${icon_dir} + ;; + "pre-remove") + rm -f ${icon_dir}/icon-theme.cache + ;; + esac + done +done From 8ce3e98e4343e381bca77acae91dff05ccc2fc28 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Wed, 20 Jul 2011 09:41:14 +0200 Subject: [PATCH 06/13] hook-tools: ldconfig.sh - new tool to update library database --- Makefile | 3 ++- src/hooks.d/ldconfig.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/hooks.d/ldconfig.sh diff --git a/Makefile b/Makefile index f0e8278..749e51a 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,8 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module -HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas mkfontdir-mkfontscale gtk-update-icon-cache +HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas mkfontdir-mkfontscale gtk-update-icon-cache \ + ldconfig CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc diff --git a/src/hooks.d/ldconfig.sh b/src/hooks.d/ldconfig.sh new file mode 100644 index 0000000..d459197 --- /dev/null +++ b/src/hooks.d/ldconfig.sh @@ -0,0 +1,26 @@ +#!/bin/bash +action=${1} +pkg=${2} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + exit 1 +fi + +binaries="ldconfig" +for bin in ${binaries} ; do + if [ -z "$(which ${bin} 2>/dev/null)" ] ; then + exit 0 + fi +done + +if grep -q "/lib/" ${BEE_METADIR}/${pkg}/FILES ; then + case "${action}" in + "post-install") + ldconfig + ;; + "post-remove") + ldconfig + ;; + esac +fi From 5e6a01e4cc5683aa2616c420fbaecc61fda938f5 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Wed, 20 Jul 2011 11:07:12 +0200 Subject: [PATCH 07/13] hook-tools: update-desktop-database.sh - tool to update mimeinfo cache --- Makefile | 2 +- src/hooks.d/update-desktop-database.sh | 33 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/hooks.d/update-desktop-database.sh diff --git a/Makefile b/Makefile index 749e51a..8305c30 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas mkfontdir-mkfontscale gtk-update-icon-cache \ - ldconfig + ldconfig update-desktop-database CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc diff --git a/src/hooks.d/update-desktop-database.sh b/src/hooks.d/update-desktop-database.sh new file mode 100644 index 0000000..2f6cf01 --- /dev/null +++ b/src/hooks.d/update-desktop-database.sh @@ -0,0 +1,33 @@ +#!/bin/bash +action=${1} +pkg=${2} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + exit 1 +fi + +binaries="update-desktop-database" +for bin in ${binaries} ; do + if [ -z "$(which ${bin} 2>/dev/null)" ] ; then + exit 0 + fi +done + +for dir in ${XDG_DATA_DIRS//:/ } ; do + desktop_dir=${dir}/applications + if grep -q "${desktop_dir}/.*\.desktop" ${BEE_METADIR}/${pkg}/FILES ; then + case "${action}" in + "post-install") + rm -f ${desktop_dir}/mimeinfo.cache + update-desktop-database ${desktop_dir} + ;; + "pre-remove") + rm -f ${desktop_dir}/mimeinfo.cache + ;; + "post-remove") + update-desktop-database ${desktop_dir} + ;; + esac + fi +done From bacbe8ada7a54d89c2c512b28e8f852b9b105338 Mon Sep 17 00:00:00 2001 From: Tobias Dreyer Date: Wed, 20 Jul 2011 11:53:38 +0200 Subject: [PATCH 08/13] hook-tools: gdk-pixbuf-query-loaders.sh - tool to update pixbuf loaders cache --- Makefile | 2 +- src/hooks.d/gdk-pixbuf-query-loaders.sh | 31 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/hooks.d/gdk-pixbuf-query-loaders.sh diff --git a/Makefile b/Makefile index 8305c30..31641a9 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ LIBRARY_SHELL=beelib.config HELPER_BEESH_SHELL=configure cmake autogen perl-module perl-module-makemaker make python-module HELPER_HOOKS_SHELL=update-mime-database glib-compile-schemas mkfontdir-mkfontscale gtk-update-icon-cache \ - ldconfig update-desktop-database + ldconfig update-desktop-database gdk-pixbuf-query-loaders CONFIG_TEMPLATES=fallback CONFIG_FILES=skiplist beerc diff --git a/src/hooks.d/gdk-pixbuf-query-loaders.sh b/src/hooks.d/gdk-pixbuf-query-loaders.sh new file mode 100644 index 0000000..9a94fb8 --- /dev/null +++ b/src/hooks.d/gdk-pixbuf-query-loaders.sh @@ -0,0 +1,31 @@ +#!/bin/bash +action=${1} +pkg=${2} + +if [ -z ${BEE_VERSION} ] ; then + echo >&2 "BEE-ERROR: cannot call $0 from the outside of bee .." + 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 + +cachefile=$(pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0) +if grep -q "gdk-pixbuf-2.0/.*/loaders/.*\.(so|a)" ${BEE_METADIR}/${pkg}/FILES ; then + case "${action}" in + "post-install") + rm -f ${cachefile} + gdk-pixbuf-query-loaders --update-cache + ;; + "pre-remove") + rm -f ${cachefile} + ;; + "post-remove") + gdk-pixbuf-query-loaders --update-cache + ;; + esac +fi From d759b652b77b81caa9b010463f713bd5c773ffc3 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Wed, 20 Jul 2011 14:42:29 +0200 Subject: [PATCH 09/13] hooks: use pkg-config in gdk-pixbuf-query-loaders --- src/hooks.d/gdk-pixbuf-query-loaders.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hooks.d/gdk-pixbuf-query-loaders.sh b/src/hooks.d/gdk-pixbuf-query-loaders.sh index 9a94fb8..5539a48 100644 --- a/src/hooks.d/gdk-pixbuf-query-loaders.sh +++ b/src/hooks.d/gdk-pixbuf-query-loaders.sh @@ -14,15 +14,17 @@ for bin in ${binaries} ; do fi done -cachefile=$(pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0) -if grep -q "gdk-pixbuf-2.0/.*/loaders/.*\.(so|a)" ${BEE_METADIR}/${pkg}/FILES ; then +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) + +if grep -q "${gdk_pixbuf_moduledir}" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in "post-install") - rm -f ${cachefile} + rm -f ${gdk_pixbuf_cache_file} gdk-pixbuf-query-loaders --update-cache ;; "pre-remove") - rm -f ${cachefile} + rm -f ${gdk_pixbuf_cache_file} ;; "post-remove") gdk-pixbuf-query-loaders --update-cache From b12bca186b8f285568b4d59a0c796e9872546f45 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Wed, 20 Jul 2011 14:51:38 +0200 Subject: [PATCH 10/13] 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 From fce50228943a71ed2529fc33a13fbb596eb2f873 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Wed, 20 Jul 2011 14:56:56 +0200 Subject: [PATCH 11/13] hooks: update-mime-database be less verbose --- src/hooks.d/update-mime-database.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks.d/update-mime-database.sh b/src/hooks.d/update-mime-database.sh index d9c75f2..5d157f5 100644 --- a/src/hooks.d/update-mime-database.sh +++ b/src/hooks.d/update-mime-database.sh @@ -16,10 +16,10 @@ for dir in ${XDG_DATA_DIRS//:/ } ; do if grep -q "${mime_dir}/packages" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in "post-install") - update-mime-database -V ${mime_dir} + update-mime-database ${mime_dir} ;; "post-remove") - update-mime-database -V ${mime_dir} + update-mime-database ${mime_dir} ;; esac fi From 8d9264e5c99998ab70509cdfcf5634a0e4f659a6 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Wed, 20 Jul 2011 15:08:22 +0200 Subject: [PATCH 12/13] hooks: grep more specific --- src/hooks.d/gdk-pixbuf-query-loaders.sh | 2 +- src/hooks.d/glib-compile-schemas.sh | 2 +- src/hooks.d/gtk-update-icon-cache.sh | 2 +- src/hooks.d/mkfontdir-mkfontscale.sh | 2 +- src/hooks.d/update-desktop-database.sh | 2 +- src/hooks.d/update-mime-database.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hooks.d/gdk-pixbuf-query-loaders.sh b/src/hooks.d/gdk-pixbuf-query-loaders.sh index 078cc0b..8f660bc 100644 --- a/src/hooks.d/gdk-pixbuf-query-loaders.sh +++ b/src/hooks.d/gdk-pixbuf-query-loaders.sh @@ -14,7 +14,7 @@ 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) -if grep -q "${gdk_pixbuf_moduledir}" ${BEE_METADIR}/${pkg}/FILES ; then +if grep -q "file=${gdk_pixbuf_moduledir}" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in "post-install") rm -f ${gdk_pixbuf_cache_file} diff --git a/src/hooks.d/glib-compile-schemas.sh b/src/hooks.d/glib-compile-schemas.sh index ecc9176..307ccc7 100644 --- a/src/hooks.d/glib-compile-schemas.sh +++ b/src/hooks.d/glib-compile-schemas.sh @@ -13,7 +13,7 @@ fi for dir in ${XDG_DATA_DIRS//:/ } ; do schema_dir=${dir}/glib-2.0/schemas - if grep -q ${schema_dir} ${BEE_METADIR}/${pkg}/FILES ; then + if grep -q "file=${schema_dir}" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in "post-install") rm -f ${schema_dir}/gschemas.compiled diff --git a/src/hooks.d/gtk-update-icon-cache.sh b/src/hooks.d/gtk-update-icon-cache.sh index 1acbc70..c6b80e2 100644 --- a/src/hooks.d/gtk-update-icon-cache.sh +++ b/src/hooks.d/gtk-update-icon-cache.sh @@ -13,7 +13,7 @@ fi for dir in ${XDG_DATA_DIRS//:/ } ; do icon_base_dir=${dir}/icons - for line in $(grep -h "${icon_base_dir}/.*/index.theme" ${BEE_METADIR}/${pkg}/FILES) ; do + for line in $(grep -h "file=${icon_base_dir}/.*/index.theme" ${BEE_METADIR}/${pkg}/FILES) ; do eval $(beesep ${line}) icon_dir=${file%%/index.theme} case "${action}" in diff --git a/src/hooks.d/mkfontdir-mkfontscale.sh b/src/hooks.d/mkfontdir-mkfontscale.sh index 199c016..1b8d7eb 100644 --- a/src/hooks.d/mkfontdir-mkfontscale.sh +++ b/src/hooks.d/mkfontdir-mkfontscale.sh @@ -32,7 +32,7 @@ function update_fonts() { for dir in ${XDG_DATA_DIRS//:/ } ; do font_base_dir=${dir}/fonts - if grep -q ${font_base_dir} ${BEE_METADIR}/${pkg}/FILES ; then + if grep -q "file=${font_base_dir}" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in "post-install") clean_font_dirs ${font_base_dir} diff --git a/src/hooks.d/update-desktop-database.sh b/src/hooks.d/update-desktop-database.sh index fdb89a9..7281f78 100644 --- a/src/hooks.d/update-desktop-database.sh +++ b/src/hooks.d/update-desktop-database.sh @@ -13,7 +13,7 @@ fi for dir in ${XDG_DATA_DIRS//:/ } ; do desktop_dir=${dir}/applications - if grep -q "${desktop_dir}/.*\.desktop" ${BEE_METADIR}/${pkg}/FILES ; then + if grep -q "file=${desktop_dir}/.*\.desktop" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in "post-install") rm -f ${desktop_dir}/mimeinfo.cache diff --git a/src/hooks.d/update-mime-database.sh b/src/hooks.d/update-mime-database.sh index 5d157f5..607ae51 100644 --- a/src/hooks.d/update-mime-database.sh +++ b/src/hooks.d/update-mime-database.sh @@ -13,7 +13,7 @@ fi for dir in ${XDG_DATA_DIRS//:/ } ; do mime_dir=${dir}/mime - if grep -q "${mime_dir}/packages" ${BEE_METADIR}/${pkg}/FILES ; then + if grep -q "file=${mime_dir}/packages" ${BEE_METADIR}/${pkg}/FILES ; then case "${action}" in "post-install") update-mime-database ${mime_dir} From 1b33cbd2bd60636636dc9eb9aee3acb3524f7ae4 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Wed, 20 Jul 2011 15:10:44 +0200 Subject: [PATCH 13/13] bee-install: remove defect pre-install hook --- src/bee-install.sh.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/bee-install.sh.in b/src/bee-install.sh.in index 551738a..b74ec27 100755 --- a/src/bee-install.sh.in +++ b/src/bee-install.sh.in @@ -247,8 +247,6 @@ do_install() { # create bee-filename BEE="$(@BINDIR@/beeversion ${pkg} --format="%F").bee" - [ "${NOOP}" != "yes" ] && run_hooks pre-install ${pkg} - taraction="-x" [ "${NOOP}" = "yes" ] && taraction="-t"