]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/install-default-backend.in
Backport from BEE
[bacula/bacula] / bacula / src / cats / install-default-backend.in
1 #!/bin/sh
2 #
3 #  Bacula® - The Network Backup Solution
4 #
5 #  Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
6 #
7 #  The main author of Bacula is Kern Sibbald, with contributions from many
8 #  others, a complete list can be found in the file AUTHORS.
9 #
10 #  You may use this file and others of this release according to the
11 #  license defined in the LICENSE file, which includes the Affero General
12 #  Public License, v3.0 ("AGPLv3") and some additional permissions and
13 #  terms pursuant to its AGPLv3 Section 7.
14 #
15 #  Bacula® is a registered trademark of Kern Sibbald.
16 #
17
18
19 LIBTOOL="@BUILD_DIR@/libtool"
20
21 if [ $# -lt 3 ]; then
22    echo "Usage: $0 <default_backend> <library_version> <install_dir>"
23    exit 1
24 fi
25
26 default_backend=$1
27 library_version=$2
28 install_dir=$3
29
30 #
31 # Find out what the shared lib extension is for this platform.
32 #
33 eval `${LIBTOOL} --config | grep shrext_cmds`
34 eval SHLIB_EXT=$shrext_cmds
35
36 if [ -z "${SHLIB_EXT}" ]; then
37    echo "Failed to determine default shared library extension"
38    exit 1
39 fi
40
41 if [ -f ${install_dir}/libbaccats-${default_backend}-${library_version}${SHLIB_EXT} ]; then
42    #
43    # Create a default catalog library pointing to one of the shared libs.
44    #
45    rm -f ${install_dir}/libbaccats-${library_version}${SHLIB_EXT}
46
47    #
48    # Create a relative symlink to the default backend
49    # As all backends are in the same directory anyhow this should
50    # always work.
51    #
52    ln -s libbaccats-${default_backend}${SHLIB_EXT} \
53          ${install_dir}/libbaccats-${library_version}${SHLIB_EXT}
54 fi
55
56 exit 0