0
0
mirror of https://github.com/mumble-voip/mumble.git synced 2024-11-23 07:57:38 +00:00
mumble-voip_mumble/auxiliary_files/run_scripts/mumble-overlay.in
2022-09-10 17:28:34 +02:00

70 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright 2005-@MUMBLE_BUILD_YEAR@ 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 @MUMBLE_INSTALL_ABS_LIBDIR@ /usr/lib /usr/lib/mumble /usr/lib32 /usr/lib32/mumble /usr/lib64 /usr/lib64/mumble; do
if [ -d "$libpath" ]; then
for lib in $libpath/lib@MUMBLE_OVERLAY_BINARY_BASENAME@*.so
do
case $(file -L "$lib") in
*64-bit*) MUMBLE_OVERLAY_PATH_64="$lib" ; echo set ;;
*32-bit*) MUMBLE_OVERLAY_PATH_32="$lib" ;;
esac
done
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 lib@MUMBLE_OVERLAY_BINARY_BASENAME@.so not found" >&2
exit 1
fi
MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_64}"
;;
*32-bit*)
if [ -z "${MUMBLE_OVERLAY_PATH_32}" ]; then
echo "32-bit lib@MUMBLE_OVERLAY_BINARY_BASENAME@.so not found" >&2
exit 1
fi
MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_32}"
;;
*)
if [ -n "${MUMBLE_OVERLAY_PATH_64}" ]; then
MUMBLE_PRELOAD="${MUMBLE_OVERLAY_PATH_64}"
fi
if [ -n "${MUMBLE_OVERLAY_PATH_32}" ]; then
MUMBLE_PRELOAD="${MUMBLE_PRELOAD} ${MUMBLE_OVERLAY_PATH_32}"
fi
if [ -z "${MUMBLE_PRELOAD}" ]; then
echo "Neither 32-bit or 64-bit lib@MUMBLE_OVERLAY_BINARY_BASENAME@.so found"
exit 1
fi
esac
LD_PRELOAD="${MUMBLE_PRELOAD} ${LD_PRELOAD}" "${@}"