Commit 4c56be56 authored by Aaron Griffin's avatar Aaron Griffin
Browse files

Allow makechrootpkg to install package files in the chroot



This is a very very hackish way to deal with rebuilds for
right now.

The intent is the following:
    First build foobar-1.2
    makechrootpkg -i foobar-1.2-1-i686.pkg.tar.gz
    Now build packages that depend on foobar-1.2

Signed-off-by: default avatarAaron Griffin <aaronmgriffin@gmail.com>
parent 17ecb862
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ MAKEPKG_ARGS="-sr"
REPACK=""
WORKDIR=$PWD
clean_first="0"
install_pkg=""

chrootdir="$CHROOT_SHELL"

@@ -45,9 +46,10 @@ usage ()
    exit 1
}

while getopts ':r:h:c' arg; do
while getopts ':r:i:h:c' arg; do
    case "${arg}" in
        r) chrootdir="$OPTARG" ;;
        i) install_pkg="$OPTARG" ;;
        c) clean_first=1 ;;
        h|?) usage ;;
        *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
@@ -114,6 +116,17 @@ fi
mount -t unionfs none -o "dirs=$chrootdir/rw=rw:$chrootdir/root=ro" "$uniondir"
trap 'cleanup' 0 1 2 15

if [ -n "$install_pkg" ]; then
    pkgname="$(basename "$install_pkg")"
    echo "installing '$pkgname' in chroot"
    cp "$install_pkg" "$uniondir/$pkgname"
    mkarchroot -r "pacman -U /$pkgname" "$uniondir"
    ret=$?
    rm "$uniondir/$pkgname"
    #exit early, we've done all we need to
    exit $ret
fi

echo "moving build files to chroot"
[ -d "$uniondir/build" ] || mkdir "$uniondir/build"