Skip to content

Instantly share code, notes, and snippets.

@yyuu
Created January 17, 2012 13:01
Show Gist options
  • Select an option

  • Save yyuu/1626558 to your computer and use it in GitHub Desktop.

Select an option

Save yyuu/1626558 to your computer and use it in GitHub Desktop.
/etc/pbuilderrc on sid to build packages for both Debian and Ubuntu
# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="wheezy"
STABLE_CODENAME="squeeze"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
OLDSTABLE_CODENAME="lenny"
# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $OLDSTABLE_CODENAME
"unstable" "testing" "stable" "oldstable")
# List of Ubuntu suites. Update these when needed.
UBUNTU_SUITES=("oneiric" "natty" "maverick" "jaunty" "intrepid" "hardy" "gutsy")
# Mirrors to use. Update these to your preferred mirror.
DEBIAN_MIRROR="cdn.debian.net"
UBUNTU_MIRROR="archive.ubuntu.com"
# Optionally use the changelog of a package to determine the suite to use if
# none set.
if [ -z "${DIST}" ] && [ -r "debian/changelog" ]; then
DIST=$(dpkg-parsechangelog | awk '/^Distribution: / {print $2}')
# Use the unstable suite for Debian experimental packages.
if [ "${DIST}" == "experimental" ]; then
DIST="unstable"
fi
fi
# Optionally set a default distribution if none is used. Note that you can set
# your own default (i.e. ${DIST:="unstable"}).
: ${DIST:="$(lsb_release --short --codename)"}
## Optionally change Debian codenames in $DIST to their aliases.
#case "$DIST" in
# $UNSTABLE_CODENAME)
# DIST="unstable"
# ;;
# $TESTING_CODENAME)
# DIST="testing"
# ;;
# $STABLE_CODENAME)
# DIST="stable"
# ;;
# $OLDSTABLE_CODENAME)
# DIST="oldstable"
# ;;
#esac
# Optionally set the architecture to the host architecture if none set. Note
# that you can set your own default (i.e. ${ARCH:="i386"}).
: ${ARCH:="$(dpkg --print-architecture)"}
NAME="$DIST"
if [ -n "${ARCH}" ]; then
NAME="$NAME-$ARCH"
DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
fi
BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
BUILDPLACE="/var/cache/pbuilder/build/"
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
# Debian configuration
MIRRORSITE="http://$DEBIAN_MIRROR/debian/"
COMPONENTS="main contrib non-free"
# if $(echo "$STABLE_CODENAME stable" | grep -q $DIST); then
# EXTRAPACKAGES="$EXTRAPACKAGES debian-backports-keyring"
# OTHERMIRROR="$OTHERMIRROR | deb http://www.backports.org/debian $STABLE_BACKPORTS_SUITE $COMPONENTS"
# fi
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
# Ubuntu configuration
MIRRORSITE="http://$UBUNTU_MIRROR/ubuntu/"
COMPONENTS="main restricted universe multiverse"
for ((i=0; i<${#DEBOOTSTRAPOPTS[@]}; i++)); do
if test "x--keyring" = "x${PREVIOUS}"; then
DEBOOTSTRAPOPTS[$i]="/usr/share/keyrings/ubuntu-archive-keyring.gpg"
fi
PREVIOUS=${DEBOOTSTRAPOPTS[$i]}
done
else
echo "Unknown distribution: $DIST"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment