summaryrefslogtreecommitdiff
path: root/sbuild-stuff
blob: 5f282fd1eeb01845cf937c98a04c4639c74f9f84 (plain)
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
#!/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"