~ubuntu-branches/ubuntu/vivid/389-ds-base/vivid-proposed

« back to all changes in this revision

Viewing changes to .pc/use-bash-instead-of-sh.diff/ldap/admin/src/scripts/ldif2db.in

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2015-01-16 15:40:23 UTC
  • Revision ID: package-import@ubuntu.com-20150116154023-8gelb90338zoenea
Tags: 1.3.3.5-3
use-bash-instead-of-sh.diff: Drop admin_scripts.diff and patch the
scripts to use bash instead of trying to fix bashisms. (Closes:
#772195)

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: ldif2db [-Z serverID] -n backendname {-s includesuffix}* [{-x excludesuffix}*] {-i ldiffile}*"
 
17
    echo "               [-c chunksize] [-g [string]] [-G namespace_id] [-O] [-E] [-q] [-v] [-h]"
 
18
    echo "Note: either \"-n backend\", \"-s includesuffix\", and \"-i ldiffile\" are required."
 
19
    echo "Options:"
 
20
    echo "        -Z serverID       - The server instance identifier"
 
21
    echo "        -n backend        - Backend database name.  Example: userRoot"
 
22
    echo "        -s inclduesuffix  - Suffix to include"
 
23
    echo "        -x excludesuffix  - Suffix to exclude"
 
24
    echo "        -i ldiffile       - LDIF file name"
 
25
    echo "        -c chunksize      - Number of entries to process before starting a new pass"
 
26
    echo "        -g [string]       - String is \"none\" or \"deterministic\""
 
27
    echo "                           \"none\" - unique id is not generated"
 
28
    echo "                           \"deterministic\" - generate name based unique id (-G name)"
 
29
    echo "                            By default - generate time based unique id"
 
30
    echo "        -G name           - Namespace id for name based uniqueid (-g deterministic)"
 
31
    echo "        -O                - Do not index the attributes"
 
32
    echo "        -E                - Encrypt attributes"
 
33
    echo "        -q                - Quiet mode - suppresses output"
 
34
    echo "        -v                - Verbose output"
 
35
    echo "        -h                - Display usage" 
 
36
}
 
37
 
 
38
handleopts()
 
39
{
 
40
    while [ "$1" != "" ]
 
41
    do
 
42
        if [ "$1" = "-q" ]; then
 
43
            return 1
 
44
        elif [ "$1" = "-Z" ]; then
 
45
            shift
 
46
            servid=$1
 
47
        elif [ "$1" = "-h" ]; then
 
48
            usage
 
49
            exit 0
 
50
        fi
 
51
        shift
 
52
    done
 
53
    return 0
 
54
}
 
55
 
 
56
while getopts "Z:vhd:i:g:G:n:s:x:NOCc:St:D:Eq" flag
 
57
do
 
58
    case $flag in
 
59
        h) usage
 
60
           exit 0;;
 
61
        Z) servid=$OPTARG;;
 
62
        n) args=$args" -n $OPTARG";;
 
63
        i) args=$args" -i $OPTARG";;
 
64
        s) args=$args" -s $OPTARG";;
 
65
        x) args=$args" -x $OPTARG";;
 
66
        c) args=$args" -c $OPTARG";;
 
67
        d) args=$args" -d $OPTARG";;
 
68
        g) args=$args" -g $OPTARG";;
 
69
        G) args=$args" -G $OPTARG";;
 
70
        t) args=$args" -t $OPTARG";;
 
71
        D) args=$args" -D $OPTARG";;
 
72
        E) args=$args" -E";;
 
73
        v) args=$args" -v";;
 
74
        N) args=$args" -N";;
 
75
        C) args=$args" -C";;
 
76
        S) args=$args" -S";;
 
77
        O) args=$args" -O";;
 
78
        q) args=$args" -q";;
 
79
        ?) usage
 
80
           exit 1;;
 
81
    esac
 
82
done
 
83
 
 
84
initfile=$(get_init_file "@initconfigdir@" $servid)
 
85
if [ $? == 1 ]
 
86
then
 
87
    usage
 
88
    echo "You must supply a valid server instance identifier.  Use -Z to specify instance name"
 
89
    echo "Available instances: $initfile"
 
90
    exit 1
 
91
fi
 
92
 
 
93
. $initfile
 
94
 
 
95
if [ $# -lt 4 ]
 
96
then
 
97
    usage
 
98
    exit 1
 
99
fi
 
100
 
 
101
handleopts $@
 
102
quiet=$?
 
103
if [ $quiet -eq 0 ]; then
 
104
    echo importing data ...
 
105
fi
 
106
 
 
107
@sbindir@/ns-slapd ldif2db -D $CONFIG_DIR $args 2>&1
 
108
 
 
109
exit $?