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>
This commit is contained in:
parent
1d1eef1959
commit
ca99683972
|
@ -17,6 +17,7 @@ WORKDIR=$PWD
|
||||||
update_first="0"
|
update_first="0"
|
||||||
clean_first="0"
|
clean_first="0"
|
||||||
install_pkg=""
|
install_pkg=""
|
||||||
|
add_to_db=0
|
||||||
|
|
||||||
chrootdir=""
|
chrootdir=""
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ APPNAME=$(basename "${0}")
|
||||||
|
|
||||||
usage ()
|
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 " ${APPNAME} -r <chrootdir> -I <package-file>"
|
||||||
echo " Run this script in a PKGBUILD dir to build a package inside a"
|
echo " Run this script in a PKGBUILD dir to build a package inside a"
|
||||||
echo " clean chroot. All unrecognized arguments passed to this script"
|
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 "-u Update the rw layer of the chroot before building"
|
||||||
echo " This is useful for rebuilds without dirtying the pristine"
|
echo " This is useful for rebuilds without dirtying the pristine"
|
||||||
echo " chroot"
|
echo " chroot"
|
||||||
|
echo "-d Add the package to a local db at /repo after building"
|
||||||
echo "-r <dir> The chroot shell to use"
|
echo "-r <dir> The chroot shell to use"
|
||||||
echo "-I <pkg> Install a package into the rw layer of the chroot"
|
echo "-I <pkg> Install a package into the rw layer of the chroot"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'hcur:I:' arg; do
|
while getopts 'hcudr:I:' arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
h) usage ;;
|
h) usage ;;
|
||||||
c) clean_first=1 ;;
|
c) clean_first=1 ;;
|
||||||
u) update_first=1 ;;
|
u) update_first=1 ;;
|
||||||
|
d) add_to_db=1 ;;
|
||||||
r) chrootdir="$OPTARG" ;;
|
r) chrootdir="$OPTARG" ;;
|
||||||
I) install_pkg="$OPTARG" ;;
|
I) install_pkg="$OPTARG" ;;
|
||||||
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
|
||||||
|
@ -218,6 +221,15 @@ chmod +x "$uniondir/chrootbuild"
|
||||||
mkarchroot -r "/chrootbuild" "$uniondir"
|
mkarchroot -r "/chrootbuild" "$uniondir"
|
||||||
|
|
||||||
source ${WORKDIR}/PKGBUILD
|
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
|
if [ -z "$(mount | grep ${chrootdir}/union/pkgdest)" ]; then
|
||||||
echo "Moving completed package file to ${WORKDIR}"
|
echo "Moving completed package file to ${WORKDIR}"
|
||||||
mv ${chrootdir}/union/pkgdest/${pkgname}-${pkgver}-${pkgrel}-*.pkg.tar.gz ${WORKDIR}
|
mv ${chrootdir}/union/pkgdest/${pkgname}-${pkgver}-${pkgrel}-*.pkg.tar.gz ${WORKDIR}
|
||||||
|
|
Loading…
Reference in New Issue