home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume4 / unaxcess / part1 / Utilities / install.sh next >
Encoding:
Text File  |  1986-11-30  |  12.6 KB  |  436 lines

  1. echo ""
  2. echo "UNaXcess V0.04.03 Installation Script"
  3. echo "By Brandon S. Allbery"
  4. echo ""
  5. echo "You are free to copy, modify, etc. this installation script as much as you"
  6. echo "wish; it's bound to come in handy if anyone on your system does programming."
  7. echo "This script should run on most Unix-based systems.  If it doesn't, PLEASE let"
  8. echo "me know at ...decvax!cwruecmp!ncoast!allbery."
  9. echo ""
  10. echo "I will be asking you for information as I install UNaXcess.  When I do, I'll"
  11. echo "let you know by ending the question with two arrows, like this:  -> ->"
  12. echo "When I do this, it's a signal for you to tell me something.  Usually, pressing"
  13. echo "RETURN will do something reasonable."
  14. echo ""
  15. :
  16. : Note to hackers -- the original idea for this script hails from lwall@sdcrdcf
  17. : but this script is entirely mine.  To see the original, ask anyone with rn
  18. : sources.
  19. :
  20. : Yes, the "-> ->" business is copped from Unify.  I sincerely doubt that it is
  21. : copyrighted, and it is fairly obvious.
  22.  
  23. if test ! -w /etc/passwd; then
  24.     echo "I'm not running as root.  Please ask a system administrator to run this install"
  25.     echo "script as root, as I need to create directories and possibly even a user name."
  26.     exit 1
  27. fi
  28. : end of test for root.  This is about as portable as you get.
  29.  
  30. echo "Please enter the username of the owner of this UNaXcess system.  -> ->"
  31. read UAOWNER
  32. case "$UAOWNER" in
  33. "")    echo "I hope you wanted to abort, because you just did."
  34.     exit 1
  35. esac
  36. if grep "^$UAOWNER:" /etc/passwd >/dev/null 2>&1; then
  37.     echo "I see $UAOWNER already exists.  Do you want to use him?  -> ->"
  38.     read yesno
  39.     case "$yesno" in
  40.     y*|Y*)    echo "Okay, we use $UAOWNER as the owner of UNaXcess."
  41.         ;;
  42.     *)    echo "Then we'll start again from scratch."
  43.         exec sh Utilities/install.sh
  44.     esac
  45. else
  46.     echo "I don't see a user named $UAOWNER on this system.  Should I create one?  -> ->"
  47.     read yesno
  48.     case "$yesno" in
  49.     y*|Y*)    echo "Okay, we make him."
  50.         ;;
  51.     *)    echo "Then we'll start again from scratch."
  52.         exec sh Utilities/install.sh
  53.     esac
  54.     UAUID=`sed 's/^[^:]*:[^:]*:\([^:]*\):.*$/\1/' < /etc/passwd | sort -n | tail -1`
  55.     UAUID=`expr $UAUID + 1`
  56.     echo "I'm going to call $UAOWNER's home directory /usr/$UAOWNER."
  57.     echo "If you have a better idea, please tell me what it is.  -> ->"
  58.     read home
  59.     case "$home" in
  60.     "")    echo "Ok, we use /usr/$UAOWNER."
  61.         home=/usr/$UAOWNER
  62.     esac
  63.     if test -r $home; then
  64.         echo "It seems that this particular name's in use.  Let's try again."
  65.         exec sh Utilities/install.sh
  66.     fi
  67.     echo "$UAOWNER::$UAUID:1:UNaXcess Control Login:$home:" >> /etc/passwd
  68.     mkdir $home
  69.     chown $UAOWNER $home
  70.     echo "Now give $UAOWNER a password.  DON'T LEAVE IT UNPROTECTED!!!"
  71.     passwd $UAOWNER
  72. fi
  73. echo ""
  74. UAHOME="`sed -n '/^'$UAOWNER':/s=^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*\$=\1=p' < /etc/passwd`"
  75. echo "UNaXcess will be installed in $UAHOME.  Is this okay?  -> ->"
  76. read yesno
  77. case "$yesno" in
  78. y*|Y*)    echo "Then we'll proceed with the installation."
  79.     ;;
  80. *)    echo "Please check /etc/passwd for $UAOWNER's home directory, and fix it."
  81.     echo "Then type 'sh Utilities/install.sh' to try installation again."
  82.     exit 1
  83. esac
  84. chmod 711 $UAHOME
  85. : now we know the home and owner of UNaXcess
  86.  
  87. if test ! -d $UAHOME/msgdir; then
  88.     echo "Creating $UAHOME/msgdir..."
  89.     rm -rf $UAHOME/msgdir
  90.     mkdir $UAHOME/msgdir
  91.     chown $UAOWNER $UAHOME/msgdir
  92. fi
  93. if test ! -d $UAHOME/motd; then
  94.     echo "Creating $UAHOME/motd..."
  95.     rm -rf $UAHOME/motd
  96.     mkdir $UAHOME/motd
  97.     chown $UAOWNER $UAHOME/motd
  98. fi
  99. if test ! -d $UAHOME/library; then
  100.     echo "Creating $UAHOME/library..."
  101.     rm -rf $UAHOME/library
  102.     mkdir $UAHOME/library
  103.     chown $UAOWNER $UAHOME/library
  104. fi
  105. if test ! -d $UAHOME/uploads; then
  106.     echo "Creating $UAHOME/uploads..."
  107.     rm -rf $UAHOME/uploads
  108.     mkdir $UAHOME/uploads
  109.     chown $UAOWNER $UAHOME/uploads
  110. fi
  111. echo "Creating $UAHOME/Logfile..."
  112. rm -f $UAHOME/Logfile
  113. chown $UAOWNER $UAHOME/Logfile > $UAHOME/Logfile
  114. if test ! -f $UAHOME/userind; then
  115.     echo "Creating $UAHOME/userind..."
  116.     rm -rf $UAHOME/userind
  117.     chown $UAOWNER $UAHOME/userind > $UAHOME/userind
  118. fi
  119. if test ! -d $UAHOME/msgdir/general; then
  120.     echo "Creating conference general..."
  121.     rm -rf $UAHOME/msgdir/general
  122.     mkdir $UAHOME/msgdir/general
  123.     chown $UAOWNER $UAHOME/msgdir/general
  124.     echo 1 > $UAHOME/msgdir/general/himsg
  125.     chown $UAOWNER $UAHOME/msgdir/general/himsg
  126.     cat << --general/1-- > $UAHOME/msgdir/general/1
  127. Date: `Utilities/udate`
  128. From: The UNaXcess System Operator
  129. To: All
  130. Subject: This BBS
  131.  
  132. Welcome to UNaXcess V0.04.03 -- a computer bulletin board system designed for
  133. the UNIX(tm) operating system.  You are using the ONLY BBS which is designed
  134. to USE Unix's unique features to their fullest potential.
  135.  
  136. This conference is the general-purpose conference.  Use it for discussions that
  137. don't fit in any of the existing conferences.  But if it's liable to be large,
  138. consider making a new conference for it.
  139.  
  140. The basic UNaXcess commands are:
  141.  
  142.     r    Read messages.  You may specify a message number on the
  143.         command line, or you will be asked how to read messages.
  144.     
  145.     n    Read all new messages in all conferences.
  146.     
  147.     e    Enter a new message.  You can specify the recipient's
  148.         name on the command line, like "e John Doe".
  149.     
  150.     j    Join a different conference.  You can also create a new
  151.         conference with this command.  You can specify the new
  152.         conference on the command line:  "j discussion".
  153.     
  154.     g    Exit UNaXcess.
  155.     
  156.     f    Enter the File Section.  UNaXcess is capable of file
  157.         uploading and downloading with ASCII, Xmodem and Kermit
  158.         (not all maybe available on all systems).
  159.  
  160. Press BREAK (or DEL or CONTROL C, depending on the system) to stop a command.
  161. Press CONTROL-\ (CONTROL plus backslash) for a fast logout.
  162.  
  163. --general/1--
  164. fi
  165. if test ! -d $UAHOME/msgdir/guest; then
  166.     echo "Creating conference guest..."
  167.     rm -rf $UAHOME/msgdir/guest
  168.     mkdir $UAHOME/msgdir/guest
  169.     chown $UAOWNER $UAHOME/msgdir/guest
  170.     echo 1 > $UAHOME/msgdir/guest/himsg
  171.     chown $UAOWNER $UAHOME/msgdir/guest/himsg
  172.     cat << --guest/1-- > $UAHOME/msgdir/guest/1
  173. Date: `Utilities/udate`
  174. From: The UNaXcess System Operator
  175. To: All
  176. Subject: This conference
  177.  
  178. This conference is for any and all users of UNaXcess.  ANYONE may post messages
  179. to the guest conference at any time.
  180.  
  181. --guest/1--
  182. fi
  183. : end of system files build, for the most part
  184.  
  185. echo "Where do you want the programs to go?  ENTER defaults to /bin.  -> ->"
  186. read BIN
  187. case "$BIN" in
  188. "")    echo "I'll use /bin, then."
  189.     BIN=/bin
  190.     ;;
  191. *)    echo "Ok, I'll put them in $BIN."
  192.     ;;
  193. esac
  194. if test ! -d $BIN; then
  195.     echo "I can't find $BIN.  Please start over after you make it."
  196.     exit 1
  197. fi
  198. echo "What do you want to call UNaXcess?  ENTER defaults to ua.  -> ->"
  199. read ua
  200. case "$ua" in
  201. "")    ua="ua"
  202. esac
  203. echo "What do you want to call the user lister?  ENTER defaults to uwho.  -> ->"
  204. read uwho
  205. case "$uwho" in
  206. "")    uwho="uwho"
  207. esac
  208. echo "What do you want to call the date printer?  Enter defaults to udate.  -> ->"
  209. read udate
  210. case "$udate" in
  211. "")    udate="udate"
  212. esac
  213. echo "Creating $BIN/$ua..."
  214. cp ua $BIN/$ua
  215. chown $UAOWNER $BIN/$ua
  216. chmod 4711 $BIN/$ua
  217. echo "Creating $BIN/$udate..."
  218. cp Utilities/udate $BIN/$udate
  219. chown $UAOWNER $BIN/$udate
  220. chmod 711 $BIN/$udate
  221. echo "Creating $BIN/$uwho..."
  222. cp Utilities/uwho $BIN/$uwho
  223. chown $UAOWNER $BIN/$uwho
  224. chmod 4711 $BIN/$uwho
  225. echo "Creating $UAHOME/mkconf..."
  226. cp Utilities/mkconf $UAHOME/mkconf
  227. chown $UAOWNER $UAHOME/mkconf
  228. chmod 4711 $UAHOME/mkconf
  229. : end of binary installation
  230.  
  231. echo "What do you want to call the shell message poster?  ENTER defaults to upost."
  232. echo "  -> ->"
  233. read upost
  234. case "$upost" in
  235. "")    upost="upost"
  236. esac
  237. echo "Creating $BIN/$upost..."
  238. sed -e "s;@UAOWNER@;${UAOWNER};" -e "s;@udate@;BIN/${udate};" < Utilities/upost.sh > $BIN/$upost
  239. chown $UAOWNER $BIN/$upost
  240. chmod 755 $BIN/$upost
  241. echo "What do you want to call the shell bulletin poster?  ENTER defaults to umotd."
  242. echo "  -> ->"
  243. read umotd
  244. case "$umotd" in
  245. "")    umotd="umotd"
  246. esac
  247. echo "Creating $BIN/$umotd..."
  248. sed -e "s;@UAOWNER@;${UAOWNER};" -e "s;@udate@;$BIN/${udate};" < Utilities/umotd.sh > $BIN/$umotd
  249. chown $UAOWNER $BIN/$umotd
  250. chmod 755 $BIN/$umotd
  251. echo "What do you want to call the message mover?  ENTER defaults to mvmsg."
  252. echo "  -> ->"
  253. read mvmsg
  254. case "$mvmsg" in
  255. "")    mvmsg="mvmsg"
  256. esac
  257. echo "Creating $BIN/$mvmsg..."
  258. cp Utilities/mvmsg $BIN/$mvmsg
  259. chown $UAOWNER $BIN/$mvmsg
  260. chmod 4700 $BIN/$mvmsg
  261. echo "Do you want to install the USENET News Transfer Facility?  ENTER defaults"
  262. echo " to NO.  -> ->"
  263. read instnews
  264. case "$instnews" in
  265. y*|Y*)    echo "What do you want to call the transfer program?  ENTER defaults to"
  266.     echo "uanews.  -> ->"
  267.     read uanews
  268.     case "$uanews" in
  269.     "")    uanews="uanews"
  270.     esac
  271.     echo "Creating $BIN/$uanews..."
  272.     cp Utilities/uanews $BIN/$uanews
  273.     chown $UAOWNER $BIN/$uanews
  274.     chmod 4700 $BIN/$uanews
  275. esac
  276. : end of shell utilities installation
  277.  
  278. echo ""
  279. echo "Now I'm going to create the runtime configuration file for UNaXcess.  This"
  280. echo "file allows you to decide what features of UNaXcess are allowed in your BBS"
  281. echo "system."
  282. echo ""
  283. echo "I suggest you read the UNaXcess README file before doing this, so you'll"
  284. echo "know what I'm talking about."
  285. echo ""
  286. echo "Do you want to allow READ-ONLY conferences?  Press RETURN for YES.  -> ->"
  287. read yesno
  288. case "$yesno" in
  289. ""|y*|Y*)
  290.     readonly=YES
  291.     ;;
  292. *)    readonly=NO
  293. esac
  294. echo "Do you want to allow X-RATED (restricted) conferences?  Press RETURN for NO."
  295. echo "  -> ->"
  296. read yesno
  297. case "$yesno" in
  298. y*|Y*)
  299.     xrated=YES
  300.     ;;
  301. *)    xrated=NO
  302. esac
  303. echo "What is the editor to be run?  The default is the internal editor.  -> ->"
  304. read editor
  305. case "$editor" in
  306. "")    editor=ua-edit
  307. esac
  308. echo "What is the shell to be run by the COMMAND option?  The default is /bin/sh."
  309. echo "  -> ->"
  310. read shell
  311. case "$shell" in
  312. "")    shell=/bin/sh
  313. esac
  314. echo "Do you want to have UNaXcess check the user's shell and editor preferences"
  315. echo "via the EDITOR and SHELL environment variables?  The default is YES.  -> ->"
  316. read env
  317. case "$env" in
  318. N*|n*)    env=NO
  319.     ;;
  320. *)    env=YES
  321. esac
  322. echo "What is the login name of the user who can't log directly into UNaXcess?"
  323. echo "RETURN if all users can log in directly  -> ->"
  324. read bbsuser
  325. echo "What is the time limit on UnaXcess, in minutes?  -> ->"
  326. read tlimit
  327. case "$tlimit" in
  328. "")    tlimit=0
  329. esac
  330. echo "What is the system operator's UNaXcess login to be?  RETURN for SYSOP  -> ->"
  331. read sysop
  332. case "$sysop" in
  333. "")    sysop="sysop"
  334. esac
  335. echo "Do you want to allow private messages?  RETURN for YES  -> ->"
  336. read private
  337. case "$private" in
  338. N*|n*)    private=NO
  339.     ;;
  340. *)    private=YES
  341. esac
  342. echo "Do you want to enable logging?  RETURN for YES  -> ->"
  343. read logging
  344. case "$logging" in
  345. N*|n*)    logging=NO
  346.     ;;
  347. *)    logging=YES
  348. esac
  349. echo "Please specify one of the following choices:"
  350. echo "    nopause     Don't pause after 16 lines of output"
  351. echo "    ask         Ask each user whether he wants puses or not"
  352. echo "    pause       Pause after 16 lines of output always"
  353. echo "Please select one, or press RETURN for ASK:  -> ->"
  354. read pauses
  355. case "$pauses" in
  356. N*|n*)    pauses=2
  357.     ;;
  358. P*|p*)    pauses=0
  359.     ;;
  360. *)    pauses=1
  361. esac
  362. echo "How many tries should a user get to log in?  RETURN for 3  -> ->"
  363. read logtries
  364. case "$logtries" in
  365. "")    logtries=3
  366. esac
  367. echo ""
  368. echo "Creating $UAHOME/ua-config..."
  369. cat << --CONFIG-- > $UAHOME/ua-config
  370. readonly    $readonly
  371. x-rated        $xrated
  372. editor        $editor
  373. shell        $shell
  374. read-env    $env
  375. bbs-user    $bbsuser
  376. time-limit    $tlimit
  377. sysop        "$sysop"
  378. private-msgs    $private
  379. logging        $logging
  380. banner        ""
  381. login-msg    ""
  382. pauses        $pauses
  383. login-tries    $logtries
  384. --CONFIG--
  385. chown $UAOWNER $UAHOME/ua-config
  386. chmod 644 $UAHOME/ua-config
  387. echo ""
  388. echo "You can edit the config file yourself to change these and other options."
  389. : end of config file generation
  390.  
  391. echo ""
  392. echo "Creating $UAHOME/userfile..."
  393. cat << --USERFILE-- > $UAHOME/userfile
  394. $sysop::5::80:0
  395. new::6::2:0
  396. guest::1::40:0
  397. --USERFILE--
  398. chown $UAOWNER $UAHOME/userfile
  399. chmod 644 $UAHOME/userfile
  400. : end of userfile installation
  401.  
  402. echo ""
  403. echo "I am going to create a simple new-user bulletin.  It is your job to change it"
  404. echo "to say what you want it to say."
  405. echo ""
  406. echo "Creating $UAHOME/NewMessage..."
  407. cat << --NEWMESSAGE-- > $UAHOME/NewMessage
  408.  
  409. Welcome to the UNaXcess System, Copyright (C) 1984, 1985 by Brandon S. Allbery.
  410. This UNaXcess was installed `Utilities/udate`.
  411.  
  412. --NEWMESSAGE--
  413. chown $UAOWNER $UAHOME/NewMessage
  414. chmod 644 $UAHOME/NewMessage
  415. : end of new user bulletin installation
  416.  
  417. echo "Creating $UAHOME/motd/himotd..."
  418. echo 0 > $UAHOME/motd/himotd
  419. chown $UAOWNER $UAHOME/motd/himotd
  420. chmod 644 $UAHOME/motd/himotd
  421. echo ""
  422. echo "Now you must create the main bulletin.  I will run the $umotd program"
  423. echo "for you -- you will simply enter the bulletin.  I hope you have EDITOR set"
  424. echo "up correctly!"
  425. echo ""
  426. $BIN/$umotd
  427. : end of bulletin installation
  428.  
  429. echo ""
  430. echo "Congratulations!  You have just successfully installed the UNaXcess System."
  431. echo "Before you use it, I suggest you put a password on the '$sysop' login,"
  432. echo "so nobody else can make trouble with it."
  433. echo ""
  434. $BIN/$udate
  435. echo "UNaXcess Version 0.04.03 (Pre-release) has been installed."
  436.