summaryrefslogtreecommitdiff
path: root/sysutils/debootstrap/files/patch-scripts_debian-common
blob: 0eb7c31d20642a9a3eeb162c3a3c4b804fc08848 (plain) (blame)
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
--- scripts/debian-common.orig	2023-02-08 17:55:01 UTC
+++ scripts/debian-common
@@ -215,10 +215,21 @@ echo \"Warning: Fake start-stop-daemon called, doing n
 		predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
 		# XXX: progress is tricky due to how dpkg_progress works
 		# -- cjwatson 2009-07-29
+		# This step sometimes fails due to some missing functionality in Linuxulator.  Just ignore it.
+		set +e
 		p; smallyes '' |
 		in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
+		rc=$?
 		base=$(without "$base" "$predep")
 		done_predeps="$done_predeps $predep"
+
+		if [ $rc != 0 ]; then
+			warning FREEBSD_00 "Applying FreeBSD-specific workaround..."
+			# ... for "Failed to mount /etc/machine-id: Bad address" with Focal.
+			in_target truncate -s0 /var/lib/dpkg/info/systemd.postinst
+			in_target dpkg --configure systemd
+		fi
+		set -e
 	done
 
 	if [ -n "$base" ]; then
@@ -237,6 +248,12 @@ echo \"Warning: Fake start-stop-daemon called, doing n
 
 	mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
 	rm -f "$TARGET/usr/sbin/policy-rc.d"
+
+	echo \
+"# Workaround for Linuxulator missing mremap(2) support; without it,
+# apt(8) fails like this:
+# E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start.
+APT::Cache-Start 251658240;" >> "$TARGET/etc/apt/apt.conf.d/00freebsd"
 
 	progress $bases $bases CONFBASE "Configuring base system"
 	info BASESUCCESS "Base system installed successfully."