ports/sysutils/debootstrap/files/patch-scripts_debian-common
Edward Tomasz Napierala af9d31c12b sysutils/debootstrap: install mremap(2) apt(8) workaround
Sponsored by:	The FreeBSD Foundation
2021-01-14 14:37:57 +00:00

37 lines
1.5 KiB
Text

--- scripts/debian-common.orig 2020-03-13 02:04:21 UTC
+++ scripts/debian-common
@@ -200,10 +200,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
@@ -222,6 +233,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."