#!/bin/sh # Given a chroot-root and a .tar.gz file, chroots to the chroot # and runs 'make distcheck; make deb; make rpm' on the .tar.gz # file (as $USER, so the chroot should have a user $USER), and # copies the resulting deb/rpm files to the current directory. # This can be used to build deb and rpm files on a different # architecture than the default. if [ -z "$2" ]; then echo "USAGE: $0 <.tar.gz file>" exit 1 fi tgz="$2" helper="$0.helper" tgz_base="`basename $tgz`" helper_base="`basename $helper`" # I tar up $tgz and $helper into one file, and pass it in to the chroot. # The --transform does a 'basename' on the $tgz and $helper files, so # I can write them directly into $HOME in the chroot. tar cf - -P --transform 's,.*/,,' "$tgz" "$helper" | \ sudo chroot "$1" \ sudo -u "$USER" \ sh -x -c "cd $HOME; tar xf -; sh -x './$helper_base' < './$tgz_base'" \ | tar xvf -