"Fossies" - the Fresh Open Source Software Archive

Member "whois-5.5.2/install.sh" (8 Aug 2012, 2896 Bytes) of package /linux/privat/old/whois-5.5.2.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 #
    3 # This is a very simple installation script. It may not work on 
    4 # all systems. Please use it with care and caution. More detailed 
    5 # instructions are available in the INSTALL file. 
    6 #
    7 # --Bill
    8 #
    9 
   10 HELLO="BW Whois Installation Script version 3.1 (27-July-2002)"
   11 echo $HELLO
   12 
   13 # check to see that I'm running as root
   14 WHOAMI=`whoami`
   15 if [ $WHOAMI != "root" ] ; then 
   16   echo "You must run this program as root. You are logged in as $WHOAMI."
   17   exit
   18 fi
   19 
   20 # check to see that /etc exists. If not, this is not unix and I don't 
   21 # know what to do about it. 
   22 if [ ! -d /etc ] ; then 
   23    echo "You don't have an [/etc] directory. You will have to install"
   24    echo "manually. Please see the INSTALL file."
   25    exit
   26 fi
   27 
   28 # make sure the configuration directory exists
   29 CONFPATH=/etc/whois
   30 if [ ! -d $CONFPATH ] ; then
   31   echo "Creating directory [$CONFPATH] . . . "
   32   mkdir $CONFPATH
   33 fi
   34 
   35 # used below for copying files
   36 function copyfile
   37 {
   38 echo "Installing [$DEST]."
   39 
   40 # check for existing destination file
   41 if [ -f $DEST ] ; then
   42   echo
   43   echo    "The file [$DEST] already exists. "
   44   echo -n "Shall I erase it? (Y/N) "
   45   read YN
   46   if [ $YN == "Y" -o $YN == "y" ] ; then 
   47     rm $DEST
   48     echo "[$DEST] erased."
   49   fi
   50 fi
   51 
   52 if [ ! -f $DEST ] ; then 
   53 
   54   # do the copy
   55   echo "Copying [$SOURCE] to [$DEST]."
   56   cp $SOURCE $DEST  
   57 
   58   # set the mode
   59   if [ ! -z $MODE ] ; then 
   60     chmod $MODE $DEST 
   61   fi
   62 
   63   # is there a conflict?
   64   if [ ! -z $CHECK -a -f $CHECK ] ; then 
   65     echo
   66     echo    "The file [$CHECK] may conflict with the file [$DEST]. "
   67     echo -n "Shall I erase [$CHECK]? (Y/N) "
   68     read YN
   69     if [ $YN == "Y" -o $YN == "y" ] ; then 
   70       rm $CHECK
   71       echo "[$CHECK] erased."
   72     fi
   73   fi
   74 
   75 fi
   76 
   77 }
   78 
   79 SOURCE=whois
   80 DEST=/usr/local/bin/whois
   81 CHECK=/usr/bin/whois
   82 MODE=0755
   83 copyfile
   84 
   85 SOURCE=whois.1
   86 DEST=/usr/local/man/man1/whois.1
   87 CHECK=/usr/man/man1/whois.1
   88 MODE=0644
   89 copyfile
   90 
   91 SOURCE=whois.conf
   92 DEST=${CONFPATH}/whois.conf
   93 CHECK=""
   94 MODE=0644
   95 copyfile
   96 
   97 SOURCE=tld.conf
   98 DEST=${CONFPATH}/tld.conf
   99 CHECK=""
  100 MODE=0644
  101 copyfile
  102 
  103 SOURCE=sd.conf
  104 DEST=${CONFPATH}/sd.conf
  105 CHECK=""
  106 MODE=0644
  107 copyfile
  108 
  109 SITE_PERL_LIST="
  110   /usr/local/lib/site_perl
  111   /usr/local/lib/perl5/site_perl
  112   /usr/lib/site_perl
  113   /usr/lib/perl5/site_perl
  114 "
  115 
  116 for SITE_PERL in $SITE_PERL_LIST
  117   do if [ -d $SITE_PERL ] ; then 
  118     PM_DEST=${SITE_PERL}/bwInclude.pm
  119     SOURCE=bwInclude.pm
  120     DEST=$PM_DEST
  121     CHECK=""
  122     MODE=0644
  123     copyfile
  124     break
  125   fi
  126 done
  127 
  128 echo
  129 echo "The following are the files that were to have been "
  130 echo "installed. Please check this listing to make sure "
  131 echo "The date stamps and file modes are correct. "
  132 echo "===================================================="
  133 
  134 ls -l  \
  135   /usr/local/bin/whois \
  136   /usr/local/man/man1/whois.1 \
  137   ${CONFPATH}/whois.conf \
  138   ${CONFPATH}/tld.conf \
  139   ${CONFPATH}/sd.conf \
  140   $PM_DEST
  141 
  142 echo "===================================================="
  143 
  144 echo "Done."
  145