#!/bin/bash # MakeMark5 # Starting from generic Linux, make a Mark-5 software installation. # This must be executed by root. And you'll need Internet access # to Haystack to download the tarball. # This version should work on either RedHat or Ubuntu. # (Remember bash, not tcsh.) Revised: 2005 May 26, JAB # # Debug pause after each line: # function pause { echo -n "." ; read ; } # trap pause DEBUG # echo " Check: Must be root: " if [ ` id -u ` != 0 ] ; then echo " You must be root to run MakeMark5. Sorry. " exit -1 fi # echo " Making a login for oper: " /usr/sbin/useradd -m -p '$1$pFgccZGg$zgsSQUL3qA6Cpba0PwUD70' \ -g users -s /bin/tcsh oper chmod 0755 ~oper # echo " Making a login for jball: " /usr/sbin/useradd -m -p '$1$NGfJHjfD$Rp9Fj8ub9ZNO9SK23gMs6/' \ -g users -u 501 -s /bin/tcsh jball chmod 0755 ~jball # echo " Creating the following directories: " mkdir -v -m 0755 /home/streamstor mkdir -v -m 0755 ~jball/bin mkdir -v -m 0755 ~jball/C mkdir -v -m 0755 ~jball/F mkdir -v -m 0755 ~jball/Mark5 mkdir -v -m 0755 /var/dir # echo " Creating file /var/dir/Mark5A: " cd /var/dir touch Mark5A chmod 0644 Mark5A # echo " Creating the following symbolic links: " cd /home/streamstor ln -s linux Sdk cd ~oper ln -s ~jball/bin . ln -s ~jball/C . ln -s ~jball/F . ln -s ~jball/Mark5 . cd ~jball/C ln -s /home/streamstor/Sdk/include/sc_api.h . ln -s /home/streamstor/Sdk/include/xlrapi.h . ln -s /home/streamstor/Sdk/include/xlrtypes.h . ln -s /home/streamstor/Sdk/lib/libssapi.a . cd ~jball/bin ln -s /home/streamstor/Sdk/util/sslog . ln -s /home/streamstor/Sdk/util/ssflash . ln -s /home/streamstor/Sdk/util/ssopen . ln -s /home/streamstor/Sdk/util/sstest . # echo " Copying the following .chsrc file into both ~oper and ~jball: " cat << '..End..' > ~oper/.cshrc # # Generic .cshrc # This version for Linux # Revised: 2002 February 21, JAB # setenv HZ 100 alias wh who /var/log/wtmp alias www cd /home/httpd/html alias tq /usr/sbin/ntpq -p # The stuff prior to this line should get executed on # remote shell from some other computer. if ( $?prompt == 0 ) exit echo "csh on `hostname` (`uname`) is executing $HOME/.cshrc " unset autologout # echo HZ is $HZ echo PATH is $PATH # set hname = $HOST:r # set hn = $hname:r # unset hname set hname = ` hostname ` set dname = .` dnsdomainname ` set hn = ` basename $hname $dname ` unset hname dname if ( $?LOGNAME == 1 ) then set prompt = "$LOGNAME@${hn}[\!]% " else if ( $?USER == 1 ) then set prompt = "$USER@${hn}[\!]% " else set prompt = "`whoami`@`hostname`[\!]% " endif stty erase "^?" ; echo "erase set to ^? " set history = 15 ; echo history set to $history set cdpath = ~ ; echo cdpath set to $cdpath echo Working directory is `pwd` date '+ %Y %B %d (%A) %R %Z' echo " " ..End.. cp ~oper/.cshrc ~jball/.cshrc # echo " Copying the following .login file to both ~oper and ~jball: " cat << '...End...' > ~oper/.login # # Generic .login revised: 2002 May 20, JAB # This version for Linux. # source /etc/cshrc echo "csh on ` hostname ` (`uname`) is executing $HOME/.login " # `hostname` doesn't seem to work on gauss echo "tty is: " ` tty ` if ( $?TERM == 1 ) then echo "TERM is $TERM (but may be changed below)" endif setenv PATH :$HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/bin/X11 if ( ` tty ` == '/dev/console' ) then # setenv PATH $PATH':/usr/bin/X11' setenv DISPLAY ` hostname `:0 ; echo DISPLAY set to $DISPLAY setenv TERM AT386-M else if ( $?TERM == 0 ) then setenv TERM vt100 else if ( $TERM == 'unknown' ) then setenv TERM vt100 endif set term = $TERM # setenv MANPATH /usr/share/man:/usr/local/man # setenv PAGER "more -s" setenv PAGER "less -s" setenv NNTPSERVER news.mit.edu setenv STREAMSTOR_BIB_PATH /home/streamstor/Sdk/bib setenv SS /home/streamstor/Sdk tput init echo "tput longname is: " ` tput longname ` stty kill "^X" ; echo Kill set to control-X stty intr "^C" ; echo Intr set to control-C stty echoe ; echo Echoe set on echo PATH set to $PATH ps -l ; w echo HOME is $HOME ... Directory of ` pwd ` is: ls -al date '+ %Y %B %d (%A) %R %Z' ...End... chown -R oper.users ~oper cp ~oper/.login ~jball/.login chown -R jball.users ~jball # echo " Appending the following onto /etc/services: " cd /etc mv services services.dist cat services.dist - << '....End....' > services # Local services m4crate 2600/tcp # Mark-4 Crates m4crate 2600/udp # Mark-4 Crates m4taplib 2610/tcp # Mark-4 Tape Library m4taplib 2610/udp # Mark-4 Tape Library m5drive 2620/tcp # Mark-5 Drives m5drive 2620/udp # Mark-5 Drives m5data 2630/tcp # Mark-5 Data m5data 2630/udp # Mark-5 Data m4msgd 2680/tcp # Mark-4 Messaging m4msgd 2680/udp # Mark-4 Messaging ....End.... chmod --reference=services.dist services # echo " Appending the following onto rc.local: " cd /etc if [ -d rc.d ] ; then cd rc.d fi # (On Ubuntu, there is no rc.d directory, but that's OK) if [ ! " -a rc.local " ] ; then # No rc.local, so make one: echo "#!/bin/bash " > rc.local chmod 0755 rc.local fi mv -f rc.local rc.local.dist cat rc.local.dist - << '.....End.....' > rc.local # # Added 2002 February 5, JAB: echo "Loading module windrvr6 for StreamStor " # /home/streamstor/Sdk/driver/wdreg /lib/modules/misc/windrvr.o /sbin/insmod windrvr6 chmod 0666 /dev/windrvr6 chmod 0666 /dev/ttyS0 # Revised 2003 July 09, JAB: echo "Setting the clock from NTP " /usr/sbin/ntpdate -b -p 8 -u gauss .....End..... chmod 0755 rc.local # echo " Reseting time daily using cron: " cd /etc/cron.daily echo "#!/bin/bash" > ntpdate echo "/usr/sbin/ntpdate -b -p 8 -u gauss " >> ntpdate chmod 0755 ntpdate # echo " Creating /etc/hardware_id (with dummy contents): " cd /etc echo "mark5-XX" > hardware_id chmod 0444 hardware_id # echo " Downloading the Mark-5 tarball from Haystack into /tmp: " cd /tmp rm -f Mark5A.tar.gz rm -f Mark5A.tgz # /usr/bin/ncftpget ftp://web.haystack.edu/dist/mark5/Mark5A.tgz /usr/bin/wget ftp://web.haystack.edu/dist/mark5/Mark5A.tgz if [ $? != 0 ] ; then echo " Some ERROR. You must have Internet access to Haystack. Sorry. " exit -2 fi echo " Unzipping and untarring this tarball: " /bin/tar xzvpP --same-owner -f Mark5A.tgz if [ $? != 0 ] ; then echo " Some ERROR. Something must be done about this. " exit -3 fi echo " Doing a Jungo driver re-installation: " cd /home/streamstor/linux/driver/redist rm -fr LINUX* ./configure make clean make make install if [ $? != 0 ] ; then echo " ERROR: The Jungo driver re-installation seems to have failed. " exit -4 fi echo " (You may ignore the warning about \"will taint the kernel\") " chmod 0666 /dev/windrvr6 echo " Recompile all Mark-5-associated programs: " cd ~jball/bin ./cc5A echo " ##### Now check for any errors noted above ##### " echo " The following manual operations remain to be done: " echo " Substitute a local NTP server instead of gauss in the last lines of " echo " /etc/rc.d/rc.local or /etc/rc.local and /etc/cron.daily/ntpdate . " echo " Write this machine's official name (i.e., mark5-nn) into " echo " /etc/hardware_id (e.g., \"echo mark5-nn > /etc/hardware_id\"). " echo " Change the root password to match this machine's official name. " echo " If you don't have any error messages, then Mark5A should be ready. " echo " Logout as root and login as oper (!), " echo " and then run the prescribed suite of tests on this machine. "