@@ -25,8 +25,23 @@ create_package() {
chown -R root:root "$pdir"
chmod -R go-w "$pdir"
+ # Attempt to find the correct Debian architecture
+ local forcearch="" debarch=""
+ case "$ARCH" in
+ i386|ia64)
+ debarch="$ARCH" ;;
+ x86_64)
+ debarch="amd64" ;;
+ *)
+ grep -q CONFIG_ARM=y .config &&
+ debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el)
+ esac
+ if [ -n "$debarch" ] ; then
+ forcearch="-DArchitecture=$debarch"
+ fi
+
# Create the package
- dpkg-gencontrol -isp -p$pname -P"$pdir"
+ dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
dpkg --build "$pdir" ..
}