live-build/functions/architecture.sh

85 lines
1.6 KiB
Bash
Raw Normal View History

2007-09-23 08:05:13 +00:00
#!/bin/sh
# architecture.sh - handle architecture specific support
2007-09-23 08:05:14 +00:00
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
2007-09-23 08:05:13 +00:00
#
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
set -e
Check_architecture ()
{
ARCHITECTURES="${@}"
VALID="false"
for ARCHITECTURE in ${ARCHITECTURES}
do
if [ "$(echo ${LH_ARCHITECTURE} | grep ${ARCHITECTURE})" ]
2007-09-23 08:05:13 +00:00
then
VALID="true"
break
fi
done
if [ "${VALID}" = "false" ]
then
Echo_warning "skipping ${0}, foreign architecture."
exit 0
fi
}
2007-09-23 08:05:14 +00:00
Check_crossarchitecture ()
{
if [ -x /usr/bin/dpkg ]
then
HOST="$(dpkg --print-architecture)"
else
HOST="$(uname -m)"
fi
case "${HOST}" in
amd64|i386)
CROSS="amd64 i386"
;;
powerpc|ppc64)
CROSS="powerpc ppc64"
;;
esac
Check_architecture "${CROSS}"
}
2007-09-23 08:05:14 +00:00
Check_multiarchitecture ()
{
if [ "$(echo ${LH_ARCHITECTURE} | wc -w)" -gt "1" ]
2007-09-23 08:05:14 +00:00
then
# First, only support multiarch on iso
2007-09-23 08:05:17 +00:00
if [ "${LH_BINARY_IMAGES}" = "iso" ]
2007-09-23 08:05:14 +00:00
then
# Assemble multi-arch
2007-09-23 08:05:17 +00:00
case "${LH_CURRENT_ARCHITECTURE}" in
2007-09-23 08:05:14 +00:00
amd64)
DESTDIR="${DESTDIR}.amd"
DESTDIR_LIVE="${DESTDIR_LIVE}.amd"
DESTDIR_INSTALL="${DESTDIR_INSTALL}.amd"
;;
i386)
DESTDIR="${DESTDIR}.386"
DESTDIR_LIVE="${DESTDIR_LIVE}.386"
DESTDIR_INSTALL="${DESTDIR_INSTALL}.386"
;;
powerpc)
DESTDIR="${DESTDIR}.ppc"
DESTDIR_LIVE="${DESTDIR_LIVE}.ppc"
DESTDIR_INSTALL="${DESTDIR_INSTALL}.ppc"
;;
esac
fi
fi
}