home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / t / install / installn next >
Encoding:
Text File  |  1995-03-23  |  7.3 KB  |  303 lines

  1. #! /bin/sh
  2. # Installation script for NTeX (v 1.2)
  3. # Copyright 1994, Frank Langbein
  4. # All rights reserved.
  5. #
  6. # Redistributions of this script must retain the above copyright notice, 
  7. # this condition and the following disclaimer.
  8. #
  9. #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  10. #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  11. #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  12. #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  13. #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  14. #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  15. #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  16. #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  17. #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  18. #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  19. #
  20.  
  21. cat << EOF
  22.  
  23.  
  24. NTeX Release 1.2
  25. A TeX distribution for Linux
  26.  
  27. Welcome to the installation script.
  28.  
  29. EOF
  30.  
  31. curr_dir=$(pwd)
  32. TEMP="/tmp"
  33. root="/"
  34. editor="vi"
  35.  
  36. echo -n "Do you want to install form [f]loppy or from [c]urrent dir? "
  37. read ANS;
  38. if test "$ANS" = "f" -o "$ANS" = "F"; then
  39.    SOURCE=floppy
  40.    SOURCEDIR=$TEMP"/ntex-fd."$$
  41.    echo "Installing from floppy (MS-DOS format)."
  42.    echo
  43.    echo -n "Is the soruce drive /dev/fd[0] or /dev/fd[1]? "
  44.    read ANS;
  45.    if test "$ANS" = "0"; then
  46.       DRIVE="/dev/fd0"
  47.    elif test "$ANS" = "1"; then
  48.       DRIVE="/dev/fd1"
  49.    else
  50.       echo "Not a proper choice. Bye!"
  51.       exit 1
  52.    fi
  53.    echo Using the drive $DRIVE.
  54. elif test "$ANS" = "c" -o "$ANS" = "C"; then
  55.    SOURCE=currentdir
  56.    SOURCEDIR=$curr_dir
  57.    echo "Installing from current directory [$curr_dir]."
  58. else
  59.    echo "Not a proper choice. Bye!"
  60.    exit 1
  61. fi
  62. echo
  63. echo -n "Do you want to use the slakware installation script [y/n]? "
  64. read ANS;
  65. if test "$ANS" = "Y" -o "$ANS" = "y"; then
  66.    INSTALL=$curr_dir"/installpkg"
  67.    cat << EOF
  68.  
  69. Unsing slakware installation script.
  70.  
  71. EOF
  72. elif test "$ANS" = "N" -o "$ANS" = "n"; then
  73.    INSTALL=simple_install
  74.    cat << EOF
  75.  
  76. Using a simple installation script. The names of the installed files
  77. are written to [pkgname].files in the current directory.
  78.  
  79. EOF
  80. else
  81.    echo "Not a proper choice. Bye!"
  82.    exit 1
  83. fi
  84.  
  85. ask_install() {
  86. cat $curr_dir/$1.inf
  87. echo -n "Do you want to install $1 [y/n/q]? "
  88. read ANS;
  89. if test "$ANS" = "y" -o "$ANS" = "Y"; then
  90.    touch $curr_dir/$1.ins
  91.    echo $1 will be installed.
  92. elif test "$ANS" = "q" -o "$ANS" = "Q"; then
  93.    rm -f $curr_dir/*.ins
  94.    echo "Bye!"
  95.    exit 1
  96. else
  97.    echo $1 will not be installed.
  98. fi
  99. }
  100.  
  101. cat << EOF
  102.  
  103. Now choose the packages you want to install. Note that you can install
  104. more packages later either by running this script again, by calling
  105. installpkg [name].tgz if the package is in the current directory or 
  106. by calling "cd /; gzip -d [name].tgz; tar xf [name].tar".
  107.  
  108. The header of the descriptions of the packages contains the version of
  109. the package and a status field. The status can be neccessary, recommended,
  110. optional. If the status of a package is necessary you need it to run TeX.
  111. If it is recommended you do not really need it, but you should install
  112. it. If it is optional, you should just install the package if you really
  113. want to use it.
  114.  
  115. Press [Enter] to go through the package list.
  116. EOF
  117. read ANS;
  118. rm -f $curr_dir/*.ins >/dev/null
  119. for p in $(cat $curr_dir/pkgs)
  120. do
  121. ask_install $p
  122. done
  123.  
  124. simple_install() {
  125. pkn=$(echo $1 | sed -e s/.tgz//)
  126. if test -r $2/$pkn".tgz"; then
  127.    echo Installing $pkn...
  128.    gzip -d - <$2"/"$pkn".tgz" >$3"/"$pkn".tar"
  129.    cd $root
  130.    tar xf $3"/"$pkn".tar"
  131.    tar tf $3"/"$pkn".tar" >$curr_dir"/"$pkn".files"
  132.    rm -f $3"/"$pkn".tar"
  133. else
  134.    echo Error: I cannot read $2/$pkn.tgz.
  135. fi
  136. }
  137.  
  138. if test -z "$(ls $curr_dir/*.ins 2>/dev/null)"; then
  139.    cat << EOF
  140.  
  141. You did not choose a package to install. Bye!
  142.  
  143. EOF
  144.    exit 0
  145. fi
  146.  
  147. if test "$SOURCE" = "floppy"; then
  148.    cat << EOF
  149.  
  150.  
  151. Installing the choosen packages from disk.
  152.  
  153. EOF
  154. mkdir $SOURCEDIR
  155. for i in $(cat $curr_dir/disknam)
  156. do
  157.    echo -n "Insert disk $i and press [Enter]."
  158.    read X
  159.    WDANS=r
  160.    while test "$WDANS" = "r"
  161.    do
  162.    # the following mounting procedure is based on code from Andy Schwierskott
  163.       ANS=r
  164.       error=1
  165.       while test "$ANS" = "r" -a "$error" = 1
  166.       do
  167.          mount -r -t "$(cat $curr_dir/diskfs)" $DRIVE $SOURCEDIR
  168.          error=$?
  169.          if test "$error" = 1; then
  170.             ANS=x
  171.             while test "$ANS" != "r" -a "$ANS" != "q" ; do
  172.                echo -n "Disk $i could not be mounted - [r]etry or [q]uit? "
  173.                read ANS
  174.             done
  175.             if test "$ANS" = "q"; then
  176.                rm -fr $SOURCEDIR
  177.                rm -f $curr_dir/*.ins
  178.                echo "Bye!"
  179.            exit 1
  180.             fi
  181.          fi
  182.       done
  183.       if test -e $SOURCEDIR/$i; then
  184.          WDANS=n
  185.          cd $SOURCEDIR
  186.          for f in $(ls *.tgz)
  187.          do
  188.             pkgnam=$(echo $f | sed -e s/.tgz//)
  189.             if test -e $curr_dir"/"$pkgnam".ins"; then
  190.                if test "$INSTALL" = "simple_install"; then      
  191.               $INSTALL $pkgnam".tgz" $SOURCEDIR $TEMP
  192.                else
  193.           $INSTALL $pkgnam".tgz"
  194.                fi
  195.             fi
  196.          done
  197.          cd $curr_dir
  198.          umount $SOURCEDIR
  199.       else
  200.          WDANS=x
  201.          while test "$WDANS" != "r" -a "$WDANS" != "q" ; do
  202.             echo -n "You did not insert the $i disk - [r]etry or [q]uit? "
  203.             read WDANS
  204.          done
  205.          umount $SOURCEDIR
  206.          if test "$WDANS" = "q"; then
  207.             rm -fr $SOURCEDIR  
  208.             rm -f $curr_dir/*.ins
  209.             echo "Bye!"
  210.             exit 1
  211.          fi
  212.       fi
  213.    done
  214. done
  215. rm -fr $SOURCEDIR
  216. else
  217.    cd $SOURCEDIR
  218.    for i in *.ins
  219.    do
  220.       p=$(echo $i | sed -e s/.ins//)
  221.       if test "$INSTALL" = "simple_install"; then      
  222.          $INSTALL $p".tgz" $SOURCEDIR $TEMP
  223.       else
  224.     $INSTALL $p".tgz"
  225.       fi
  226.    done
  227. fi
  228.  
  229. cat << EOF
  230.  
  231. Installation finished.
  232.  
  233. Now you have the pssibility to configure the packages you have installed.
  234. Note that you can call the configuration scripts later from the directory
  235. /usr/lib/texmf/tools. They have the same name as the package with a .cfg 
  236. suffix.
  237.  
  238. EOF
  239.  
  240. if test -n "$(ls $curr_dir/ntm-ltx?.ins 2>/dev/null)"; then
  241.    if test -r /usr/lib/texmf/tools/ntm-ltx.cfg; then
  242.       /usr/lib/texmf/tools/ntm-ltx.cfg
  243.    else
  244. cat << EOF
  245.  
  246. Warning: I cannot start the configuration file for ntm-ltx!
  247.  
  248. EOF
  249.    fi
  250. fi
  251.  
  252. if test -e $curr_dir"/ntb-mf.ins"; then
  253.    if test -r /usr/lib/texmf/tools/ntb-mf.cfg; then
  254.       /usr/lib/texmf/tools/ntb-mf.cfg
  255.    else
  256. cat << EOF
  257.  
  258. Warning: I cannot start the configuration file for ntb-mf!
  259.  
  260. EOF
  261.    fi
  262. fi
  263.  
  264. if test -e $curr_dir"/ntb-dps.ins"; then
  265.    if test -r /usr/lib/texmf/tools/ntb-dps.cfg; then
  266.       /usr/lib/texmf/tools/ntb-dps.cfg
  267.    else
  268. cat << EOF
  269.  
  270. Warning: I cannot start the configuration file for ntb-dps!
  271.  
  272. EOF
  273.    fi
  274. fi
  275.  
  276. if test -e $curr_dir"/ntb-xdvi.ins"; then
  277.    if test -r /usr/lib/texmf/tools/ntb-xdvi.cfg; then
  278.       /usr/lib/texmf/tools/ntb-xdvi.cfg
  279.    else
  280. cat << EOF
  281.  
  282. Warning: I cannot start the configuration file for ntb-xdvi!
  283.  
  284. EOF
  285.    fi
  286. fi
  287.  
  288. echo -n Creating the ls-R database for kpathsea...
  289. (cd /usr/lib/texmf; ls -R $(pwd) >ls-R)
  290.  
  291. rm -f $curr_dir/*.ins &>/dev/null
  292. cd $curr_dir
  293.  
  294. cat << EOF 
  295.  
  296. The NTeX installation is complete. 
  297.  
  298. Comments, suggestions and bug reports to Frank Langbein - 
  299. e94fla@student.tdb.uu.se or langbein@fermat.mathematik.uni-stuttgart.de.
  300.  
  301. EOF
  302.  
  303.