Import the latest version of the script upstream

This commit is contained in:
Pierre Pronchery 2020-11-15 20:00:40 +01:00
parent b3b9e1fc16
commit f20fbdd3d0

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2011-2015 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2011-2017 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -28,13 +28,32 @@
PROGNAME="appbroker.sh"
#executables
APPBROKER="AppBroker"
DEBUG="_debug"
#functions
#appbroker
_appbroker()
{
target="$1"
appinterface="$2"
$DEBUG $APPBROKER -o "$target" "$appinterface"
}
#debug
_debug()
{
echo "$@" 1>&3
"$@"
}
#usage
_usage()
{
echo "Usage: $APPBROKER target" 1>&2
echo "Usage: $PROGNAME [-c] target..." 1>&2
return 1
}
@ -50,7 +69,7 @@ while getopts "cO:P:" name; do
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
P)
#we can ignore it
#XXX ignored for compatibility
;;
?)
_usage
@ -58,16 +77,21 @@ while getopts "cO:P:" name; do
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -ne 1 ]; then
shift $((OPTIND - 1))
if [ $# -lt 1 ]; then
_usage
exit $?
fi
[ "$clean" -ne 0 ] && exit 0
target="$1"
source="${target#$OBJDIR}"
APPINTERFACE="${source##*/}"
APPINTERFACE="../data/${APPINTERFACE%%.h}.interface"
$APPBROKER -o "$target" "$APPINTERFACE"
exec 3>&1
while [ $# -gt 0 ]; do
target="$1"
shift
source="${target#$OBJDIR}"
appinterface="${source##*/}"
appinterface="../data/${appinterface%%.h}.interface"
_appbroker "$target" "$appinterface" || exit 2
done