ports/sysutils/debootstrap/files/patch-debootstrap
Felix Palmen 4e0f740ddc sysutils/debootstrap: Fix several issues
* Don't use substitutions on Makefile, pass variables instead
* Eliminate "static" substitutions, use a patch-file instead
* Fix hardcoded /usr/local in debootstrap script

PR:			269584
Approved by:		nc (maintainer), tcberner (mentor)
Differential Revision:	https://reviews.freebsd.org/D38754
2023-03-07 18:09:28 +01:00

58 lines
1.6 KiB
Text

--- debootstrap.orig 2022-10-14 11:16:30 UTC
+++ debootstrap
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!%%LOCALBASE%%/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%%
fi
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"
@@ -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