diff --git a/srcpkgs/xbps-triggers/files/binfmts b/srcpkgs/xbps-triggers/files/binfmts new file mode 100755 index 0000000000..596e0c5d10 --- /dev/null +++ b/srcpkgs/xbps-triggers/files/binfmts @@ -0,0 +1,58 @@ +#!/bin/sh +# +# binfmts trigger. +# +# Binaries can be specified like: +# binfmts=" [ ...]" +# +# Arguments: $ACTION = [run/targets] +# $TARGET = [post-install/pre-remove] +# $PKGNAME +# $VERSION +# $UPDATE = [yes/no] +# +ACTION="$1" +TARGET="$2" +PKGNAME="$3" +VERSION="$4" +UPDATE="$5" + +export PATH="usr/bin:usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin" + +case "$ACTION" in +targets) + echo "post-install pre-remove" + ;; +run) + [ -x /usr/bin/update-binfmts ] || exit 0 + [ -z "${binfmts}" ] && exit 0 + + case "$TARGET" in + post-install) + echo "${binfmts}" | while read line; do + set -- ${line} + _bin="$1"; shift; _args="$@"; _bname="$(basename ${_bin})" + update-binfmts --package ${PKGNAME} --install ${_bname} ${_bin} ${_args} + done + ;; + pre-remove) + echo "${binfmts}" | while read line; do + set -- ${line} + _bin="$1"; shift; _args="$@"; _bname="$(basename ${_bin})" + if [ -f /var/lib/binfmts/${_bname} ]; then + update-binfmts --package ${PKGNAME} --remove ${_bname} ${_bin} + fi + done + ;; + *) + exit 1 + ;; + esac + ;; +*) + exit 1 + ;; +esac + +exit 0 +# end diff --git a/srcpkgs/xbps-triggers/template b/srcpkgs/xbps-triggers/template index 825357859a..c52d5517db 100644 --- a/srcpkgs/xbps-triggers/template +++ b/srcpkgs/xbps-triggers/template @@ -1,6 +1,6 @@ # Template file for 'xbps-triggers' pkgname=xbps-triggers -version=0.99 +version=0.100 revision=1 noarch=yes bootstrap=yes