summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts/local/additional_files/etc/pbuilderrc
blob: 8f4d36184469d77b782134d4fcacaa40d4208851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/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
  # debian
	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|bullseye|buster|stretch|wheezy)
		COMPONENTS="main contrib non-free"
		;;

  # devuan
	ceres|beowulf|ascii)
		COMPONENTS="main"
		DEBOOTSTRAPOPTS=(--variant=buildd --no-check-gpg)
		EXTRAPACKAGES="$EXTRAPACKAGES devuan-keyring"
		;;

  # ubuntu
	focal|eoan|disco|cosmic|bionic|xenial|trusty)
		COMPONENTS="main restricted universe multiverse"
		DEBOOTSTRAPOPTS=(--variant=buildd)
		;;

  # raspbian
	raspbian-bullseye|raspbian-buster|raspbian-stretch|raspbian-jessie)
		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
  # debian
	sid|bullseye|buster|stretch)
		MIRRORSITE=http://deb.debian.org/debian
		;;

	jessie)
		if [[ "$DISTRO" = "devuan" ]]; then
			MIRRORSITE=http://auto.mirror.devuan.org/merged
		else
			MIRRORSITE=http://deb.debian.org/debian
		fi
		;;

	wheezy)
		MIRRORSITE=http://archive.debian.org/debian
		;;

  # devuan
	ceres|beowulf|ascii)
		MIRRORSITE=http://auto.mirror.devuan.org/merged
		;;

  # ubuntu
	focal|eoan|disco|cosmic|bionic|xenial|trusty)
		if [ "$ARCHITECTURE" = "amd64" ] || [ "$ARCHITECTURE" = "i386" ]; then
			MIRRORSITE=http://archive.ubuntu.com/ubuntu
		else
			MIRRORSITE=http://ports.ubuntu.com
		fi
		;;

  # raspbian
	raspbian-bullseye|raspbian-buster|raspbian-stretch|raspbian-jessie)
		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 [ -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|bullseye|buster|stretch|\
  ceres|beowulf|ascii|\
  raspbian-bullseye|raspbian-buster|raspbian-stretch|\
  focal|eoan|disco|cosmic|bionic)
    PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt"
    ;;

  jessie|wheezy|\
  raspbian-jessie|\
  xenial|trusty)
    PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-aptitude"
    ;;
esac