summaryrefslogtreecommitdiffstats
path: root/makechrootpkg
diff options
context:
space:
mode:
Diffstat (limited to 'makechrootpkg')
-rwxr-xr-xmakechrootpkg16
1 files changed, 14 insertions, 2 deletions
diff --git a/makechrootpkg b/makechrootpkg
index c4f47ef..8c3910f 100755
--- a/makechrootpkg
+++ b/makechrootpkg
@@ -17,6 +17,7 @@ WORKDIR=$PWD
update_first="0"
clean_first="0"
install_pkg=""
+add_to_db=0
chrootdir=""
@@ -24,7 +25,7 @@ APPNAME=$(basename "${0}")
usage ()
{
- echo "usage ${APPNAME} [-hcu] -r <chrootdir> [--] [makepkg args]"
+ echo "usage ${APPNAME} [-hcud] -r <chrootdir> [--] [makepkg args]"
echo " ${APPNAME} -r <chrootdir> -I <package-file>"
echo " Run this script in a PKGBUILD dir to build a package inside a"
echo " clean chroot. All unrecognized arguments passed to this script"
@@ -46,16 +47,18 @@ usage ()
echo "-u Update the rw layer of the chroot before building"
echo " This is useful for rebuilds without dirtying the pristine"
echo " chroot"
+ echo "-d Add the package to a local db at /repo after building"
echo "-r <dir> The chroot shell to use"
echo "-I <pkg> Install a package into the rw layer of the chroot"
exit 1
}
-while getopts 'hcur:I:' arg; do
+while getopts 'hcudr:I:' arg; do
case "${arg}" in
h) usage ;;
c) clean_first=1 ;;
u) update_first=1 ;;
+ d) add_to_db=1 ;;
r) chrootdir="$OPTARG" ;;
I) install_pkg="$OPTARG" ;;
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
@@ -218,6 +221,15 @@ chmod +x "$uniondir/chrootbuild"
mkarchroot -r "/chrootbuild" "$uniondir"
source ${WORKDIR}/PKGBUILD
+
+if [ -n "$add_to_db" ]; then
+ [ -d "${chrootdir}/union/repo" ] || mkdir -p "${chrootdir}/union/repo"
+ pushd "${chrootdir}/union/repo" >/dev/null
+ cp ${chrootdir}/union/pkgdest/${pkgname}-${pkgver}-${pkgrel}-*.pkg.tar.gz .
+ repo-add repo.db.tar.gz *.pkg.tar.gz
+ popd >/dev/null
+fi
+
if [ -z "$(mount | grep ${chrootdir}/union/pkgdest)" ]; then
echo "Moving completed package file to ${WORKDIR}"
mv ${chrootdir}/union/pkgdest/${pkgname}-${pkgver}-${pkgrel}-*.pkg.tar.gz ${WORKDIR}