summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2009-02-24 10:02:25 -0800
committerAaron Griffin <aaronmgriffin@gmail.com>2009-02-24 11:41:21 -0800
commitca99683972942fd75ad25eb498ea7d5aec0da2e3 (patch)
tree11994834c7e45902bc4e6f2d326d9d47b21f3ca6
parent1d1eef195996f19b212c6496da9f928c5c38a8be (diff)
makechrootpkg: Add -d to add to local repo
When a package build is complete, it is automatically added to a local db in <chrootdir>/rw/repo/ Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
-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}