#!/bin/bash set -e set -u if [ "${1:-}" == "--binary-only" ]; then BINARY_ARCH="--binary-arch" BINARCH=1 shift else BINARCH=0 fi; DSC="${1:-}"; shift if [ -z "$DSC" ] || [ -z "$BINARCH" ]; then echo "Usage: $0 [--binary-arch] " >&2 exit 1; fi package=`echo $DSC | sed -e 's/_.*//'` debian_version=`echo $DSC | sed -e 's/^[^_]*_//' -e s/\.dsc$//` if [ -z "${DIST:-}" ]; then DIST=sid for d in lenny squeeze wheezy dapper hardy karmic lucid maverick; do if echo $debian_version | grep -q "$d" ; then DIST="$d" break fi done fi if [ -z "${ARCH:-}" ]; then if [ "`uname -m`" = "x86_64" ]; then ARCH="amd64" elif [ "`uname -m`" = "i386" ] || [ "`uname -m`" = "i686" ]; then ARCH="i386" else echo >&2 "Do not know arch" exit 1 fi fi if [ "$BINARCH" = 1 ]; then extra="" else extra="-s --arch-all" fi sbuild --arch="$ARCH" --dist="$DIST" --apt-update $extra "$DSC"