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

« back to all changes in this revision

Viewing changes to .pc/admin_scripts.diff/ldap/admin/src/scripts/upgradednformat.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
 
# upgradednformat -- upgrade DN format to the new style (RFC 4514)
6
 
# Usgae: upgradednformat [-N] -n backend_instance -a db_instance_directory
7
 
#        -N: dryrun
8
 
#            exit code: 0 -- needs upgrade; 1 -- no need to upgrade; -1 -- error
9
 
#        -n backend_instance -- instance name to be examined or upgraded
10
 
#        -a db_instance_directory -- full path to the db instance dir
11
 
#                                    e.g., /var/lib/dirsrv/slapd-ID/db/userRoot
12
 
 
13
 
libpath_add "@libdir@/@package_name@/"
14
 
libpath_add "@nss_libdir@"
15
 
libpath_add "@libdir@"
16
 
libpath_add "@pcre_libdir@"
17
 
 
18
 
export LD_LIBRARY_PATH
19
 
SHLIB_PATH=$LD_LIBRARY_PATH
20
 
export SHLIB_PATH
21
 
 
22
 
usage ()
23
 
{
24
 
    echo "Usage: upgradednformat -n backendname -a database_directory [-Z serverID] [-N] [-h]"
25
 
    echo "Options:"
26
 
    echo "        -n backendname         - Backend name"
27
 
    echo "        -a database_directory  - Path to database directory"
28
 
    echo "        -Z serverID            - Server instance identifier"
29
 
    echo "        -N                     - Only checks if database has any DNs that need to be upgraded"
30
 
    echo "        -h                     - Display usage"
31
 
}
32
 
 
33
 
while getopts "vhd:a:n:D:NZ:" flag
34
 
do
35
 
    case $flag in
36
 
        Z) servid=$OPTARG;;
37
 
        v) args=$args" -v";;
38
 
        N) args=$args" -N";;
39
 
        d) args=$args" -d $OPTARG";;
40
 
        a) args=$args" -a $OPTARG"
41
 
           dir="set";;
42
 
        n) args=$args" -n $OPTARG"
43
 
           be="set";;
44
 
        h) usage
45
 
           exit 0;;
46
 
        D) args=$args" -D $OPTARG";;
47
 
        ?) usage
48
 
           exit 1;;
49
 
    esac
50
 
done
51
 
 
52
 
if [ "$be" = "" ] || [ "$dir" = "" ]; then
53
 
    usage
54
 
    exit 1
55
 
fi
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
 
@sbindir@/ns-slapd upgradednformat -D $CONFIG_DIR $args
69
 
rc=$?
70
 
 
71
 
exit $rc