source: trunk/debathena/scripts/chroot-sources @ 25792

Revision 25792, 2.4 KB checked in by jdreed, 11 years ago (diff)
Update for sbuild 0.62.6: - sbuild no longer passes its configuration as environment variables (e.g. SBUILD_BUILD_CONF_DISTRIBUTION). Replace this functionality with our own variable, DEBATHENA_BUILD_DIST - update chroot-sources to use DEBATHENA_BUILD_DIST and fallback to guessing intelligently, rather than constructing invalid sources.list files - update sbuildhack to set the new environment variable (this also requires that the variable be filtered in ~/.sbuildrc) - update daschroot and do-build to set the new environment variable instead of the old one.
  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3# Usage (e.g.): sbuild --chroot-sources=/path/to/chroot-sources
4
5# Adjust /etc/apt/sources.list.d/debathena.list using the
6# DEBATHENA_RELEASE environment variable (set to either "production",
7# "-proposed", or "-development"),
8#
9# If DEBATHENA_RELEASE is unset, assume we're building out of -development.
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.
14
15: ${DEBATHENA_RELEASE=-development}
16: ${DEBATHENA_MIRROR:=http://debathena.mit.edu/apt}
17: ${DEBATHENA_BUILD_DIST:="$SBUILD_BUILD_CONF_DISTRIBUTION"}
18if [ -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
32fi
33if [ -z "$DEBATHENA_BUILD_DIST" ]; then
34    echo "*** ERROR: Cannot determine distribution to build.  Stop." >&2
35    exit 1
36fi
37dist="$DEBATHENA_BUILD_DIST"
38list=/etc/apt/sources.list.d/debathena.list
39
40rm -f "$list"
41
42cat >>"$list" <<EOF
43deb $DEBATHENA_MIRROR $dist debathena debathena-config
44deb-src $DEBATHENA_MIRROR $dist debathena debathena-config
45EOF
46
47if [ "$DEBATHENA_RELEASE" = "-staging" ]; then
48    cat >>"$list" <<EOF
49deb $DEBATHENA_MIRROR ${dist}-staging debathena debathena-config
50deb-src $DEBATHENA_MIRROR ${dist}-staging debathena debathena-config
51EOF
52    DEBATHENA_RELEASE="-development"
53fi
54
55if [ "$DEBATHENA_RELEASE" = "-proposed" ] || [ "$DEBATHENA_RELEASE" = "-development" ]; then
56    cat >>"$list" <<EOF
57deb $DEBATHENA_MIRROR ${dist}-proposed debathena debathena-config
58deb-src $DEBATHENA_MIRROR ${dist}-proposed debathena debathena-config
59EOF
60fi
61
62if [ "$DEBATHENA_RELEASE" = "-development" ]; then
63    cat >>"$list" <<EOF
64deb $DEBATHENA_MIRROR ${dist}-development debathena debathena-config
65deb-src $DEBATHENA_MIRROR ${dist}-development debathena debathena-config
66EOF
67fi
68
69DEBIAN_FRONTEND=noninteractive apt-get update
Note: See TracBrowser for help on using the repository browser.