/usr/sbin/xbuild-chroot-setup is in xbuilder 1.0.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #!/bin/bash -e
USER=`whoami`
ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
MIRROR=http://http.debian.net/debian
PORTMIROR=http://http.debian.net/debian
#SUITE=testing
#MIRROR=http://archive.ubuntu.com/ubuntu
#PORTMIRROR=http://ports.ubuntu.com/ubuntu-ports
#DIR=/srv/chroots/precise-cross
#SUITE=precise
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# script to set up a Multiarch sbuild cross-chroot
usage()
{
echo "Usage: ${0##*/} distro chroot-path [--with-qemu] [--mirror=mirror]"
exit 1
}
if [ -z "$1" ] || [ -z "$2" ]; then
usage 1 NEEDSUITETARGET "You must specify a suite and a target."
fi
SUITE="$1"
DIR="$2"
if [ $# != 0 ] ; then
while true ; do
case "$1" in
--help)
usage
exit 0
;;
--with-qemu)
QEMU=true
shift
;;
--mirror|--mirror=?*)
if [ "$1" = "--mirror" -a -n "$2" ] ; then
MIRROR="$2"
shift 2
elif [ "$1" != "${1#--mirror=}" ]; then
MIRROR="${1#--mirror=}"
shift
else
error 1 NEEDARG "option requires an argument %s" "$1"
fi
;;
--*)
error 1 BADARG "unrecognized or invalid option %s" "$1"
;;
*)
break
;; esac
done
fi
echo -e "Making multiarch cross-building chroot for use with sbuild\n Distro: $SUITE\n Chroot created in: $DIR\nPackages retreived from: $MIRROR"
if [ "QEMU" = "true" ]; then
echo "with qemu set up in chroot"
fi
if [ -e $DIR ] ; then
echo "$DIR already exists - This command will overwrite it. Confirm (Y/N)"
read a
if [[ $a == "Y" || $a == "y" || $a = "" ]]; then
:
else
exit 0
fi
fi
add-apt-repository "deb http://ppa.launchpad.net/linaro-foundations/cross-build-tools/ubuntu $SUITE main"
apt-get -q update || :
apt-get -q install schroot sbuild
if [ "QEMU" = "true" ]; then
apt-get -q install qemu-user-static
fi
sbuild-createchroot --components=main,universe $SUITE $DIR $MIRROR
echo "Giving user $USER permissions in the chroot"
sbuild-adduser $USER > /dev/null
echo "Setting up chroot sources.list:"
if [ -n $DIR -a -d $DIR/etc/apt ]; then
echo "deb [arch=amd64,i386] $MIRROR $SUITE main universe" | tee $DIR/etc/apt/sources.list
echo "deb [arch=armhf,armel] $PORTMIRROR $SUITE main universe" |tee -a $DIR/etc/apt/sources.list
echo "deb-src $MIRROR $SUITE main universe" | tee -a $DIR/etc/apt/sources.list
else
echo "$DIR/etc/apt/ does not look like a suitable dir to put deb sources.list - skipped. Set up chroot apt sources manually."
fi
if [ "QEMU" = "true" ]; then
cp /usr/bin/qemu-arm-static $DIR/usr/bin/qemu-arm-static
fi
#sbuild-update --keygen
echo "Your chroot is now ready to use - with: 'sbuild --host=<arch> -d $SUITE -c $SUITE-$ARCH-sbuild <package>'"
|