get_type() {
case $(file "$1") in
- *x86-64*) echo x86_64;;
- *"Intel 80386"*) echo i386;;
+ *x86-64*) echo x86_64;;
+ *"Intel 80386"*) echo i386;;
+ *32-bit*PowerPC*) echo ppc;;
+ *64-bit*PowerPC*) echo ppc64;;
esac
}
bin_dst=$(get_type bin/bash)
-bin_src=$(get_type /bin/bash)
-if [[ ${bin_dst} == ${bin_src} ]] ; then
- setarch=
-else
+if [[ -n ${bin_dst} ]] && type -P setarch &>/dev/null ; then
setarch="setarch ${bin_dst}"
fi