diff --git a/sysutils/debootstrap/Makefile b/sysutils/debootstrap/Makefile index 97d754cb3b90..a9febc33c241 100644 --- a/sysutils/debootstrap/Makefile +++ b/sysutils/debootstrap/Makefile @@ -1,51 +1,52 @@ PORTNAME= debootstrap PORTVERSION= 1.0.128 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= DEBIAN DISTNAME= ${PORTNAME}_${PORTVERSION} MAINTAINER= nc@FreeBSD.org COMMENT= Install Debian or Ubuntu base system into a directory WWW= https://wiki.debian.org/Debootstrap LICENSE= MIT LICENSE_FILE= ${WRKSRC}/debian/copyright RUN_DEPENDS= wget:ftp/wget \ bash:shells/bash \ ${LOCALBASE}/bin/grep:textproc/gnugrep \ gpgv2:security/gnupg \ ${LOCALBASE}/share/keyrings/ubuntu-archive-keyring.gpg:security/ubuntu-keyring WRKSRC= ${WRKDIR}/${PORTNAME} NO_BUILD= yes NO_ARCH= yes USES= gmake perl5 USE_PERL5= run post-patch: @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \ ${WRKSRC}/Makefile \ ${WRKSRC}/debootstrap @${REINPLACE_CMD} -e 's,%%DATADIR%%,${DATADIR},g' \ ${WRKSRC}/Makefile \ ${WRKSRC}/debootstrap @${REINPLACE_CMD} -e 's,%%LOCALBASE%%,${LOCALBASE},g' \ ${WRKSRC}/Makefile \ ${WRKSRC}/debootstrap @${REINPLACE_CMD} -e 's,gpgv,gpgv2,g' \ ${WRKSRC}/Makefile \ ${WRKSRC}/debootstrap \ ${WRKSRC}/functions @${FIND} ${WRKSRC}/scripts -type f | \ ${XARGS} ${REINPLACE_CMD} -e 's,/usr/share/keyrings,${LOCALBASE}/share/keyrings,g' # Workaround for bin/255525 @${REINPLACE_CMD} -e 's,grep,${LOCALBASE}/bin/grep,g' \ ${WRKSRC}/functions post-install: ${INSTALL_MAN} ${WRKSRC}/debootstrap.8 \ ${STAGEDIR}${MAN8PREFIX}/man/man8/debootstrap.8 .include diff --git a/sysutils/debootstrap/files/patch-Makefile b/sysutils/debootstrap/files/patch-Makefile index 6b4e6b5164d7..db211f5a422d 100644 --- a/sysutils/debootstrap/files/patch-Makefile +++ b/sysutils/debootstrap/files/patch-Makefile @@ -1,21 +1,21 @@ ---- Makefile.orig 2019-07-06 11:22:30 UTC +--- Makefile.orig 2021-04-06 19:52:02 UTC +++ Makefile -@@ -5,14 +5,12 @@ all: +@@ -5,14 +5,13 @@ all: clean: -DSDIR=$(DESTDIR)/usr/share/debootstrap -+DSDIR=$(DESTDIR)%%DATADIR%% ++DSDIR=$(DESTDIR)/usr/local/share/debootstrap install: mkdir -p $(DSDIR)/scripts - mkdir -p $(DESTDIR)/usr/sbin -+ mkdir -p $(DESTDIR)%%PREFIX%%/sbin ++ mkdir -p $(DESTDIR)/usr/local/sbin cp -a scripts/* $(DSDIR)/scripts/ - install -o root -g root -m 0644 functions $(DSDIR)/ + cp -a functions $(DSDIR)/ - sed 's/@VERSION@/$(VERSION)/g' debootstrap >$(DESTDIR)/usr/sbin/debootstrap - chown root:root $(DESTDIR)/usr/sbin/debootstrap -- chmod 0755 $(DESTDIR)/usr/sbin/debootstrap -+ sed 's/@VERSION@/$(VERSION)/g' debootstrap >$(DESTDIR)%%PREFIX%%/sbin/debootstrap + chmod 0755 $(DESTDIR)/usr/sbin/debootstrap ++ sed 's/@VERSION@/$(VERSION)/g' debootstrap >$(DESTDIR)/usr/local/sbin/debootstrap diff --git a/sysutils/debootstrap/files/patch-debootstrap b/sysutils/debootstrap/files/patch-debootstrap index b8b633661c06..82733b633193 100644 --- a/sysutils/debootstrap/files/patch-debootstrap +++ b/sysutils/debootstrap/files/patch-debootstrap @@ -1,47 +1,58 @@ ---- debootstrap.orig 2020-03-13 02:03:08 UTC +--- debootstrap.orig 2022-10-14 11:16:30 UTC +++ debootstrap @@ -1,4 +1,4 @@ -#!/bin/sh -+#!%%LOCALBASE%%/bin/bash ++#!/usr/local/bin/bash set -e VERSION='@VERSION@' @@ -14,7 +14,7 @@ if [ -z "$DEBOOTSTRAP_DIR" ]; then if [ -x /debootstrap/debootstrap ]; then DEBOOTSTRAP_DIR=/debootstrap else - DEBOOTSTRAP_DIR=/usr/share/debootstrap -+ DEBOOTSTRAP_DIR=%%DATADIR%% ++ DEBOOTSTRAP_DIR=/usr/local/share/debootstrap fi fi -@@ -516,13 +516,7 @@ fi +@@ -379,8 +379,8 @@ if [ $# != 0 ] ; then + shift + ;; + --keyring|--keyring=?*) +- if ! gpgv --version >/dev/null 2>&1; then +- error 1 NEEDGPGV "gpgv not installed, but required for Release verification" ++ if ! gpgv2 --version >/dev/null 2>&1; then ++ error 1 NEEDGPGV "gpgv2 not installed, but required for Release verification" + fi + if [ "$1" = "--keyring" ] && [ -n "$2" ]; then + KEYRING="$2" +@@ -536,13 +536,7 @@ fi ########################################################################### -if in_path dpkg && \ - dpkg --print-architecture >/dev/null 2>&1; then - HOST_ARCH=$(/usr/bin/dpkg --print-architecture) -elif in_path udpkg && \ - udpkg --print-architecture >/dev/null 2>&1; then - HOST_ARCH=$(/usr/bin/udpkg --print-architecture) -elif [ -e "$DEBOOTSTRAP_DIR/arch" ]; then +if [ -e "$DEBOOTSTRAP_DIR/arch" ]; then HOST_ARCH=$(cat "$DEBOOTSTRAP_DIR/arch") fi HOST_OS="$HOST_ARCH" -@@ -542,6 +536,14 @@ if [ -z "$HOST_OS" ]; then +@@ -562,6 +556,14 @@ if [ -z "$HOST_OS" ]; then HOST_OS=freebsd ;; esac +fi + +if [ "$HOST_OS" = "freebsd" -a -z "$HOST_ARCH" ]; then + HOST_ARCH=`/sbin/sysctl -n hw.machine_arch` + if [ "$HOST_ARCH" = "aarch64" ]; then + HOST_ARCH=arm64 + fi + EXTRACTOR_OVERRIDE=ar fi if [ -z "$ARCH" ]; then diff --git a/sysutils/debootstrap/files/patch-scripts-gutsy b/sysutils/debootstrap/files/patch-scripts-gutsy index 354c3c57e883..18b91b19d176 100644 --- a/sysutils/debootstrap/files/patch-scripts-gutsy +++ b/sysutils/debootstrap/files/patch-scripts-gutsy @@ -1,51 +1,51 @@ ---- scripts/gutsy.orig 2020-03-13 02:04:21 UTC +--- scripts/gutsy.orig 2023-02-08 17:55:01 UTC +++ scripts/gutsy -@@ -242,10 +242,21 @@ echo \"Warning: Fake initctl called, doing nothing\"" +@@ -296,10 +296,21 @@ echo \"Warning: Fake initctl called, doing nothing\"" 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 -@@ -256,10 +267,13 @@ echo \"Warning: Fake initctl called, doing nothing\"" +@@ -310,10 +321,13 @@ echo \"Warning: Fake initctl called, doing nothing\"" info CONFBASE "Configuring the base system..." + # This step sometimes fails due to some missing functionality in Linuxulator. Just ignore it. + set +e smallyes '' | (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \ dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING + set -e fi if [ -x "$TARGET/sbin/initctl.REAL" ]; then -@@ -267,6 +281,12 @@ echo \"Warning: Fake initctl called, doing nothing\"" +@@ -321,6 +335,12 @@ echo \"Warning: Fake initctl called, doing nothing\"" fi 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." diff --git a/sysutils/debootstrap/files/patch-scripts_debian-common b/sysutils/debootstrap/files/patch-scripts_debian-common index 8027154f25e4..0eb7c31d2064 100644 --- a/sysutils/debootstrap/files/patch-scripts_debian-common +++ b/sysutils/debootstrap/files/patch-scripts_debian-common @@ -1,37 +1,37 @@ ---- scripts/debian-common.orig 2020-03-13 02:04:21 UTC +--- scripts/debian-common.orig 2023-02-08 17:55:01 UTC +++ scripts/debian-common -@@ -200,10 +200,21 @@ echo \"Warning: Fake start-stop-daemon called, doing n +@@ -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 -@@ -222,6 +233,12 @@ echo \"Warning: Fake start-stop-daemon called, doing n +@@ -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."