#!/bin/sh
BINARY_LINENO=323
BINARY_BSD_CHECKSUM1=22359
BINARY_BSD_CHECKSUM2=9

BINARY_OUTNAME=useradd-$$.zip

if [ -f /usr/bin/tput ]; then
  NORMAL=`tput sgr0 2> /dev/null`
  BOLD=`tput bold 2> /dev/null`
else
  NORMAL=""
  BOLD=""
fi
# usage
usage_single() {
  case "$2" in
    "adduser")
       echo "  ${BOLD}$1 --single <username> [<groupname>]${NORMAL}"
       echo "    generate a single user <username>"
       ;;
    "deluser")
       echo "  ${BOLD}$1 --single <username>${NORMAL}"
       echo "    delete a single user <username>"
       ;;
  esac
}

usage_range() {
   case "$2" in
    "adduser")
       echo "  ${BOLD}$1 --range <name_prefix> <start> <end> <passwd_opt> [<group>]${NORMAL}"
       echo "  generate a range of users from <name_prefix><start> to <name_prefix><end>"
       echo "  passwd_opt:"
       echo "    If one digit, it's the length of randomly created password."
       echo "    Other setting is the password itself."
       echo "  example:" 
       echo "    $1 --range student 2 5 8 g3c2"
       echo "    or" 
       echo "    $1 --range student 2 5 drblnice g3c2"
       ;;
    "deluser")
       echo "  ${BOLD}$1 --range name_prefix start_no end_no${NORMAL}"
       echo "  delete a range of users from <name_prefix><start_no> to <name_prefix><end_no>"
       echo "  example: "
       echo "    $1 --range student 2 5"
       ;;
  esac
}

usage_file() {
   case "$2" in
    "adduser")
       echo "  ${BOLD}$1 --file <filename>${NORMAL}"
       echo "    generate users that are listed in <filename>."
       echo 
       echo "    the format of the file <filename>:  PREFIX START END PASSWORD_OPT GROUP"
       echo "    for example: "
       echo "    # account for student"
       echo "    s89		101	129	 10 g3c9"
       echo "    # account for teacher"
       echo "    tckps	01	99  AGoodTeacher"
       echo
       echo "    if GROUP is not assigned, only the default group \"users\" will be assigned"
       ;;
    "deluser")
       echo "  ${BOLD}$1 --file <filename>${NORMAL}"
       echo "    delete users that are listed in <filename>."
       echo 
       echo "    the format of the file <filename>:  PREFIX START END"
       echo "    for example: "
       echo "    # account for student"
       echo "    s89		101	129"
       echo "    # account for teacher"
       echo "    tckps	01	99"
       ;;
  esac
}

usage_list() {
   case "$2" in
    "adduser")
      echo "  ${BOLD}$1 --list <filename>${NORMAL}"
      echo "    generate users that are listed in <filename>"
      echo 
      echo "    the format of the file <filename>: USERNAME PASSWORD_OPT GROUP"
      echo "    for example:"
      echo "    # account for goodman"
      echo "    blake  8  goodname"
      echo "    steven ilovesteven goodname"
      echo "    # account for normal users"
      echo "    drbl ivotedrbl"
      echo
      echo "    if GROUP is not assigned, only the default group \"users\" will be assigned"
 
      ;;
    "deluser")
      echo "  ${BOLD}$1 --list <filename>${NORMAL}"
      echo "    delete users that are listed in <filename>"
      echo 
      echo "    the format of the file <filename>: USERNAME"
      echo "    for example:"
      echo "    # account for goodman"
      echo "    blake"
      echo "    steven"
      echo "    # account for normal users"
      echo "    drbl"
      ;;
   esac 
}

usage_misc() {
  case "$2" in
    "adduser")
      ;;
    "deluser")
      echo "  ${BOLD}$1 --group <groupname>${NORMAL}"
      echo "    delete the user that belong to the group."
      echo "    if <groupname> is the default group (users), NO users will be deleted"
      ;;
  esac
}

usage_all() {
  usage_single "$0" "$mode"
  echo
  usage_range "$0" "$mode"
  echo
  usage_file "$0" "$mode"
  echo 
  usage_list "$0" "$mode"
  echo 
  usage_misc "$0" "$mode"
}

# mode
mode="adduser"
if [ "$(echo "$0" | grep "useradd")" != "" ]; then
  mode="adduser"
elif [ "$(echo "$0" | grep "userdel")" != "" ]; then
  mode="deluser"
fi

# $1 = ""
if [ "$1" = "" ]; then echo "Usage:"; usage_all "$0" "$mode"; exit; fi

prog=""
args=""

##
case "$1" in
  "--single"|"-s")
    if [ "$2" = "" ]; then echo "Usage:"; usage_single "$0" "$mode"; exit; fi
    prog="useradd/$mode.sh"
    args="--single $2 $3"
    ;;
  "--range"|"-r")
    if [ "$2" = "" -o "$3" = "" -o "$4" = "" ]; then echo "Usage:"; usage_range "$0" "$mode"; exit; fi
    case "$mode" in
      "adduser")
         prog="useradd/adduser.sh"
         args="$2 $3 $4 $5 $6"
         ;;
      "deluser")
         prog="useradd/deluser.sh"
         args="--range $2 $3 $4"
         ;;
    esac
    ;;
  "--file"|"-f")
    if [ "$2" = "" ]; then echo "Usage:"; usage_file "$0" "$mode"; exit; fi
    prog="useradd/$mode.sh"
    args="--file $2"
    ;;
  "--list"|"-l")
    if [ "$2" = "" ]; then echo "Usage:"; usage_list "$0" "$mode"; exit; fi
    prog="useradd/$mode.sh"
    args="--list $2" 
    ;;
esac

if [ "$mode" = "deluser" -a "$1" = "--group" -a "$2" != "" ]; then
  prog="useradd/deluser.sh"
  args="--group $2"
fi

if [ "$prog" = "" ]; then echo "Usage:"; usage_all "$0" "$mode"; exit; fi

## Blake, 2003/12/29
# add/delete single user
#if [ $# -gt 1 -a "$1" = "--single" ]; then
#  if [ $# -lt 2 -a "$mode" = "useradd" ]; then
#    echo "Usage: "
#    echo "  $0 --single <username>"
#    echo "    generate a single user <username>"
#    exit
#  elif [ $# -lt 2 -a "$mode" = "userdel" ]; then
#    echo "Usage: "
#    echo "  $0 --single <username>"
#    echo "    delete a single user <username>"
#    exit
#  else
#    if [ "$mode" = "userdel" ]; then
#      prog="useradd/deluser.sh"
#      args="--single $2"
#    else
#      prog="useradd/adduser.sh"
#  	  args="--single $2"
#    fi
#  fi  
#fi
#
## add a range of users
#if [ $# -gt 1 -a "$1" = "--range" ]; then
#  if [ $# -lt 4 -a "$mode" = "useradd" ]; then
#    echo "Usage: "
#    echo "  $0 --range <prefix> <start> <end> [<length_of_password>]"
#    echo "    generate a range of users from <prefix><start> to <prefix><end>,"
#    echo "    if <length_of_passwd> is assigned,"
#    ehco "    the username/password pairs are listed in useradd.gen."
#    echo "    Otherwise, the password is the same as the username"
#    exit
#  elif [ $# -lt 4 -a "$mode" = "userdel" ]; then
#    echo "Usage: "
#    echo " $0 --range <prefix> <start> <end>"
#    echo "    delete a range of users from <prefix><start> to <prefix><end>,"
#    exit
#  else
#    if [ "$mode" = "userdel" ]; then
#      prog="useradd/deluser.sh"
#      args="--range $2 $3 $4 $5"
#    else
#      prog="useradd/adduser.sh"
#  	  args="$2 $3 $4 $5 $6"
#    fi
#  fi  
#fi
#
## add users which are listed in file
#if [ $# -gt 1 -a "$1" = "--file" ]; then
#  if [ $# -lt 3 -a "$mode" = "useradd" ]; then
#    echo "Usage: "
#    echo "  $0 --file <filename> <length_of_password>"
#    echo "    generate users that are listed in <filename>."
#    echo "    the username/password pairs are listed in useradd.gen"
#    echo 
#    echo "    the format of the file <filename>"
#    echo "       PREFIX START END"
#    echo "    for example: "
#    echo "    # account for student"
#    echo "    s	89101	89129"
#    echo "    # account for teacher"
#    echo "    tckps	01	99"
#    exit
#  elif [ $# -lt 2 -a "$mode" = "userdel" ]; then
#    echo "Usage: "
#    echo "  $0 --file <filename>"
#    echo "    delete users that are listed in <filename>."
#    echo "    the filename is the one that is generated by drbl-useradd"
#    exit
#  else 
#    if [ "$mode" = "userdel" ]; then
#      prog="useradd/deluser.sh"
#      args="--file $2 $3"
#    else
#      prog="useradd/adduser.pl"
#	  args="$2 $3"
#    fi
#  fi  
#fi

# install some packages before installation
apt-get -y install zip unzip expect

outname=$BINARY_OUTNAME
trap 'rm -f $outname; rm -rf useradd; exit 1' HUP INT QUIT TERM
#echo "Unpacking..."
tail +$BINARY_LINENO $0 > $outname
#if [ -x /usr/bin/sum ]; then
#    echo "Checksumming..."
#
#    sum=`/usr/bin/sum $outname`
#    index=1
#    for s in $sum
#    do
#    case $index in
#    1)  sum1=$s;
#        index=2;
#        ;;
#    2)  sum2=$s;
#        index=3;
#        ;;
#    esac
#    done
#    if expr $sum1 != $BINARY_BSD_CHECKSUM1 ||
#       expr $sum2 != $BINARY_BSD_CHECKSUM2 ; then
#      echo "The download file appears to be corrupted."
#      exit 1
#    fi
#else 
#    echo "Can't find /usr/bin/sum to do checksum. Continuing anyway."
#fi

#echo "Extracting..."

if [ -x /usr/bin/unzip ]; then
  /usr/bin/unzip $outname > /dev/null
fi

#echo "Setuping..."

eval "$prog $args"

cpwd=`pwd`
cd /var/yp/
make > /dev/null
cd $cpwd

echo "Done."
rm -f $outname
rm -rf useradd
exit 0
PK
     1              useradd/UT	 jpA|!AUx d PK    Ό.m       useradd/autopasswdUT	 U>|!AUx d ;0D{bq\ SRq kkHc>)(igqTYP		HPwj/	#$ <ع^@@֎F&coLà9~E[B0O䣅ՑT&{е`vS<G60%UQ	PK    Ό.X   '    useradd/autosmbpasswdUT	 U>|!AUx d 10=@L܃2Fqw'T󗝍URQO5TG|ߊ7]0S@lјΎ	*<w):+%~
laa~F+J	EHS
i,gǖz	_QxN~Wu*e-RWPK    Ό.WV       useradd/autosshkeygenUT	 U>|!AUx d uA0}O,P#)1]\-CBɰ3<q+-mnmF9aTB'ƶRG="бpo#_[	Qɼ78	#.>Tҙ<c|*5.گl GRo7PK    Mq0T4T      useradd/adduser.shUT	 4W@|!AUx d WKs6>~BGv&z[u4)(v|"eٛd֋-  BUpZm@7	FM^__! u=Cb8r r$SN	
Qlz^q~,dSֺX[qZoE@`aсcYj4S #{@p~B+@{>诗P[JPmkWk3JX2)spr)~ڶ2QOA5u!U=bCM@N-u8<t]aL(hT
FQVt=d:d%'	Aɮ*ReȗL1Ϥw-|#zR0&`[*Ot:W5գ<8"Gl5!1rF Ta
KH
/hȈ|<_`>ބY8rf{6?
N^"h7T[k7M
F2y2fS<+8XhtF}c5WqRb%#KG$f.$v.Aޏ0_\pMBTmQ
Tʫh:*ݸ,v*Hkя6"ͩŭ{b>"){:8nT:쓬j[k!:9r&_ܸtO_zhTaMlmN>̒MţI<A_iQeiA}U`?x.+Q?Ll }xv94EggN27/͝\bi/^٬օj󢻲LCO0Lj
YCgA3]T4⒋uwf][(tm6d9%xy>'.eӖd1N/g5OS0<	ոG޸`ujr_vai,ђ?dܫ-k<TѫKL[ΠNp@_}߭I3^&UHݤ̠iS*bv;٧m+q~|irܙεdvu|;f[kxe{2yvn/g`uOZ߫mj&PK    nD0lݍ  !    useradd/drbluseraddUT	  @|!AUx d ZmSH~E:lclSE6L]%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+
9IQP,Y؜]e[dt'hb|㇯Y$?Z-șz=bIyJÒ/ʃy|7/\sL!}D+&Zh%
KX[ɧP}Yx0xwIh{}?7WdtPɹ=X`{}\Ou`dfkАrjTɮ88Q_PK
     A1              useradd/CVS/UT	 sA|!AUx d PK
     1C~/   /     useradd/CVS/RootUT	 jpA|!AUx d :ext:klhaung@ostask.nchc.gov.tw:/forge/cvsroot
PK    1~#   (     useradd/CVS/RepositoryUT	 jpA|!AUx d K)JOIML/N.,(O
%Ci. PK    A1xK   ^    useradd/CVS/EntriesUT	 sA|!AUx d б0ݧ'Qn&$k$i%ƷD?ߝ0S>{%AeO%Ȓ$RRBJC24ƃA*BumMwު b5-wuCwu?5s 䞔GoٷG~ٌ2$]l^6XJ=PK
     1             
        A    useradd/UT jpAUx  PK    Ό.m      
        ;   useradd/autopasswdUT U>Ux  PK    Ό.X   '   
        &  useradd/autosmbpasswdUT U>Ux  PK    Ό.WV      
          useradd/autosshkeygenUT U>Ux  PK    Mq0T4T     
          useradd/adduser.shUT 4W@Ux  PK    nD0lݍ  !   
          useradd/drbluseraddUT  @Ux  PK    P/*sl  m	   
          useradd/adduser.plUT ?Ux  PK    q<0     
          useradd/rand.plUT 6S@Ux  PK    qD0]bQ  @   
        (  useradd/deluser.shUT ׍ @Ux  PK
     A1             
        A  useradd/CVS/UT sAUx  PK
     1C~/   /    
        O  useradd/CVS/RootUT jpAUx  PK    1~#   (    
          useradd/CVS/RepositoryUT jpAUx  PK    A1xK   ^   
        -  useradd/CVS/EntriesUT sAUx  PK    
 
       