updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / bin32-mumble-overlay / src / mumble-overlay32
blobdc68406c94c803ef74fa5612a5f3b21816d61fa5
1 #!/bin/bash
3 if [ -z "$1" -o "$1" = '--help' ]; then
4 echo "USAGE: $0 <program> [args...]"
5 exit 1
6 fi
8 if [ -d /usr/lib64 ]; then
9 libdir_64=/usr/lib64
10 if [ -d "$libdir_64/mumble" ]; then
11 libdir_64="$libdir_64/mumble";
14 if [ -d /usr/lib32 ]; then
15 libdir_32=/usr/lib32
16 if [ -d "$libdir_32/mumble" ]; then
17 libdir_32="$libdir_32/mumble";
20 if [ -d /opt/lib32/usr/lib ]; then
21 libdir_32=/opt/lib32/usr/lib
22 if [ -d "$libdir_32/mumble" ]; then
23 libdir_32="$libdir_32/mumble";
26 if [ -z "$libdir_32" -o -z "$libdir_64" ]; then
27 tlibdir=/usr/lib
28 if [ -d "$tlibdir/mumble" ]; then
29 tlibdir="$tlibdir/mumble"
31 if [ -f "$tlibdir/libmumble.so.1" ]; then
32 case $(file -L "$tlibdir/libmumble.so.1") in
33 *64-bit*) libdir_64=$tlibdir ;;
34 *32-bit*) libdir_32=$tlibdir ;;
35 esac
39 MUMBLE_OVERLAY_PATH_32=$libdir_32
40 MUMBLE_OVERLAY_PATH_64=$libdir_64
42 if [ -f /etc/sysconfig/mumble ]; then
43 . /etc/sysconfig/mumble
46 binary="$1"
47 if [ "${binary/\/}" = "$binary" ]; then
48 binary=$(which "$binary")
50 if [ ! -x "$binary" ]; then
51 echo "$1 not found" >&2
52 exit 1
55 is64=no
56 is32=no
58 case $(file -L "$binary") in
59 *64-bit*)
60 if [ ! -f "${MUMBLE_OVERLAY_PATH_64}/libmumble.so.1" ]; then
61 echo "64-bit libmumble.so.1 not found in ${MUMBLE_OVERLAY_PATH_64}" >&2
62 exit 1
64 MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_64}/libmumble.so.1"
66 *32-bit*)
67 if [ ! -f "${MUMBLE_OVERLAY_PATH_32}/libmumble.so.1" ]; then
68 echo "32-bit libmumble.so.1 not found in ${MUMBLE_OVERLAY_PATH_32}" >&2
69 exit 1
71 MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_32}/libmumble.so.1"
74 if [ -f "${MUMBLE_OVERLAY_PATH_64}/libmumble.so.1" ]; then
75 MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_64}/libmumble.so.1"
77 if [ -f "${MUMBLE_OVERLAY_PATH_32}/libmumble.so.1" ]; then
78 MUMBLE_PRELOAD="${MUMBLE_PRELOAD} ${MUMBLE_OVERLAY_PATH_32}/libmumble.so.1"
80 if [ -z "${MUMBLE_PRELOAD}" ]; then
81 echo "Neither 32-bit or 64-bit libmumble.so.1 found"
82 exit 1
84 esac
86 LD_PRELOAD="${MUMBLE_PRELOAD} ${LD_PRELOAD}" "${@}"