xbps-triggers: update to 0.5.

The code for all triggers is handled in ${FILESDIR} now.
Modify the initramfs-tools trigger to always use relative path for /boot,
and to not mount/umount /proc and /sys, left this for the user.
This commit is contained in:
Juan RP 2010-11-04 13:53:46 +01:00
parent 7f522a8cf4
commit 771ff3b40e
17 changed files with 1018 additions and 5 deletions

View File

@ -0,0 +1,92 @@
#!/bin/sh -e
#
# (Un)registers GConf schemas/entries into the schemas database directory.
#
# The following variables can be defined by a package to register .entries
# and .schemas files:
#
# gconf_entries - A list of .entries files to register. When using this
# variable, packages need to be fixed to not register
# them and to install those files to GCONF_SCHEMAS_DIR.
# gconf_schemas - A list of .schemas files to register. When using this
# variable, packages need to be fixed to not register
# them and to install those files to GCONF_SCHEMAS_DIR.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
# The gconftool-2 binary program.
GCONFTOOL2="usr/bin/gconftool-2"
# Default configuration source (database).
GCONF_CONFIG_SOURCE="xml::/etc/gconf/gconf.xml.defaults"
# Where .schemas files go.
GCONF_SCHEMAS_DIR="usr/share/gconf/schemas"
case "$ACTION" in
targets)
echo "post-install pre-remove"
;;
run)
if [ ! -x "$GCONFTOOL2" ]; then
exit 0
fi
if [ -z "$gconf_entries" -a -z "$gconf_schemas" ]; then
return 0
fi
case "$TARGET" in
post-install)
for f in ${gconf_schemas}; do
GCONF_CONFIG_SOURCE="$GCONF_CONFIG_SOURCE" \
${GCONFTOOL2} --makefile-install-rule \
${GCONF_SCHEMAS_DIR}/${f} >/dev/null
if [ $? -eq 0 ]; then
echo "Registered GConf schema: ${f}."
fi
done
for f in ${gconf_entries}; do
${GCONFTOOL2} --config-source=${GCONF_CONFIG_SOURCE} \
--direct --load ${GCONF_SCHEMAS_DIR}/${f} \
>/dev/null
if [ $? -eq 0 ]; then
echo "Registered GConf entry: ${f}."
fi
done
;;
pre-remove)
for f in ${gconf_entries}; do
${GCONFTOOL2} --config-source=${GCONF_CONFIG_SOURCE} \
--direct --unload ${GCONF_SCHEMAS_DIR}/${f} \
>/dev/null
if [ $? -eq 0 ]; then
echo "Unregistered GConf entry: ${f}."
fi
done
for f in ${gconf_schemas}; do
GCONF_CONFIG_SOURCE="${GCONF_CONFIG_SOURCE}" \
${GCONFTOOL2} --makefile-uninstall-rule \
${GCONF_SCHEMAS_DIR}/${f} >/dev/null
if [ $? -eq 0 ]; then
echo "Unregistered GConf schema: ${f}."
fi
done
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,39 @@
#!/bin/sh -e
#
# Updates GLib GIO module cache with gio-querymodules.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
gioquery=usr/bin/gio-querymodules
giocachedir=usr/lib/gio/modules
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
case "$TARGET" in
post-*)
if [ -x ${gioquery} -a -d ${giocachedir} ]; then
echo "Updating GLib GIO modules cache..."
${gioquery} ${giocachedir}
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,57 @@
#!/bin/sh -e
#
# GLib's GSettings XML schema files.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
# The glib-compile-schemas binary program.
GSCHEMASCOMP="usr/bin/glib-compile-schemas"
# Where .schemas files go.
GLIB_SCHEMAS_DIR="usr/share/glib-2.0/schemas"
case "$ACTION" in
targets)
echo "post-install post-remove pre-remove"
;;
run)
if [ ! -x "$GSCHEMASCOMP" ]; then
exit 0
fi
case "$TARGET" in
post-*)
# Compile all GSettings schema files.
echo -n "Refreshing GSettings database from "
echo -n "${GLIB_SCHEMAS_DIR}... "
${GSCHEMASCOMP} ${GLIB_SCHEMAS_DIR}
if [ $? -eq 0 ]; then
echo "done."
else
echo "failed!"
fi
;;
pre-remove)
if [ "${PKGNAME}" = "glib" ]; then
rm -f ${GLIB_SCHEMAS_DIR}/*.compiled
echo "Removed GSettings database file."
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,51 @@
#!/bin/sh -e
#
# Updates GTK+ icon cache file with gtk-update-icon-cache(1).
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
iconcache_bin=usr/bin/gtk-update-icon-cache
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
if [ "$TARGET" = "post-remove" -a "${PKGNAME}" = "gtk+" ]; then
for dir in ${gtk_iconcache_dirs}; do
if [ -f ${dir}/icon-theme.cache ]; then
rm -f ${dir}/icon-theme.cache
echo -n "Removed GTK+ icon theme "
echo "cache for ${dir}."
fi
done
break
fi
case "$TARGET" in
post-*)
for dir in ${gtk_iconcache_dirs}; do
if [ -x ${iconcache_bin} ]; then
echo -n "Updating GTK+ icon cache for "
echo "${dir}..."
${iconcache_bin} -q -f -t ${dir}
fi
done
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,43 @@
#!/bin/sh -e
#
# Updates GTK+ IM modules file with gtk-query-immodules-2.0(1).
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
immodules_bin=usr/bin/gtk-query-immodules-2.0
immodules_db=etc/gtk-2.0/gtk.immodules
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
if [ "$TARGET" = "post-remove" -a "${PKGNAME}" = "gtk+" ]; then
[ -f ${immodules_db} ] rm -f ${immodules_db}
break
fi
case "$TARGET" in
post-*)
if [ -x ${immodules_bin} ]; then
echo "Updating GTK's immodules database..."
${immodules_bin} > ${immodules_db}
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,47 @@
#!/bin/sh -e
#
# Updates's GDK Pixbuf loaders cache with gdk-pixbuf-query-loaders(1).
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
pixbuf_bin=usr/bin/gdk-pixbuf-query-loaders
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
if [ "$TARGET" = "post-remove" -a "${PKGNAME}" = "gdk-pixbuf" ]; then
_cache_file=$(${pixbuf_bin} --print-cache-file)
[ -f .${_cache_file} ] && rm -f .${_cache_file}
break
fi
case "$TARGET" in
post-*)
if [ -f etc/gtk-2.0/gdk-pixbuf.loaders ]; then
echo " Removing obsolete conf file: etc/gtk-2.0/gdk-pixbuf.loaders"
rm -f etc/gtk-2.0/gdk-pixbuf.loaders
fi
if [ -x ${pixbuf_bin} ]; then
echo "Updating GDK Pixbuf loaders cache..."
${pixbuf_bin} --update-cache
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,58 @@
#!/bin/sh -e
#
# Registers or unregisters info files for a package.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
installinfo=usr/bin/install-info
infodir=usr/share/info
case "$ACTION" in
targets)
echo "post-install pre-remove"
;;
run)
[ ! -x "$installinfo" ] && exit 0
if [ -z "$info_files" ]; then
echo "Trigger info-files: empty info_files."
exit 1
fi
for f in ${info_files}; do
[ "$f" = "/usr/share/info/dir" ] && continue
case "$TARGET" in
post-install)
echo -n "Registering info file: $f... "
;;
pre-remove)
echo -n "Unregistering info file: $f... "
infoargs="--delete"
;;
esac
$installinfo $infoargs ./$f $infodir/dir 2>/dev/null
if [ $? -eq 0 ]; then
echo "done."
else
echo "failed!"
fi
done
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,65 @@
#!/bin/sh -e
#
# Runs update-initramfs(8) to create/update an initramfs for specified
# version (if the pkg that is triggering it) or for the currently
# installed kernel otherwise.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
update_initramfs=usr/sbin/update-initramfs
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
# Exit if the command cannot be executed.
[ ! -x ${update_initramfs} ] && exit 0
# Cannot continue if /proc and /sys not mounted!
if [ ! -e ./proc/filesystems -a ! -e ./sys/kernel/vmcoreinfo ]; then
echo "initramfs-tools trigger:"
echo "WARNING: /proc and /sys (relative to cwd) are not mounted"
echo "WARNING: cannot continue, exiting..."
exit 0
fi
# Always use relative paths to create the initramfs!
initramfs_args="-b ./boot"
if [ "$PKGNAME" = "kernel" -o "$PKGNAME" = "kernel-snapshot" ]; then
if [ "$TARGET" = "post-remove" ]; then
exit 0
fi
if [ ! -f var/lib/initramfs-tools/${VERSION} ]; then
# Create new initramfs
initramfs_args="$initramfs_args -c -t -k ${VERSION}"
else
# Update existing initramfs
initramfs_args="$initramfs_args -B -u -t -k ${VERSION}"
fi
else
# Update initramfs for all kernels
initramfs_args="$initramfs_args -B -u -t -k all"
fi
${update_initramfs} ${initramfs_args}
exit $?
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,38 @@
#!/bin/sh -e
#
# Updates the shared-mime-info db file with update-mime-database(1).
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
mimedb_bin=usr/bin/update-mime-database
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
case "$TARGET" in
post-*)
if [ -x ${mimedb_bin} ]; then
echo "Updating shared-mime-info database..."
${mimedb_bin} usr/share/mime > /dev/null
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,117 @@
#!/bin/sh
#
# Registers or unregisters OpenRC services into the specified
# runlevel. This works by specifying three arguments as follows:
#
# service_name runlevel register
# --------------------------------------------------
# dbus default boolean
# --------------------------------------------------
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
initdir=etc/init.d
metadatadir=var/db/xbps/metadata/${PKGNAME}
case "$ACTION" in
targets)
echo "post-install pre-remove"
;;
run)
[ ! -x sbin/rc-update ] && exit 0
[ ! -x sbin/rc-service ] && exit 0
[ -z "$openrc_services" ] && exit 1
if [ "$TARGET" = "pre-remove" ]; then
rcupdate_args="del"
elif [ "$TARGET" = "post-install" ]; then
rcupdate_args="add"
else
exit 1
fi
[ ! -f etc/fstab ] && touch etc/fstab
set -- ${openrc_services}
while [ $# -gt 0 ]; do
unset skip_service
srv_restart=$metadatadir/.$1_srv_restart
if [ "$TARGET" = "post-install" ]; then
# The service shouldn't be registered, so just show a message
# explaining how to add it in the future.
case "$3" in
[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff]|0)
skip_service=1
;;
[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
unset skip_service
;;
esac
if [ -n "$skip_service" ]; then
cat <<_EOF
================================================================
The system service '${1}' won't be added into the runlevel
'${2}' by default, so it will remain disabled at boot.
To start it at boot time, use the following command:
$ rc-update add ${1} ${2}
To disable it again use:
$ rc-update del ${1} ${2}
================================================================
_EOF
shift; shift; shift;
continue
else
echo "Registering '${1}' service to start at boot."
fi
if [ -f $srv_restart ]; then
# Restart service if it was running previously.
$initdir/$1 start
rm -f $srv_restart
else
# Register service.
if sbin/rc-service -e ${1}; then
sbin/rc-update add ${1} ${2}
fi
fi
else
# While removing always stop the service if running.
$initdir/$1 -q status
if [ $? -eq 0 ]; then
$initdir/$1 stop
fi
#
# While upgrading a package, don't remove the service.
#
if [ "$UPDATE" = "yes" ]; then
touch -f $srv_restart
else
# Unregister the service.
sbin/rc-update del ${1} ${2}
fi
fi
unset srv_restart
shift; shift; shift;
done
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,46 @@
#!/bin/sh -e
#
# Updates the list of pango modules with pango-querymodules(1).
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
pango_bin=usr/bin/pango-querymodules
pango_modules=etc/pango/pango.modules
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
if [ "$TARGET" = "post-remove" -a "${PKGNAME}" = "pango" ]; then
if [ -f ${pango_modules} ]; then
echo "Removing pango modules file..."
rm -f ${pango_modules}
fi
break
fi
case "$TARGET" in
post-*)
if [ -x ${pango_bin} ]; then
echo "Updating pango modules file..."
${pango_bin} > ${pango_modules}
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,66 @@
#!/bin/sh -e
#
# Registers or unregisters a shell in /etc/shells.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
[ "$TARGET" != "post-install" -a "$TARGET" != "post-remove" ] && exit 1
if [ -z "$register_shell" ]; then
echo "Trigger register-shell: empty \$register_shell!"
exit 1
fi
case "$TARGET" in
post-install)
if [ ! -f etc/shells ]; then
for f in ${register_shell}; do
echo $f >> etc/shells
echo "Registered $f into /etc/shells."
done
chmod 644 etc/shells
else
for f in ${register_shell}; do
if ! grep -q $f etc/shells; then
echo $f >> etc/shells
echo -n "Registered $f into "
echo "/etc/shells."
fi
done
fi
;;
post-remove)
if [ -f etc/shells ]; then
for f in ${register_shell}; do
if grep -q $f etc/shells; then
shell=$(echo $f|sed "s|\\/|\\\/|g")
sed -i -e "/$shell/d" etc/shells
echo -n "Unregistered $f from "
echo "/etc/shells."
fi
done
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,84 @@
#!/bin/sh -e
#
# (Un)registers systems accounts (users/groups).
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
useradd_cmd=usr/sbin/useradd
userdel_cmd=usr/sbin/userdel
groupadd_cmd=usr/sbin/groupadd
passwd_cmd=usr/bin/passwd
getent_cmd=usr/bin/getent
case "$ACTION" in
targets)
echo "post-install pre-remove"
;;
run)
if [ ! -x $useradd_cmd -a ! -x $groupadd_cmd -a ! -x $passwd_cmd \
-a ! -x $getent_cmd ]; then
exit 0
fi
if [ -z "$system_accounts" ]; then
exit 0
fi
case "$TARGET" in
post-install)
for acct in ${system_accounts}; do
eval homedir="\$${acct}_homedir"
eval shell="\$${acct}_shell"
eval descr="\$${acct}_descr"
eval groups="\$${acct}_groups"
[ -z "$homedir" ] && homedir="/"
[ -z "$shell" ] && shell="/sbin/nologin"
[ -z "$descr" ] && descr="$acct unpriviledged user"
[ -n "$groups" ] && groups="-G $groups"
if ! $getent_cmd group ${acct} >/dev/null; then
$groupadd_cmd -r ${acct} \
2>&1 >/dev/null || exit $?
echo "Created ${acct} system group."
fi
if ! $getent_cmd passwd ${acct} >/dev/null; then
$useradd_cmd -c "$descr" -d "$homedir" \
-s "$shell" -g ${acct} $groups \
-r ${acct} && \
$passwd_cmd -l ${acct} \
2>&1 >/dev/null || exit $?
echo "Created ${acct} system user."
fi
done
;;
pre-remove)
#
# Only unregister if we aren't updating a package.
#
if [ "$UPDATE" = "no" ]; then
for acct in ${system_accounts}; do
$userdel_cmd ${acct} 2>&1 >/dev/null
if [ $? -eq 0 ]; then
echo "Removed ${acct} system user/group."
fi
done
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,45 @@
#!/bin/sh -e
#
# Updates the MIME database that connects with applications, through
# the update-desktop-database(1) utility.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/post-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
desktopdb_bin=usr/bin/update-desktop-database
desktopdb_dir=usr/share/applications
desktopdb_cache=${desktopdb_dir}/mimeinfo.cache
case "$ACTION" in
targets)
echo "post-install post-remove"
;;
run)
if [ "$TARGET" = "post-remove" -a "${PKGNAME}" = "desktop-file-utils" ]; then
[ -f ${desktopdb_cache} ] && rm -f ${desktopdb_cache}
break
fi
case "$TARGET" in
post-*)
if [ -x ${desktopdb_bin} ]; then
echo "Updating MIME database..."
${desktopdb_bin} ${desktopdb_dir}
fi
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,66 @@
#!/bin/sh -e
#
# This trigger rebuilds the fonts.dir and fonts.scale files
# for packages that install X11 fonts, and update fontconfig's
# cache for those fonts.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
mkfontdir=usr/bin/mkfontdir
mkfontscale=usr/bin/mkfontscale
fccache=usr/bin/fc-cache
case "$ACTION" in
targets)
echo "post-install pre-remove"
;;
run)
if [ ! -x ${mkfontdir} -a ! -x ${mkfontscale} ]; then
exit 0
fi
[ -z "${font_dirs}" ] && exit 0
case "$TARGET" in
post-install)
for dir in ${font_dirs}; do
echo "Building ${dir}/fonts.dir..."
${mkfontdir} .${dir} || exit $?
echo "Building ${dir}/fonts.scale..."
${mkfontscale} .${dir} || exit $?
echo "Updating fontconfig's cache..."
${fccache} .${dir} 2>/dev/null
done
;;
pre-remove)
for dir in ${font_dirs}; do
if [ -f .${dir}/fonts.dir ]; then
rm -f .${dir}/fonts.dir
fi
if [ -f .${dir}/fonts.scale ]; then
rm -f .${dir}/fonts.scale
fi
if [ -f .${dir}/encodings.dir ]; then
rm -f .${dir}/encodings.dir
fi
done
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,94 @@
#!/bin/sh -e
#
# Registers or unregisters SGML/XML catalog entries, through
# the xmlcatmgr application.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
sgml_catalog=usr/share/sgml/catalog
xml_catalog=usr/share/xml/catalog
register_entries()
{
if [ -n "${sgml_entries}" ]; then
echo -n "Registering SGML catalog entries... "
set -- ${sgml_entries}
while [ $# -gt 0 ]; do
xmlcatmgr -sc ${sgml_catalog} add "$1" "$2" "$3"
shift; shift; shift;
done
echo "done."
fi
if [ -n "${xml_entries}" ]; then
echo -n "Registering XML catalog entries... "
set -- ${xml_entries}
while [ $# -gt 0 ]; do
xmlcatmgr -c ${xml_catalog} add "$1" "$2" "$3"
shift; shift; shift;
done
echo "done."
fi
}
unregister_entries()
{
if [ -n "${sgml_entries}" ]; then
echo -n "Unregistering SGML catalog entries... "
set -- ${sgml_entries}
while [ $# -gt 0 ]; do
xmlcatmgr -sc ${sgml_catalog} remove "$1" "$2" \
2>/dev/null
shift; shift; shift
done
echo "done."
fi
if [ -n "${xml_entries}" ]; then
echo -n "Unregistering XML catalog entries... "
set -- ${xml_entries}
while [ $# -gt 0 ]; do
xmlcatmgr -c ${xml_catalog} remove "$1" "$2" \
2>/dev/null
shift; shift; shift
done
echo "done."
fi
}
case "$ACTION" in
targets)
echo "post-install pre-remove"
;;
run)
[ ! -x $xmlcatmgr ] && exit 0
[ -n "${sgml_entries}" -a ! -f "${sgml_catalog}" ] && exit 0
[ -n "${xml_entries}" -a ! -f "${xml_catalog}" ] && exit 0
case "$TARGET" in
post-install)
register_entries
;;
pre-remove)
unregister_entries
;;
*)
exit 1
;;
esac
;;
*)
exit 1
;;
esac
exit 0

View File

@ -1,6 +1,6 @@
# Template file for 'xbps-triggers'
pkgname=xbps-triggers
version=0.4
version=0.5
build_style=custom-install
short_desc="XBPS Package System triggers"
maintainer="Juan RP <xtraeme@gmail.com>"
@ -12,9 +12,14 @@ base_chroot=yes
do_install()
{
install -d ${DESTDIR}/var/db/xbps/triggers
install -m750 ${XBPS_TRIGGERSDIR}/* ${DESTDIR}/var/db/xbps/triggers
for f in $(find ${DESTDIR}/var/db/xbps/triggers); do
echo "# end" >> ${f}
_triggersdir=${DESTDIR}/var/db/xbps/triggers
install -d ${_triggersdir}
for f in ${FILESDIR}/*; do
_trigger=$(basename $f)
install -m750 ${FILESDIR}/${_trigger} \
${_triggersdir}/${_trigger}
echo "# end" >> ${_triggersdir}/${_trigger}
done
}