Skip to content

Instantly share code, notes, and snippets.

@matlo
Last active September 24, 2022 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matlo/c78d200ab0cc541293958a15ecc6153d to your computer and use it in GitHub Desktop.
Save matlo/c78d200ab0cc541293958a15ecc6153d to your computer and use it in GitHub Desktop.
.pbuilderrc and commands to build packages on Ubuntu
source: https://jodal.no/2015/03/08/building-arm-debs-with-pbuilder/
sudo apt install pbuilder qemu-user-static
sudo apt install ubuntu-keyring debian-archive-keyring
wget http://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb
sudo dpkg -i raspbian-archive-keyring_20120528.2_all.deb
sudo OS=ubuntu DIST=xenial ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=xenial ARCH=i386 pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder --create
OS=raspbian DIST=wheezy ARCH=armhf pdebuild
#!/bin/sh
set -e
if [ "$OS" == "debian" ]; then
MIRRORSITE="http://ftp.no.debian.org/debian/"
COMPONENTS="main contrib non-free"
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
"--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
: ${DIST:="jessie"}
: ${ARCH:="amd64"}
elif [ "$OS" == "raspbian" ]; then
MIRRORSITE="https://archive.raspbian.org/raspbian/"
COMPONENTS="main contrib non-free"
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
"--keyring=/usr/share/keyrings/raspbian-archive-keyring.gpg")
: ${DIST:="stretch"}
: ${ARCH:="armhf"}
elif [ "$OS" == "ubuntu" ]; then
MIRRORSITE=http://ubuntu.mirrors.ovh.net/ubuntu/
COMPONENTS="main restricted universe multiverse"
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
"--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
else
echo "Unknown OS: $OS"
exit 1
fi
if [ "$DIST" == "" ]; then
echo "DIST is not set"
exit 1
fi
if [ "$ARCH" == "" ]; then
echo "ARCH is not set"
exit 1
fi
NAME="$OS-$DIST-$ARCH"
if [ "$ARCH" == "armel" ] && [ "$(dpkg --print-architecture)" != "armel" ]; then
DEBOOTSTRAP="qemu-debootstrap"
fi
if [ "$ARCH" == "armhf" ] && [ "$(dpkg --print-architecture)" != "armhf" ]; then
DEBOOTSTRAP="qemu-debootstrap"
fi
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--arch=$ARCH")
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"
HOOKDIR="/var/cache/pbuilder/hook.d/"
PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-gdebi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment