summaryrefslogtreecommitdiff
path: root/sbuild-stuff
diff options
context:
space:
mode:
Diffstat (limited to 'sbuild-stuff')
-rwxr-xr-xsbuild-stuff51
1 files changed, 51 insertions, 0 deletions
diff --git a/sbuild-stuff b/sbuild-stuff
new file mode 100755
index 0000000..5f282fd
--- /dev/null
+++ b/sbuild-stuff
@@ -0,0 +1,51 @@
+#!/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] <foo.dsc>" >&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"