~ubuntu-branches/ubuntu/trusty/389-ds-base/trusty

« back to all changes in this revision

Viewing changes to .pc/admin_scripts.diff/ldap/admin/src/scripts/bak2db.in

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2013-10-10 09:49:15 UTC
  • Revision ID: package-import@ubuntu.com-20131010094915-3q3m9z34sxx8tqik
Tags: 1.3.1.9-0ubuntu2
* Merge from debian git
  - admin_scripts.diff: Add patch from upstream #47511 to fix bashisms.
  - control: Add ldap-utils to -base depends.
  - rules, rename-online-scripts.diff: Some scripts with .pl suffix are
    meant for an online server, so instead of overwriting the offline
    scripts use -online suffix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
source @datadir@/@package_name@/data/DSSharedLib
 
4
 
 
5
libpath_add "@libdir@/@package_name@/"
 
6
libpath_add "@nss_libdir@"
 
7
libpath_add "@libdir@"
 
8
libpath_add "@pcre_libdir@"
 
9
 
 
10
export LD_LIBRARY_PATH
 
11
SHLIB_PATH=$LD_LIBRARY_PATH
 
12
export SHLIB_PATH
 
13
 
 
14
usage()
 
15
{
 
16
    echo "Usage: bak2db archivedir [-Z serverID] [-n backend] [-q] [-h]"
 
17
    echo "Options:"
 
18
    echo "        archivedir   - Directory where the archived backup is located"
 
19
    echo "        -n backend   - Backend database name.  Example: userRoot"
 
20
    echo "        -Z serverID  - Server instance identifier"
 
21
    echo "        -q           - Quiet mode - suppresses output"
 
22
    echo "        -h           - Display usage"  
 
23
}
 
24
 
 
25
if [ $# -lt 1 ] || [ $# -gt 7 ]
 
26
then
 
27
    usage
 
28
    exit 1
 
29
elif [[ $1 == -* ]]
 
30
then
 
31
    usage
 
32
    exit 1
 
33
else
 
34
    archivedir=$1
 
35
    shift
 
36
fi
 
37
    
 
38
while getopts "hn:Z:qd:vi:a:SD:" flag
 
39
do
 
40
    case $flag in
 
41
        h) usage
 
42
           exit 0;;
 
43
        Z) servid=$OPTARG;; 
 
44
        n) args=$args" -n $OPTARG";;
 
45
        q) args=$args" -q";;
 
46
        d) args=$args" -d $OPTARG";;
 
47
        v) args=$args" -v";;
 
48
        D) args=$args" -D $OPTARG";;
 
49
        i) args=$args" -i $OPTARG";;
 
50
        a) archivedir=$OPTARG;;
 
51
        S) args=$args" -S";;
 
52
        ?) usage
 
53
           exit 1;;
 
54
    esac
 
55
done
 
56
 
 
57
initfile=$(get_init_file "@initconfigdir@" $servid)
 
58
if [ $? == 1 ]
 
59
then
 
60
    usage
 
61
    echo "You must supply a valid server instance identifier.  Use -Z to specify instance name"
 
62
    echo "Available instances: $initfile"
 
63
    exit 1
 
64
fi
 
65
 
 
66
. $initfile
 
67
 
 
68
if [ 1 = `expr $archivedir : "\/"` ]
 
69
then
 
70
    archivedir=$archivedir
 
71
else
 
72
    # relative
 
73
    archivedir=`pwd`/$archivedir
 
74
fi
 
75
 
 
76
@sbindir@/ns-slapd archive2db -D $CONFIG_DIR -a $archivedir $args