Skip to content

Commit

Permalink
hooks: Add support for new CONTENT file
Browse files Browse the repository at this point in the history
additional minor cleanup in bee-remove to easier support
new CONTENT file
  • Loading branch information
mariux committed May 21, 2012
1 parent 73d7b23 commit 407f531
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion hooks/gconf-install-schemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fi

case "${action}" in
"post-install")
for s in $(grep -o "/.*gconf.*\.schemas" ${BEE_METADIR}/${pkg}/FILES 2>/dev/null) ; do
for s in $(grep -o "/.*gconf.*\.schemas" ${BEE_METADIR}/${pkg}/CONTENT 2>/dev/null) ; do
echo "installing schema '${s##*/}'"
${GCONFTOOL} --install-schema-file ${s} >/dev/null
done
Expand Down
2 changes: 1 addition & 1 deletion hooks/gdk-pixbuf-query-loaders.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if [ -z "${gdk_pixbuf_moduledir}" -o -z "${gdk_pixbuf_cache_file}" ]; then
exit 0
fi

if grep -q "file=${gdk_pixbuf_moduledir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${gdk_pixbuf_moduledir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
rm -f ${gdk_pixbuf_cache_file}
Expand Down
2 changes: 1 addition & 1 deletion hooks/glib-compile-schemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
schema_dir=${dir}/glib-2.0/schemas
if grep -q "file=${schema_dir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${schema_dir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
rm -f ${schema_dir}/gschemas.compiled
Expand Down
2 changes: 1 addition & 1 deletion hooks/gtk-update-icon-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
icon_base_dir=${dir}/icons
for line in $(grep -h "file=${icon_base_dir}/.*/index.theme" ${BEE_METADIR}/${pkg}/FILES) ; do
for line in $(grep -h "file=${icon_base_dir}/.*/index.theme" ${BEE_METADIR}/${pkg}/CONTENT) ; do
eval $(beesep ${line})
icon_dir=${file%%/index.theme}
case "${action}" in
Expand Down
4 changes: 2 additions & 2 deletions hooks/info-dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ fi

case "${action}" in
"post-install")
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/FILES 2>/dev/null) ; do
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/CONTENT 2>/dev/null) ; do
echo "adding ${i##*/} to ${DIRFILE}"
${INSTALLINFO} ${i} ${DIRFILE} >/dev/null
done
;;
"pre-remove")
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/FILES 2>/dev/null) ; do
for i in $(grep -o "${PKG_INFODIR}.*\.info.*" ${BEE_METADIR}/${pkg}/CONTENT 2>/dev/null) ; do
echo "removing ${i##*/} from ${DIRFILE}"
${INSTALLINFO} --delete ${i} ${DIRFILE} >/dev/null
done
Expand Down
2 changes: 1 addition & 1 deletion hooks/ldconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if ! which ldconfig >/dev/null 2>&1 ; then
exit 0
fi

if grep -q "/lib/" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "/lib/" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
ldconfig
Expand Down
4 changes: 2 additions & 2 deletions hooks/mandb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fi
for man_dir in $(beeuniq ${man_dirs//:/ }) ; do
case "${action}" in
"post-install")
for line in $(grep "file=${man_dir}" ${BEE_METADIR}/${pkg}/FILES) ; do
for line in $(grep "file=${man_dir}" ${BEE_METADIR}/${pkg}/CONTENT) ; do
eval $(beesep ${line})
if [ -f "${file}" -o -L "${file}" ] ; then
if [ -f "/var/cache/man/index.db" ] ; then
Expand All @@ -58,7 +58,7 @@ for man_dir in $(beeuniq ${man_dirs//:/ }) ; do
done
;;
"post-remove")
if grep -q "file=${man_dir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${man_dir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
echo "updating manual index cache for ${man_dir} .."
mandb -q ${man_dir}
fi
Expand Down
2 changes: 1 addition & 1 deletion hooks/mkfontdir-mkfontscale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function update_fonts() {

for dir in ${XDG_DATA_DIRS//:/ } ; do
font_base_dir=${dir}/fonts
if grep -q "file=${font_base_dir}" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${font_base_dir}" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
clean_font_dirs ${font_base_dir}
Expand Down
2 changes: 1 addition & 1 deletion hooks/systemd-tmpfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fi

case "${action}" in
"post-install")
if egrep --max-count=1 "file=(/etc|/lib|/usr/lib)/tmpfiles.d" ${BEE_METADIR}/${pkg}/FILES >/dev/null 2>&1 ; then
if egrep --max-count=1 "file=(/etc|/lib|/usr/lib)/tmpfiles.d" ${BEE_METADIR}/${pkg}/CONTENT >/dev/null 2>&1 ; then
systemd-tmpfiles --create
fi
;;
Expand Down
2 changes: 1 addition & 1 deletion hooks/update-desktop-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
desktop_dir=${dir}/applications
if grep -q "file=${desktop_dir}/.*\.desktop" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${desktop_dir}/.*\.desktop" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
rm -f ${desktop_dir}/mimeinfo.cache
Expand Down
2 changes: 1 addition & 1 deletion hooks/update-mime-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

for dir in ${XDG_DATA_DIRS//:/ } ; do
mime_dir=${dir}/mime
if grep -q "file=${mime_dir}/packages" ${BEE_METADIR}/${pkg}/FILES ; then
if grep -q "file=${mime_dir}/packages" ${BEE_METADIR}/${pkg}/CONTENT ; then
case "${action}" in
"post-install")
update-mime-database ${mime_dir}
Expand Down
33 changes: 16 additions & 17 deletions src/bee-remove.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,9 @@ pkg_remove_all() {
pkg_remove() {
search=$1

# pattern is absolute path to pkg
if [ -d "${search}" ] ; then
do_remove "${search}"
return
fi

# pattern is a pkg in BEE_METADIR
if [ -d "${BEE_METADIR}/${search}" ] ; then
do_remove ${BEE_METADIR}/${search}
do_remove ${search}
return
fi

Expand All @@ -62,15 +56,21 @@ pkg_remove() {
do_remove() {
pkg=${1}

FILES=$(${BEE_LIBEXECDIR}/bee/bee.d/bee-dep remove --print ${pkg##*/})
if [ ! -e "${BEE_METADIR}/${pkg}/CONTENT" ] ; then
${BEE_LIBEXECDIR}/bee/compat-filesfile2contentfile \
${BEE_METADIR}/${pkg}/FILES \
>${BEE_METADIR}/${pkg}/CONTENT
fi

FILES=$(${BEE_LIBEXECDIR}/bee/bee.d/bee-dep remove --print ${pkg})
if [ $? -ne 0 ] ; then
echo "removal of ${pkg##*/} failed"
echo "removal of ${pkg} failed"
exit 1
fi

[ "${NOOP}" != "yes" ] && run_hooks pre-remove ${pkg}

echo "removing package '${pkg##*/}'"
echo "removing package '${pkg}'"

# removing files
for f in $FILES ; do
Expand All @@ -83,8 +83,8 @@ do_remove() {

[ "${NOOP}" != "yes" ] && run_hooks post-remove ${pkg}

if [ -r "${pkg}/META" ] ; then
. ${pkg}/META
if [ -r "${BEE_METADIR}/${pkg}/META" ] ; then
. "${BEE_METADIR}/${pkg}/META"
fi

# removing empty basedirs
Expand All @@ -97,15 +97,13 @@ do_remove() {
done
fi

#cleaning up meta directory
if [ -d "${pkg}" ] ; then
${NOOP:+echo} rm -fr ${OPT_VERBOSE:+-v} ${pkg}
fi
#cleanup meta directory
${NOOP:+echo} rm -fr ${OPT_VERBOSE:+-v} ${BEE_METADIR}/${pkg}
}

function run_hooks() {
local action=${1}
local pkg=${2##*/}
local pkg=${2}

for t in ${BEE_LIBEXECDIR}/bee/hooks.d/* ; do
${t} ${action} ${pkg}
Expand Down Expand Up @@ -133,6 +131,7 @@ options=$(${BEE_BINDIR}/beegetopt --name bee-remove \
--option verbose/v \
--option help/h \
-- "$@")

if [ $? != 0 ] ; then
usage
exit 1
Expand Down

0 comments on commit 407f531

Please sign in to comment.