#!/bin/sh

# On architectures where we sometimes have 64-bit kernels on buildds when we
# want to build for 32-bit userland (seen especially on the experimental
# buildds), make sure we invoke the commands using linux32 otherwise the
# binaries end up with the wrong arch name hardcoded in them

# TODO: Probably changing how the arch name is detected in the build
#       scripts would be a more clever idea

DEB_BUILD_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)

case ${DEB_BUILD_ARCH} in
powerpc|i386|sparc|s390|hppa|armel|armhf|mips|mipsel)
    exec /usr/bin/linux32 "$@";;
*)
    exec "$@";;
esac

