1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-16 16:37:10 +01:00
build/util/pkgcmd.sh
David Oberhollenzer df68358afd Merge run_pkg_command functions
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-01-30 14:02:09 +01:00

27 lines
698 B
Bash

run_pkg_command() {
local FUNCTION="$1"
local DEPLOYDIR="$PKGDEPLOYDIR/$2"
local OUT="$PKGBUILDDIR/${PKGDIR}-${PKGNAME}"
local CHECKFILE="$PKGLOGDIR/.${PKGDIR}-${PKGNAME}-${FUNCTION}"
echo "$PKGNAME - $FUNCTION"
if [ -e "$CHECKFILE" ]; then
return
fi
local LOGFILE="$PKGLOGDIR/${PKGDIR}-${PKGNAME}-${FUNCTION}.log"
local SRC="$PKGSRCDIR/$SRCDIR"
mkdir -p "$DEPLOYDIR" "$OUT" "${DEPLOYDIR}-dev"
pushd "$OUT" > /dev/null
$FUNCTION "$SRC" "$OUT" "$DEPLOYDIR" "${DEPLOYDIR}-dev" &>> "$LOGFILE" < /dev/null
popd > /dev/null
(rmdir "$DEPLOYDIR" || true) 2> /dev/null ;
(rmdir "$OUT" || true) 2> /dev/null ;
(rmdir "${DEPLOYDIR}-dev" || true) 2> /dev/null ;
touch "$CHECKFILE"
}