summaryrefslogtreecommitdiff
path: root/libre/debootstrap/arch-detect.patch
blob: 20e5ff6827f5967bf4953945ab162b7bdc1cb068 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- a/debootstrap	2016-03-22 21:13:58.000000000 +0800
+++ b/debootstrap	2016-03-22 21:13:09.573621800 +0800
@@ -419,6 +419,15 @@
 	HOST_ARCH=`/usr/bin/udpkg --print-architecture`
 elif [ -e $DEBOOTSTRAP_DIR/arch ]; then
 	HOST_ARCH=`cat $DEBOOTSTRAP_DIR/arch`
+elif in_path pacman; then
+	CARCH="$(. /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