@@ -25,8 +25,24 @@ create_package() {
chown -R root:root "$pdir"
chmod -R go-w "$pdir"
+ # Attempt to find correct debian architecture
+ local forcearch="" debarch=""
+ case "$ARCH" in
+ x86_64) debarch="amd64" ;;
+ i386|ia64) debarch="$ARCH" ;;
+ *)
+ case "$SUBARCH" in
+ arm) debarch=$(grep -q CONFIG_AEABI=y .config \
+ && echo armel || echo arm) ;;
+ esac
+ ;;
+ 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" ..
}