xbps-trigger: added binfmts

This commit is contained in:
Andrea Brancaleoni 2015-06-18 10:31:08 +02:00
parent f5a23cc275
commit 359830c45c
2 changed files with 59 additions and 1 deletions

View file

@ -0,0 +1,58 @@
#!/bin/sh
#
# binfmts trigger.
#
# Binaries can be specified like:
# binfmts="<path> [<args> ...]"
#
# 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

View file

@ -1,6 +1,6 @@
# Template file for 'xbps-triggers'
pkgname=xbps-triggers
version=0.99
version=0.100
revision=1
noarch=yes
bootstrap=yes