|
|
@@ -12,34 +12,62 @@ export LD_LIBRARY_PATH
|
|
|
SHLIB_PATH=$LD_LIBRARY_PATH
|
|
|
export SHLIB_PATH
|
|
|
|
|
|
+make_ldiffile()
|
|
|
+{
|
|
|
+ nobe=0
|
|
|
+ while [ "$1" != "" ]
|
|
|
+ do
|
|
|
+ if [ "$1" = '-a' ]; then
|
|
|
+ shift
|
|
|
+ echo $1
|
|
|
+ return 1
|
|
|
+ elif [ "$1" = '-n' ]; then
|
|
|
+ shift
|
|
|
+ if [ "$be" = "" ]; then
|
|
|
+ be="$1"
|
|
|
+ else
|
|
|
+ tmpbe="$be"
|
|
|
+ be="${tmpbe}-$1"
|
|
|
+ fi
|
|
|
+ elif [ "$1" = '-s' ]; then
|
|
|
+ shift
|
|
|
+ rdn=`echo $1 | awk -F, '{print $1}'`
|
|
|
+ rdnval=`echo $rdn | awk -F= '{print $2}'`
|
|
|
+ if [ "$be" = "" ]; then
|
|
|
+ be="$rdnval"
|
|
|
+ else
|
|
|
+ tmpbe="$be"
|
|
|
+ be="${tmpbe}-$rdnval"
|
|
|
+ fi
|
|
|
+ elif [ "$1" = '-M' ]; then
|
|
|
+ nobe=1
|
|
|
+ fi
|
|
|
+ shift
|
|
|
+ done
|
|
|
+
|
|
|
+ if [ $nobe -eq 0 ]; then
|
|
|
+ echo {{LDIF-DIR}}/{{SERV-ID}}-${be}-`date +%Y_%m_%d_%H%M%S`.ldif
|
|
|
+ else
|
|
|
+ echo {{LDIF-DIR}}/{{SERV-ID}}-`date +%Y_%m_%d_%H%M%S`.ldif
|
|
|
+ fi
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
cd {{SERVERBIN-DIR}}
|
|
|
if [ "$#" -lt 2 ];
|
|
|
then
|
|
|
- echo "Usage: db2ldif {-n backend_instance}* | {-s includesuffix}*"
|
|
|
- echo " [{-x excludesuffix}*] [-a outputfile]"
|
|
|
- echo " [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1]"
|
|
|
- echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" is required."
|
|
|
- exit 1
|
|
|
+ echo "Usage: db2ldif {-n backend_instance}* | {-s includesuffix}*"
|
|
|
+ echo " [{-x excludesuffix}*] [-a outputfile]"
|
|
|
+ echo " [-N] [-r] [-C] [-u] [-U] [-m] [-M] [-1]"
|
|
|
+ echo "Note: either \"-n backend_instance\" or \"-s includesuffix\" is required."
|
|
|
+ exit 1
|
|
|
fi
|
|
|
|
|
|
-set_ldif=0
|
|
|
-ldif_file="mydummy"
|
|
|
-for arg in "$@"
|
|
|
-do
|
|
|
- if [ "$arg" = '-a' ];
|
|
|
- then
|
|
|
- set_ldif=1
|
|
|
- elif [ $set_ldif -eq 1 ];
|
|
|
- then
|
|
|
- ldif_file=$arg
|
|
|
- set_ldif=2
|
|
|
- fi
|
|
|
-done
|
|
|
-if [ $ldif_file = "mydummy" ]
|
|
|
-then
|
|
|
- ldif_file={{LDIF-DIR}}/`date +%Y_%m_%d_%H%M%S`.ldif
|
|
|
-fi
|
|
|
-if [ $set_ldif -eq 2 ]
|
|
|
+ldif_file=`make_ldiffile $@`
|
|
|
+rn=$?
|
|
|
+
|
|
|
+echo "Exported ldif file: $ldif_file"
|
|
|
+if [ $rn -eq 1 ]
|
|
|
then
|
|
|
./ns-slapd db2ldif -D {{CONFIG-DIR}} "$@"
|
|
|
else
|