]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/install-default-backend.in
Backport from Bacula Enterprise
[bacula/bacula] / bacula / src / cats / install-default-backend.in
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 LIBTOOL="@BUILD_DIR@/libtool"
8
9 if [ $# -lt 3 ]; then
10    echo "Usage: $0 <default_backend> <library_version> <install_dir>"
11    exit 1
12 fi
13
14 default_backend=$1
15 library_version=$2
16 install_dir=$3
17
18 #
19 # Find out what the shared lib extension is for this platform.
20 #
21 eval `${LIBTOOL} --config | grep shrext_cmds`
22 eval SHLIB_EXT=$shrext_cmds
23
24 if [ -z "${SHLIB_EXT}" ]; then
25    echo "Failed to determine default shared library extension"
26    exit 1
27 fi
28
29 if [ -f ${install_dir}/libbaccats-${default_backend}-${library_version}${SHLIB_EXT} ]; then
30    #
31    # Create a default catalog library pointing to one of the shared libs.
32    #
33    rm -f ${install_dir}/libbaccats-${library_version}${SHLIB_EXT}
34
35    #
36    # Create a relative symlink to the default backend
37    # As all backends are in the same directory anyhow this should
38    # always work.
39    #
40    ln -s libbaccats-${default_backend}${SHLIB_EXT} \
41          ${install_dir}/libbaccats-${library_version}${SHLIB_EXT}
42 fi
43
44 exit 0