[24680] | 1 | #!/bin/bash |
---|
| 2 | |
---|
[24882] | 3 | # Usage (e.g.): sbuild --chroot-sources=/path/to/chroot-sources |
---|
[24680] | 4 | |
---|
| 5 | # Adjust /etc/apt/sources.list.d/debathena.list using the |
---|
[24683] | 6 | # DEBATHENA_RELEASE environment variable (set to either "production", |
---|
[24680] | 7 | # "-proposed", or "-development"), |
---|
| 8 | # |
---|
[24882] | 9 | # If DEBATHENA_RELEASE is unset, assume we're building out of -development. |
---|
[25792] | 10 | # DEBATHENA_BUILD_DIST is the target build distribution. Note: |
---|
| 11 | # SBUILD_BUILD_CONF_DISTRIBUTION is not set as of sbuild 0.60.6 or |
---|
| 12 | # later. An environment_filter in ~/.sbuildrc must be configured to |
---|
| 13 | # allow passing of this variable. |
---|
[24680] | 14 | |
---|
[24882] | 15 | : ${DEBATHENA_RELEASE=-development} |
---|
[24680] | 16 | : ${DEBATHENA_MIRROR:=http://debathena.mit.edu/apt} |
---|
[25792] | 17 | : ${DEBATHENA_BUILD_DIST:="$SBUILD_BUILD_CONF_DISTRIBUTION"} |
---|
| 18 | if [ -z "$DEBATHENA_BUILD_DIST" ]; then |
---|
| 19 | echo "Warning: DEBATHENA_BUILD_DIST is unset or empty!" >&2 |
---|
| 20 | if [ -r /etc/lsb-release ]; then |
---|
| 21 | echo "Attempting to guess dist from lsb-release..." >&2 |
---|
| 22 | . /etc/lsb-release |
---|
| 23 | if [ -n "$DISTRIB_CODENAME" ]; then |
---|
| 24 | DEBATHENA_BUILD_DIST="$DISTRIB_CODENAME" |
---|
| 25 | fi |
---|
| 26 | fi |
---|
| 27 | if [ -z "$DEBATHENA_BUILD_DIST" ] && echo "$SCHROOT_CHROOT_NAME" | \ |
---|
| 28 | egrep -q "^[a-z]+-(amd64|i386)-sbuild$"; then |
---|
| 29 | echo "Attempting to guess dist from chroot name..." >&2 |
---|
| 30 | DEBATHENA_BUILD_DIST=$(echo "$SCHROOT_CHROOT_NAME" | cut -d\- -f 1) |
---|
| 31 | fi |
---|
| 32 | fi |
---|
| 33 | if [ -z "$DEBATHENA_BUILD_DIST" ]; then |
---|
| 34 | echo "*** ERROR: Cannot determine distribution to build. Stop." >&2 |
---|
| 35 | exit 1 |
---|
| 36 | fi |
---|
| 37 | dist="$DEBATHENA_BUILD_DIST" |
---|
[24680] | 38 | list=/etc/apt/sources.list.d/debathena.list |
---|
| 39 | |
---|
| 40 | rm -f "$list" |
---|
| 41 | |
---|
| 42 | cat >>"$list" <<EOF |
---|
| 43 | deb $DEBATHENA_MIRROR $dist debathena debathena-config |
---|
| 44 | deb-src $DEBATHENA_MIRROR $dist debathena debathena-config |
---|
| 45 | EOF |
---|
| 46 | |
---|
[25733] | 47 | if [ "$DEBATHENA_RELEASE" = "-staging" ]; then |
---|
| 48 | cat >>"$list" <<EOF |
---|
| 49 | deb $DEBATHENA_MIRROR ${dist}-staging debathena debathena-config |
---|
| 50 | deb-src $DEBATHENA_MIRROR ${dist}-staging debathena debathena-config |
---|
| 51 | EOF |
---|
| 52 | DEBATHENA_RELEASE="-development" |
---|
| 53 | fi |
---|
| 54 | |
---|
[24680] | 55 | if [ "$DEBATHENA_RELEASE" = "-proposed" ] || [ "$DEBATHENA_RELEASE" = "-development" ]; then |
---|
[24682] | 56 | cat >>"$list" <<EOF |
---|
[24680] | 57 | deb $DEBATHENA_MIRROR ${dist}-proposed debathena debathena-config |
---|
| 58 | deb-src $DEBATHENA_MIRROR ${dist}-proposed debathena debathena-config |
---|
| 59 | EOF |
---|
| 60 | fi |
---|
| 61 | |
---|
| 62 | if [ "$DEBATHENA_RELEASE" = "-development" ]; then |
---|
| 63 | cat >>"$list" <<EOF |
---|
| 64 | deb $DEBATHENA_MIRROR ${dist}-development debathena debathena-config |
---|
| 65 | deb-src $DEBATHENA_MIRROR ${dist}-development debathena debathena-config |
---|
| 66 | EOF |
---|
| 67 | fi |
---|
| 68 | |
---|
| 69 | DEBIAN_FRONTEND=noninteractive apt-get update |
---|