Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mumble-overlay « scripts - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a2030a3e541d646641cb74add2f4de103f2047ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
#
# Copyright 2005-2019 The Mumble Developers. All rights reserved.
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.

if [ -z "$1" -o "$1" = '--help' ]; then
	echo "USAGE: $0 <program> [args...]"
	exit 1
fi

for libpath in /usr/lib /usr/lib/mumble /usr/lib32 /usr/lib32/mumble /usr/lib64 /usr/lib64/mumble; do
  if [ -d "$libpath" ]; then
    if [ -f "$libpath/libmumble.so.1" ]; then
      case $(file -L "$libpath/libmumble.so.1") in
        *64-bit*) MUMBLE_OVERLAY_PATH_64="$libpath" ; echo set ;;
        *32-bit*) MUMBLE_OVERLAY_PATH_32="$libpath" ;;
      esac
    fi
  fi
done

if [ -f /etc/sysconfig/mumble ]; then
  . /etc/sysconfig/mumble
fi

binary="$1"
if [ "${binary/\/}" = "$binary" ]; then
  binary=$(which "$binary")
fi
if [ ! -x "$binary" ]; then
  echo "$1 not found" >&2
  exit 1
fi

is64=no
is32=no

case $(file -L "$binary") in
	*64-bit*)
		if [ -z "${MUMBLE_OVERLAY_PATH_64}" ]; then
			echo "64-bit libmumble.so.1 not found" >&2
			exit 1
		fi
		MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_64}/libmumble.so.1"
		;;
	*32-bit*)
		if [ -z "${MUMBLE_OVERLAY_PATH_32}" ]; then
			echo "32-bit libmumble.so.1 not found" >&2
			exit 1
		fi
		MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_32}/libmumble.so.1"
		;;
	*)
		if [ -n "${MUMBLE_OVERLAY_PATH_64}" ]; then
			MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_64}/libmumble.so.1"
		fi
		if [ -n "${MUMBLE_OVERLAY_PATH_32}" ]; then
			MUMBLE_PRELOAD="${MUMBLE_PRELOAD} ${MUMBLE_OVERLAY_PATH_32}/libmumble.so.1"
		fi
		if [ -z "${MUMBLE_PRELOAD}" ]; then
			echo "Neither 32-bit or 64-bit libmumble.so.1 found"
			exit 1
		fi
esac

LD_PRELOAD="${MUMBLE_PRELOAD} ${LD_PRELOAD}" "${@}"