Created
November 26, 2012 11:46
-
-
Save rubiojr/4147814 to your computer and use it in GitHub Desktop.
My pbuildderrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 2009-04-09 tyler - use previously built packages as an apt source | |
# http://blog.edseek.com/~jasonb/articles/pbuilder_backports/pbuilderbuild.html#pbuilderhook | |
# | |
# Add this hook to ~/.pbuilder-hooks/D10apt-ftparchive and make it executable | |
# | |
echo Calling $0 | |
: ${DIST:=$(lsb_release --short --codename)} | |
: ${ARCH:=$(dpkg --print-architecture)} | |
NAME="$DIST-$ARCH" | |
BUILDRESULT="/var/cache/pbuilder/$NAME/result/" | |
# create apt archive of previously built packages | |
( cd $BUILDRESULT ; apt-ftparchive packages . > $BUILDRESULT/Packages ) | |
# see ~/.pbuilderrc for creation of $BUILDRESULT/Release | |
apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" | |
#PBUILDERSATISFYDEPENDSCMD="~/.pbuilder-satisfydepends-gdebi" | |
# List of Debian suites. | |
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME | |
"unstable" "testing" "stable") | |
# List of Ubuntu suites. Update these when needed. | |
UBUNTU_SUITES=("quantal" "precise" "oneiric" "natty" "maverick" "lucid" "karmic" "jaunty" "hardy") | |
# Mirrors to use. Update these to your preferred mirror. | |
DEBIAN_MIRROR="ftp.us.debian.org" | |
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 certain suite values. | |
if $(echo "experimental UNRELEASED" | grep -q $DIST); then | |
DIST="$UNSTABLE_CODENAME" | |
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 release states in $DIST to their names. | |
case "$DIST" in | |
unstable) | |
DIST="$UNSTABLE_CODENAME" | |
;; | |
testing) | |
DIST="$TESTING_CODENAME" | |
;; | |
stable) | |
DIST="$STABLE_CODENAME" | |
;; | |
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" | |
#BASETGZ="$HOME/pbuilder/$NAME-base.tgz" | |
# Optionally, set BASEPATH (and not BASETGZ) if using cowbuilder | |
# BASEPATH="/var/cache/pbuilder/$NAME/base.cow/" | |
DISTRIBUTION="$DIST" | |
BUILDRESULT="/var/cache/pbuilder/$NAME/result/" | |
#BUILDRESULT="$HOME/pbuilder/$NAME/result/" | |
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/" | |
#APTCACHE="$HOME/pbuilder/$NAME/aptcache/" | |
BUILDPLACE="/var/cache/pbuilder/build/" | |
#BUILDPLACE="$HOME/pbuilder/build/" | |
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then | |
# Debian configuration | |
MIRRORSITE="http://$DEBIAN_MIRROR/debian/" | |
COMPONENTS="main contrib non-free" | |
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg") | |
# This is for enabling backports for the Debian stable suite. | |
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" | |
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg") | |
else | |
echo "Unknown distribution: $DIST" | |
exit 1 | |
fi | |
APTCACHEHARDLINK=no | |
# https://github.com/tehnick/deb_packages/blob/master/_pbuilderrc | |
# Required to install local unsigned packages | |
ALLOWUNTRUSTED=yes | |
# http://wiki.debian.org/PbuilderTricks | |
#OTHERMIRROR="deb file:///var/cache/pbuilder/precise-i386/result ./" | |
#BINDMOUNTS="/var/cache/pbuilder/precise-i386/result/" | |
HOOKDIR="/home/rubiojr/.pbuilder-hooks" | |
#EXTRAPACKAGES="apt-utils" | |
# http://www.tolaris.com/2009/04/09/adding-a-local-respository-to-pbuilder/ | |
# use previously built packages as local respository | |
BINDMOUNTS="$BUILDRESULT" | |
OTHERMIRROR="deb file:$BUILDRESULT ./" | |
# create local repository if it doesn't already exist, | |
# such as during initial 'pbuilder create' | |
if [ ! -d $BUILDRESULT ] ; then | |
mkdir -p $BUILDRESULT | |
# set permissions so I can delete files | |
chgrp adm $BUILDRESULT | |
chmod g+rwx $BUILDRESULT | |
fi | |
if [ ! -e $BUILDRESULT/Packages ] ; then | |
touch $BUILDRESULT/Packages | |
fi | |
if [ ! -e $BUILDRESULT/Release ] ; then | |
cat << EOF > $BUILDRESULT/Release | |
Archive: $DIST | |
Component: main | |
Origin: pbuilder | |
Label: pbuilder | |
Architecture: $ARCH | |
EOF | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment