#!/bin/sh ac_which() { for ac_which_tmp in `echo $PATH | sed s/":"/" "/g` do [ "$ac_debug" = "1" ] && echo "[ac_which] path search: $ac_which_tmp" >>genuser.debug if [ -x "$ac_which_tmp/$1" ]; then [ "$ac_debug" = "1" ] && echo "[ac_which] found: $ac_which_tmp/$1" >>genuser.debug echo "$ac_which_tmp/$1" return fi done find / -name $1 -type f 2>/dev/null | grep -v 'home|tmp|temp' | while read ac_which_tmp do [ "$ac_debug" = "1" ] && echo "[ac_which] find search: $ac_which_tmp" >>genuser.debug if [ -x "$ac_which_tmp" ]; then [ "$ac_debug" = "1" ] && echo "[ac_which] found: $ac_which_tmp" >>genuser.debug echo "$ac_which_tmp" exit fi done } echo "Checking system, please wait..." ac_debug=0 if [ "$1" = "-d" ]; then ac_debug=1 echo "*** genuser debug log - `date`" >> genuser.debug shift fi if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi ac_cut="`ac_which cut`" if [ -z "$ac_cut" ]; then echo "ERROR: ./genuser requires the 'cut' command to function."; exit 1; fi ac_tr="`ac_which tr`" if [ -z "$ac_tr" ]; then echo "ERROR: ./genuser requires the 'tr' command to function."; exit 1; fi ac_wc="`ac_which wc`" if [ -z "$ac_wc" ]; then echo "ERROR: ./genuser requires the 'wc' command to function."; exit 1; fi [ "$ac_debug" = "1" ] && echo "[main] ac_cut = $ac_cut" >> genuser.debug [ "$ac_debug" = "1" ] && echo "[main] ac_tr = $ac_tr" >> genuser.debug [ "$ac_debug" = "1" ] && echo "[main] ac_wc = $ac_wc" >> genuser.debug USERFILE="emech.users" [ ! -z "$1" ] && USERFILE=$1 if [ -f $USERFILE ]; then echo $ac_n "Userfile '$USERFILE' already exists, overwrite? [y/N]: " read REPL -setpass " echo "" while [ "$HANDLE" = "" ]; do echo $ac_n "Enter a handle (8 chars or less): " read REPL > $USERFILE echo "mask $HOSTMASK" >> $USERFILE echo "channel *" >> $USERFILE echo "access 100" >> $USERFILE echo "" echo "Userfile $USERFILE created." if [ -f mech.set ]; then DUPEMSG=0 grep -i -E "^USERFILE" mech.set | cut -f2- -d' ' | grep -i -v -w "$USERFILE" | while read LINE do if [ "$DUPEMSG" = "0" ]; then echo echo "Would you like to make the following userfile(s) (from mech.set)" echo "the same as '$USERFILE'?" echo DUPEMSG=1 fi set `echo $LINE` EXTRAUSERFILE=$1 echo $ac_n " $EXTRAUSERFILE [y/N]: " read REPL