From ced2bd22a1e837410a186a185c5831a607dab91f Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sat, 15 Sep 2018 23:34:39 +0200 Subject: [PATCH] Improve cpkg. --- src/cpkg | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cpkg b/src/cpkg index fcb1c75..e939d33 100755 --- a/src/cpkg +++ b/src/cpkg @@ -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"