home *** CD-ROM | disk | FTP | other *** search
/ norge.freeshell.org (192.94.73.8) / 192.94.73.8.tar / 192.94.73.8 / pub / sdf / historical / mkacct.orig < prev    next >
Text File  |  1995-01-27  |  10KB  |  379 lines

  1. #if [ $LOGNAME. != new. ]
  2. #then
  3. #  echo
  4. #  echo "This function is intended for new users only."
  5. #  exit 1
  6. #fi
  7. echo "This function creates a new account, with full access to all system"
  8. echo "features, including international UseNet conferences, world wide"
  9. echo "E-mail, editors and programming languages, and much more.  Creation of"
  10. echo "your account is immediate, but continued access may depend on subsequent"
  11. echo "verification of the information."
  12. echo
  13. echo "This system is dedicated to free information, and there are no fees, but"
  14. echo "full and complete information is required to register.  If there is any"
  15. echo "reason you cannot provide verifiable identification for system records,"
  16. echo "answer 'n' to the following question."
  17. echo
  18. echo "create a new account [yn] ? \c"
  19. read response
  20. if [ $response. != y. ]
  21. then
  22.   exit
  23. fi
  24. since=/usr/local/lib/since
  25. regis=/usr/local/lib/regis
  26. file=/usr/local/lib/.regis.log
  27.  
  28. response=n
  29. while [ $response. != y. ] 
  30. do
  31.   echo
  32.   echo "Enter your desired login name.  This should be a unique"
  33.   echo "alphanumeric-only word of 8 chars or less in length."
  34.   echo "This may be your first name, a nickname or handle, or"
  35.   echo "any other word you would like to be identified by."
  36.   login=""
  37.   while [ -z "$login" ]
  38.   do
  39.     echo
  40.     echo "   login: \c"
  41.     read login
  42.     login=`echo $login | tr "[A-Z]" "[a-z]" \
  43.        | tr -cd "\012[0-9][a-z]" | cut -c1-8`
  44.     if grep "^$login:" /etc/passwd >/dev/null
  45.     then
  46.       echo
  47.       echo "That login is already in use.  Please choose another."
  48.       login=""
  49.     elif echo "$login" | fgrep -f /usr/local/lib/.dirt >/dev/null
  50.     then
  51.       echo
  52.       echo "That login is unavailable.  Please choose another."
  53.       login=""
  54.     elif fgrep -x "$login" /usr/local/lib/.banned >/dev/null
  55.     then
  56.       echo
  57.       echo "That login is unavailable.  Please choose another."
  58.       login=""
  59.     fi
  60.     case $login in
  61.       [0-9]*) echo
  62.         echo "Please choose a login that begins with a letter."
  63.         login="";;
  64.     esac
  65.   done
  66.  
  67.   echo
  68.   echo "Enter your displayable full name, as will be shown on user lists."
  69.   echo "This may not be a handle, but it is permitted for this name to be an"
  70.   echo "abbreviation or a nickname, if that is what you are really known by."
  71.   echo "Enter it using proper capitalization, just as you wish it shown."
  72.   full=""
  73.   while [ -z "$full" ]
  74.   do
  75.     echo
  76.     echo "Please enter your displayable full name: \c"
  77.     read full
  78. #   full=`echo $full | tr "[A-Z]" "[a-z]" | ucword`
  79.     full=`echo $full | ucword`
  80.   done
  81.   if echo "$full" | grep -i blut >/dev/null
  82.   then
  83.     echo "\nThat turkey \"$login\" again, name \"$full\"." >>$file
  84.     cat /usr/local/lib/.joker
  85.     stty hupcl
  86.     kill -9 0
  87.     exit
  88.   fi
  89.   echo
  90.   echo "NOTE: All following information is for system records, and will NOT"
  91.   echo "be available to other users.  However, your continued access depends"
  92.   echo "on all this information being complete, accurate, and verifiable."
  93.   echo
  94.   echo "Please enter your full name.  This entry may NOT be a handle, but"
  95.   echo "it must be your complete REAL name.  If this should be determined"
  96.   echo "to be erroneous at some future date, your account will be cancelled."
  97.   echo "Enter it using proper capitalization, just as if you were signing"
  98.   echo "a letter.  NOTE: this name is NOT the one available to the public"
  99.   echo "in the system users list."
  100.   name=""
  101.   while [ -z "$name" ]
  102.   do
  103.     echo
  104.     echo "full name: \c"
  105.     read name
  106.     if echo "$name" | grep " " >/dev/null
  107.     then :
  108.     else
  109.       echo
  110.       echo "That was supposed to be your full name!"
  111.       echo "Do you wish to cancel this procedure now? \c"
  112.       read ans
  113.       case $ans in
  114.     y*|Y*) exit;;
  115.       esac
  116.       echo "Well, then, try it again..."
  117.       name=""
  118.     fi
  119.   done
  120.   if echo "$name" | grep -i "simon.*templ.r" >/dev/null
  121.   then
  122.     echo "\nThat turkey \"$login\" again, name \"$full\"/\"$name\"." >>$file
  123.     cat /usr/local/lib/.joker
  124.     stty hupcl
  125.     kill -9 0
  126.     exit
  127.   fi
  128.   echo
  129.   echo "Your \"street address\" in the next question is considered to be"
  130.   echo "the address at which your home phone is located.  This of course"
  131.   echo "could NOT be a P. O. box."
  132.   addr=""
  133.   while [ -z "$addr" ]
  134.   do
  135.     echo
  136.     echo "Please enter your street address: \c"
  137.     read addr
  138.   done
  139.   city=""
  140.   while [ -z "$city" ]
  141.   do
  142.     echo
  143.     echo "Please enter your city, state, and zip code: \c"
  144.     read city
  145.   done
  146.   echo
  147.   echo "Your home phone number is required for verification, whether or not"
  148.   echo "it is unlisted.  You can be assured it will not be made public under"
  149.   echo "any circumstances."
  150.   phone=""
  151.   while [ -z "$phone" ]
  152.   do
  153.     echo
  154.     echo "Please enter your home VOICE phone number, with area code: \c"
  155.     read phone
  156.   done
  157.   echo "Is this a METRO number [yn] ? \c"
  158.   read met
  159.   case $met in
  160.     y*|Y*) phone="$phone METRO";;
  161.   esac
  162.   echo
  163.   echo "(optional) Please enter your work phone number, if any: \c"
  164.   read work
  165.   if [ ! -z "$work" ]
  166.   then
  167.     echo "Is this a METRO number [yn] ? \c"
  168.     read met
  169.     case $met in
  170.       y*|Y*) work="$work METRO";;
  171.     esac
  172.   fi
  173.   bday=""
  174.   while [ -z "$bday" ]
  175.   do
  176.     echo
  177.     echo "Please enter your date of birth: \c"
  178.     read bday
  179.   done
  180.   echo
  181.   echo "The next few questions are optional, but may assist us to provide"
  182.   echo "better service to you and other users."
  183.   echo
  184.   echo "(optional) Please enter type of PC you are using: \c"
  185.   read equip
  186.   echo
  187.   echo "(optional) Please enter type and speed of modem: \c"
  188.   read modem
  189.   echo
  190.   echo "(optional) Are you a sysop of a BBS system [yn] ? \c"
  191.   read sys
  192.   case "$sys" in
  193.   y*|Y*) 
  194.     sysnm=""
  195.     while [ -z "$sysnm" ]
  196.     do
  197.       echo
  198.       echo "Please enter the Name of your Board: \c"
  199.       read sysnm
  200.     done
  201.     sysno=""
  202.     while [ -z "$sysno" ]
  203.     do
  204.       echo
  205.       echo "Please enter the (data) telephone number, with area code: \c"
  206.       read sysno
  207.     done
  208.     echo "Is this a METRO number [yn] ? \c"
  209.     read met
  210.     case $met in
  211.       y*|Y*) sysno="$sysno METRO";;
  212.     esac ;;
  213.   esac
  214.   echo
  215.   echo "Enter desired terminal emulation.  The most common choices are"
  216.   echo "vt100, ansi, and vt52.  If you have it, vt100 is reccomended."
  217.   echo "many other terms are supported.  If you're not sure what your"
  218.   echo "exact termcap entry is, you may leave this blank for now."
  219.   echo
  220.   echo "     term: \c"
  221.   read term
  222.   if [ -z "$term" ]
  223.   then
  224.     term=vt100
  225.     echo
  226.     echo "By default your TERM is vt100.  It can be changed at any time"
  227.     echo "by editing your .profile for a different setting."
  228.   fi
  229.   shell=""
  230.   while [ -z "$shell" ]
  231.   do
  232.     echo
  233.     echo "Enter desired shell.  The shells that are currently available"
  234.     echo "are:" `cat /etc/shells`
  235.     echo
  236.     echo "Type just a return to get the standard Bourne shell.  If you're"
  237.     echo "not yet familiar with any unix shell, you can type 'm' to use"
  238.     echo "the menu system instead."
  239.     echo
  240.     echo "     shell: \c"
  241.     read shell
  242.     bbs=n
  243.     if [ -z "$shell" ]
  244.     then
  245.       shell=STANDARD
  246.     elif [ $shell = m ]
  247.     then
  248.       shell=STANDARD
  249.       bbs=y
  250.     fi
  251.     if [ $shell. != STANDARD. ]
  252.     then
  253.       shell=`fgrep -x "$shell" /etc/shells`
  254.     fi
  255.   done
  256.   sentry=""
  257.   while [ -z "$sentry" ]
  258.   do
  259.     echo
  260.     echo "The system normally will give you notices when another user logs"
  261.     echo "in or out.  You may elect not to see these if you prefer."
  262.     echo
  263.     echo "Would you like these reports [yn] ? \c"
  264.     read sentry
  265.     case $sentry in
  266.       y*|Y*)    sedstr="";;
  267.       n*|N*)    sedstr="s/sn -u/# &/";;
  268.       *)    sentry="";;
  269.     esac
  270.   done
  271.   dir=/u/$login
  272.   gid=1
  273. # uid=`cut -d: -f3 /etc/passwd | sort -n | tail -1`
  274. # uid=`expr $uid + 1`
  275.   uid=`tail -1 /etc/passwd | cut -d: -f3`
  276.   uid=`/usr/local/lib/pbbs/nextid $uid`
  277.   echo
  278.   echo "     login:" $login
  279.   echo "      name:" $full
  280.   echo " FULL name:" $name
  281.   echo "   address:" $addr
  282.   echo " city, etc:" $city
  283.   echo "     phone:" $phone
  284.   if [ ! -z "$work" ]
  285.   then
  286.     echo "work phone:" $work
  287.   fi
  288.   echo " birthdate:" $bday
  289.   if [ ! -z "$equip" ]
  290.   then
  291.     echo " equipment:" $equip
  292.   fi
  293.   if [ ! -z "$modem" ]
  294.   then
  295.     echo "     modem:" $modem
  296.   fi
  297.   case "$sys" in
  298.   y*|Y*)
  299.     echo "  BBS name:" $sysnm
  300.     echo " BBS phone:" $sysno ;;
  301.   esac
  302.   echo "      term:" $term
  303.   if [ $bbs = y ]
  304.   then
  305.     echo "     shell: PinkBBS"
  306.   else
  307.     echo "     shell:" $shell
  308.   fi
  309.   echo "  home dir:" $dir "(assigned by system)"
  310.   echo "       uid:" $uid "(assigned by system)"
  311.   echo "       gid:" $gid "(assigned by system)"
  312.   echo
  313.   echo "Check this info carefully one more time to be sure that it"
  314.   echo "is all complete and correct."
  315.   echo
  316.   echo "is all the info ok [yn] ? \c"
  317.   read response
  318. done
  319. if [ $shell. = STANDARD. ]
  320. then
  321.   shell=""
  322. fi
  323. echo
  324. trap "" 1 2 3 15
  325. echo "installing account ... \c"
  326. mail register <<RegiS
  327. Subject: New user: $login
  328.  
  329.      login: $login
  330.        uid: $uid
  331.        gid: $gid
  332.  full name: $full
  333.   home dir: $dir
  334.      shell: $shell
  335.    PinkBBS? $bbs
  336.       term: $term
  337.       name: $name
  338.    address: $addr
  339.  city, etc: $city
  340.      phone: $phone
  341. work phone: $work
  342.  birthdate: $bday
  343.  equipment: $equip
  344.      modem: $modem
  345.      sysop? $sys
  346.   BBS name: $sysnm
  347.  BBS phone: $sysno
  348. RegiS
  349. /usr/local/lib/pbbs/stacct $login "$full" $uid $gid $dir $shell || exit 1
  350. mkdir $dir
  351. if echo "$shell" | grep csh >/dev/null
  352. then
  353.   sed -e "$sedstr" -e "/term=.*/s//term=$term/" /etc/stdlogin >$dir/.login
  354.   chgrp $gid $dir $dir/.login
  355.   chown $login $dir $dir/.login
  356. else
  357.   sed -e "$sedstr" -e "/TERM=.*/s//TERM=$term/" /etc/stdprofile >$dir/.profile
  358.   if [ $bbs. = y. ]
  359.   then
  360.     echo "\n# use menu system\nexec pbbs" >> $dir/.profile
  361.   fi
  362.   chgrp $gid $dir $dir/.profile
  363.   chown $login $dir $dir/.profile
  364. fi
  365. #mailx -s "Welcome to SDF" $login < /usr/pub/sdf.welcome
  366. mail $login < /usr/pub/sdf.welcome
  367. echo "\nNew user \"$login\" created, name \"$full\"/\"$name\"." >>$file
  368. echo "$login" >>$regis
  369. echo "`date +%y-%m-%d`  $login" >>$since
  370. echo "done"
  371. echo
  372. echo "When you log in, you will select a password.  Remember, for it to"
  373. echo "be valid it must be at least 6 characters, and have at least one"
  374. echo "non-alphabetic character in it."
  375. echo
  376. echo "Logging out ... log back in under your new account now."
  377. stty -hupcl
  378. kill -9 0
  379.