You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
171 lines
4.7 KiB
171 lines
4.7 KiB
#!/bin/bash
|
|
|
|
# general options
|
|
BUILDPLACE="/var/cache/pbuilder/build/"
|
|
USEPROC=yes
|
|
USEDEVPTS=yes
|
|
USEDEVFS=no
|
|
|
|
# the username and ID used by pbuilder, inside chroot. Needs fakeroot, really
|
|
BUILDUSERID=1234
|
|
BUILDUSERNAME=pbuilder
|
|
|
|
# make debconf not interact with user
|
|
export DEBIAN_FRONTEND="noninteractive"
|
|
DEBEMAIL=""
|
|
|
|
# for pbuilder debuild (sudo -E keeps the environment as-is)
|
|
BUILDSOURCEROOTCMD="fakeroot"
|
|
PBUILDERROOTCMD="sudo -E"
|
|
|
|
# this is necessary for running 'apt-ftparchive' in a hook script if required
|
|
EXTRAPACKAGES="$EXTRAPACKAGES apt-utils"
|
|
|
|
#APT configuration files directory
|
|
APTCONFDIR=""
|
|
|
|
# Set the PATH to be used inside pbuilder
|
|
export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
|
|
# Shell to be used inside pbuilder by commands like 'su'
|
|
export SHELL=/bin/bash
|
|
|
|
# default PKGNAME_LOGFILE
|
|
PKGNAME_LOGFILE="__build__.log"
|
|
|
|
#-- get desired distribution and architecture
|
|
DISTRIBUTION="$DISTRO_NAME"
|
|
[[ "$DISTRO" = "" ]] && DISTRO=$(lsb_release -is | sed -e 's/\(.*\)/\L\1/')
|
|
[[ "$DISTRIBUTION" = "" ]] && DISTRIBUTION=$(lsb_release -cs | sed -e 's/\(.*\)/\L\1/')
|
|
[[ "$ARCHITECTURE" = "" ]] && ARCHITECTURE=$(dpkg --print-architecture)
|
|
|
|
BASETGZ="/var/cache/pbuilder/base-$DISTRIBUTION@$ARCHITECTURE.tgz"
|
|
|
|
#-- select apt components
|
|
case "$DISTRIBUTION" in
|
|
jessie)
|
|
if [[ "$DISTRO" = "devuan" ]]; then
|
|
COMPONENTS="main"
|
|
DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg)
|
|
EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring"
|
|
else
|
|
COMPONENTS="main contrib non-free"
|
|
fi
|
|
;;
|
|
|
|
sid|buster|stretch|wheezy|squeeze)
|
|
COMPONENTS="main contrib non-free"
|
|
;;
|
|
|
|
ceres|beowulf|ascii)
|
|
COMPONENTS="main"
|
|
DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg)
|
|
EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring"
|
|
;;
|
|
|
|
bionic|artful|zesty|yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick)
|
|
COMPONENTS="main restricted universe multiverse"
|
|
DEBOOTSTRAPOPTS=(--variant=buildd)
|
|
;;
|
|
|
|
raspbian-jessie|raspbian-wheezy)
|
|
COMPONENTS="main contrib non-free"
|
|
DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg)
|
|
;;
|
|
esac
|
|
EXTRAPACKAGES="$EXTRAPACKAGES fakeroot apt-transport-https ca-certificates"
|
|
|
|
#-- select base apt sources
|
|
case "$DISTRIBUTION" in
|
|
jessie)
|
|
if [[ "$DISTRO" = "devuan" ]]; then
|
|
MIRRORSITE=http://auto.mirror.devuan.org/merged
|
|
else
|
|
MIRRORSITE=http://deb.debian.org/debian
|
|
fi
|
|
;;
|
|
|
|
sid|buster|stretch|wheezy)
|
|
MIRRORSITE=http://deb.debian.org/debian
|
|
;;
|
|
|
|
squeeze)
|
|
MIRRORSITE=http://archive.debian.org/debian
|
|
;;
|
|
|
|
ceres|beowulf|ascii)
|
|
MIRRORSITE=http://auto.mirror.devuan.org/merged
|
|
;;
|
|
|
|
bionic|artful|zesty|yakkety|wily|vivid|trusty|precise)
|
|
if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then
|
|
MIRRORSITE=http://archive.ubuntu.com/ubuntu
|
|
else
|
|
MIRRORSITE=http://ports.ubuntu.com
|
|
fi
|
|
;;
|
|
|
|
xenial)
|
|
if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then
|
|
MIRRORSITE=http://archive.ubuntu.com/ubuntu
|
|
else
|
|
MIRRORSITE=http://ports.ubuntu.com
|
|
fi
|
|
OTHERMIRROR="deb $MIRRORSITE $DISTRIBUTION-updates $COMPONENTS"
|
|
;;
|
|
|
|
utopic|saucy|raring|quantal|oneiric|natty|maverick)
|
|
MIRRORSITE=http://old-releases.ubuntu.com/ubuntu
|
|
;;
|
|
|
|
raspbian-jessie|raspbian-wheezy)
|
|
MIRRORSITE=http://ftp.fi.muni.cz/pub/linux/raspbian/raspbian
|
|
;;
|
|
esac
|
|
|
|
if [ -n "${ARCHITECTURE}" ]; then
|
|
NAME="$NAME-$ARCHITECTURE"
|
|
DEBOOTSTRAPOPTS=("--arch" "$ARCHITECTURE" "${DEBOOTSTRAPOPTS[@]}")
|
|
fi
|
|
|
|
BUILDRESULT="/var/cache/pbuilder/$DISTRO-$DISTRIBUTION/result/"
|
|
|
|
APTCACHE="/var/cache/pbuilder/aptcache/$DISTRO-$DISTRIBUTION/"
|
|
if [ -n "$APTCACHE" ] && [ ! -d "$APTCACHE" ]; then
|
|
mkdir $APTCACHE
|
|
fi
|
|
if [ -z "$(stat -L --print "%d\n" $APTCACHE/. /var/cache/pbuilder/build/. | uniq -d)" ]; then
|
|
# apt cache for build on tmpfs is managed by hook scripts
|
|
BINDMOUNTS="${BINDMOUNTS} ${APTCACHE}"
|
|
APTCACHEHARDLINK=no
|
|
APTCACHE=""
|
|
fi
|
|
|
|
#-- extra options
|
|
DEBBUILDOPTS="-B"
|
|
if [ "$ARCHITECTURE" == "amd64" ]; then
|
|
DEBBUILDOPTS="-b"
|
|
fi
|
|
if [ "${DISTRIBUTION#raspbian}" != "$DISTRIBUTION" ] && [ "$ARCHITECTURE" == "armhf" ]; then
|
|
DEBBUILDOPTS="-b"
|
|
DISTRIBUTION=${DISTRIBUTION#raspbian-}
|
|
fi
|
|
if [ -z "$DEB_SIGN_KEYID" ]; then
|
|
AUTO_DEBSIGN=${AUTO_DEBSIGN:-no}
|
|
fi
|
|
|
|
#-- choose dependency solver
|
|
#-- apt is better if target distribution contains apt >= 1.4~beta3
|
|
#-- aptitude is better if target distribution contains apt < 1.4~beta3
|
|
case "$DISTRIBUTION" in
|
|
sid|buster|stretch|\
|
|
ceres|beowulf|ascii|\
|
|
bionic|artful|zesty)
|
|
PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt"
|
|
;;
|
|
|
|
jessie|wheezy|squeeze|raspbian-jessie|raspbian-wheezy|\
|
|
yakkety|xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick)
|
|
PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-aptitude"
|
|
;;
|
|
esac
|