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