summaryrefslogtreecommitdiff
path: root/libre/debootstrap/arch-detect.patch
blob: 8215803587e1eb11e19c23643bb3e8e1fcb52588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/debootstrap b/debootstrap
index fcdb20f..184900d 100755
--- a/debootstrap
+++ b/debootstrap
@@ -427,6 +427,16 @@ elif in_path udpkg && \
 	HOST_ARCH=`/usr/bin/udpkg --print-architecture`
 elif [ -e $DEBOOTSTRAP_DIR/arch ]; then
 	HOST_ARCH=`cat $DEBOOTSTRAP_DIR/arch`
+elif in_path pacman; then
+	# pacman 5.1 will have `pacman-conf Architecture`
+	CARCH="$(bash -c '. /etc/makepkg.conf && echo $CARCH')"
+	case "$CARCH" in
+		"i686")   HOST_ARCH="i386" ;;
+		"x86_64") HOST_ARCH="amd64" ;;
+		"armv7h") HOST_ARCH="armhf" ;;
+		"aarch64") HOST_ARCH="arm64" ;;
+		*) echo "Unknown architecture: $CARCH" && exit 1
+	esac
 fi
 HOST_OS="$HOST_ARCH"
 # basic host OS guessing for non-Debian systems