File: ipp-wrapper

package info (click to toggle)
nut 2.8.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,356 kB
  • sloc: ansic: 123,904; sh: 14,718; cpp: 12,558; makefile: 5,212; python: 1,114; perl: 855; xml: 47
file content (49 lines) | stat: -rwxr-xr-x 1,179 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
#   ipp-wrapper
#
#   Copyright (c) 2017, by Eaton (R) Corporation. All rights reserved.
#
#   A shell script to manipulate the environment variables needed for
#   IPP-Unix programs to dynamically link with their bundled libraries.

#
# Global variables
#
NUT_DIR="/usr/local/ups"
NUT_BIN_DIR="$NUT_DIR/bin"
NUT_SBIN_DIR="$NUT_DIR/sbin"
NUT_LIB_DIR="$NUT_DIR/lib"

PROGNAME="`basename $0`"

if [ "$PROGNAME" = "ipp-wrapper" ]; then
    echo "This is a wrapper to call other programs; do not call it directly!" >&2
    exit 0
fi

# Use potentially external /bin/test (/bin/[) for the last time...
PROGTYPE=""
if [ -x "$NUT_BIN_DIR/$PROGNAME" ]; then
    PROGTYPE="bin"
else
    if [ -x "$NUT_SBIN_DIR/$PROGNAME" ]; then
        PROGTYPE="sbin"
    fi
fi

# Do not run any other external program after this point, as it may
# fail expecting different shared libraries.
LD_LIBRARY_PATH="$NUT_LIB_DIR:/usr/lib:/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH

case "$PROGTYPE" in
bin)
    exec "$NUT_BIN_DIR/$PROGNAME" "$@"
    ;;
sbin)
    exec "$NUT_SBIN_DIR/$PROGNAME" "$@"
    ;;
esac

echo "FATAL: Program named '$PROGNAME' not found among IPP-Unix binaries" >&2
exit 1