Improve cpkg.

This commit is contained in:
Faerbit 2018-09-15 23:34:39 +02:00
parent 67aaa66cea
commit ced2bd22a1

View File

@ -6,6 +6,7 @@ cleanup() {
return
fi
rm -rf $PKGDIR
rm -f $SCRIPT
}
trap cleanup EXIT
@ -18,6 +19,8 @@ then
shift
PKGDIR="$1"
shift
SCRIPT=$1
shift
fi
if [ $# -eq 0 ]
@ -35,10 +38,19 @@ then
exit 1
fi
PKGDIR=$(mktemp -d)
fakeroot -- $0 -F "$PKGDIR" "$@" || exit $?
SCRIPT=$(mktemp)
fakeroot -- $0 -F "$PKGDIR" "$SCRIPT" "$@" || exit $?
else
env DESTDIR=$PKGDIR "$@"
echo -e '#!/bin/bash\n' > $SCRIPT
echo "$@" >> $SCRIPT
chmod +x $SCRIPT
env DESTDIR=$PKGDIR $SCRIPT
PKGNAME=$(basename $(pwd))
if [ $PKGNAME = "build" ]
then
PKGNAME=$(basename $(cd ..;pwd))
fi
PKGDEST="${FPKG_ROOT}/pkg"