#!/bin/sh while getopts s:t:a:w:P:p:h:12n:l:L:d:c:C:D:V:f:OS:NI:Xy:W: c do case $c in s) SERVER=$OPTARG;; t) TREE=$OPTARG;; a) ADMIN=$OPTARG;; w) ADMINPWD=$OPTARG;; c) CONTEXT=$OPTARG;; p) if [ "$LDAPPORT" = "389" ] ; then LDAPPORT=`expr $OPTARG + 1` fi if [ "$LDAPSSLPORT" = "636" ] ; then LDAPSSLPORT=`expr $OPTARG + 2` fi if [ "$DEBUGPORT" = "1900" ] ; then DEBUGPORT=`expr $OPTARG + 3` fi if [ "$HTTPPORT" = "10080" ] ; then HTTPPORT=`expr $OPTARG + 4` fi if [ "$HTTPSPORT" = "10443" ] ; then HTTPSPORT=`expr $OPTARG + 5` fi PORT=$OPTARG ;; P) IPADDR=$OPTARG;; O) SETUPHTTP=0;; 1) PRIMARYSERVER=1;; 2) PRIMARYSERVER=0;; n) NDS_CONF=$OPTARG export NDS_CONF readconf ;; l) LDAPPORT=$OPTARG;; L) LDAPSSLPORT=$OPTARG;; C) CONFIGDIR=$OPTARG;; D) DIBDIR=$OPTARG;; V) VARDIR=$OPTARG;; X) LIBDIR=$OPTARG;; f) LICENSE=$OPTARG;; d) DEBUGPORT=$OPTARG;; S) SERVERDIR=$OPTARG;; N) CONFIGNMAS=1;; I) INTERFACE=$OPTARG;; y) CACHE=$OPTARG;; W) NDSDBINI_APPENDS=$OPTARG;; \? | h) dumpUsage exit 2;; default) echo $OPTARG esac done if [ "$ADMIN" = "" ] || [ "$ADMINPWD" = "" ] || [ "$TREE" = "" ] || [ "$IPADDR" = "" ] ; then echo "./nmas-addmethod-deb -a -w -t -P :" echo "example: './nmas-addmethod-deb -a cn=admin.o=novell -w password -t MYTREE -P 192.168.1.1:524'" exit fi ckyorn() { shift ckyornstr="$@" ans="" while [ -z "$ans" ] || [ "$ans" = "ERRVAL" ] do #write_log "$@" #echo_sameline "$ckyornstr '[y/n/q] ? '" read ans ans=`echo $ans | tr "[:upper:]" "[:lower:]"` case $ans in y|yes) return 1 ;; n|no) return 0 ;; q|quit) exit 1 ;; *) str1=`gettext install "Invalid option : "` echo "$instr $str1$ans" ans="ERRVAL" ;; esac done } list=`find .././ -name config.txt` for file in $list do echo "add nmas method $file ?(y/n/q)" ckyorn -p "install $file (y/n/q)" ans=`echo $ans | tr "[:upper:]" "[:lower:]"` if [ "$ans" = "n" ] || [ "$ans" = "no" ] then echo "skipping $file..." fi if [ "$ans" = "y" ] || [ "$ans" = "yes" ] then echo "attempting to add method $file to $TREE as '$ADMIN' with passwd '$ADMINPWD' on host '$IPADDR' ..." nmasinst -addmethod $ADMIN $TREE $file -h $IPADDR -w $ADMINPWD fi done