home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- ##
- # $Revision: 2.3 $
- # $Date: 1996/05/03 02:20:22 $
- #
- # creates the directories related to Count 2.1 and install the binary
- # Count.cgi to the cgi-bin directory, copy the digit directories to
- # the digit directory
- # this program uses the variable template created by the Count_config
- # program
- #
- # muquit@semcor.com
- # Nov 24, 1995
- ##
- ver=`cat ./VERSION`
- Basedir="wwwcount$ver"
- INSTALL_PROG="./install-sh"
- Tmpl="./Config.tmpl"
- Binary="./Count.cgi"
- DigitA="./wcount/digits/A"
- DigitB="./wcount/digits/B"
- DigitC="./wcount/digits/C"
- DigitD="./wcount/digits/D"
- DigitE="./wcount/digits/E"
- Rgbfile="./wcount/rgb.txt"
- SAMPLE_DAT="./wcount/data/sample.dat"
- UserId="nobody"
- userid_flag=0
- GroupId="nobody"
- groupid_flag=0
- Digits="zero.gif one.gif two.gif three.gif four.gif five.gif\
- six.gif seven.gif eight.gif nine.gif"
-
-
- Pwd=`pwd`
- checkbd=`basename $Pwd`
-
- ###
- # check if we'r inside wwwcount2.2 directory
- if [ $checkbd != $Basedir ]
- then
- cat << EOR2
-
- ************************************************************************
- You must be at the base directory of the counter source distribution
- in order to install Count.cgi
- Wrong directory: $checkbd
- ************************************************************************
-
- EOR2
- exit 2
- fi
-
- if [ ! -f $Tmpl ]
- then
- cat<<EOT
-
- The varaible template file "$Tmpl" does not exist! This file
- is created in the configuration procedure. Apparently your
- configuration procedure did not succeed!
-
- Aborting installation!
-
- EOT
- exit 1
- fi
-
- if [ ! -f $Binary ]
- then
- cat<<EOB
-
- Counter binary "$Binary" does not exist!
- Apparently your compilation did not succeed or you did not compile
- the program!
-
- Aborting installation!
- EOB
- exit 1
- fi
-
- if [ ! -d $DigitA -o ! -d $DigitB -o ! -d $DigitC -o ! -d $DigitD ]
- then
- cat<<EOD
-
- Suppiled digit directories not found in ./digits direcory!
-
- Aborting installation!
-
- EOD
- exit 1
- fi
-
- if [ ! -f $Rgbfile ]
- then
- cat<<EOB
-
- Rgb file "$Rgbfile" does not exist!
- Apparently your removed it mistakenly!
-
- Aborting installation!
- EOB
- exit 1
- fi
-
- ##
- # get the vars
- ##
-
- . $Tmpl
-
- if [ ! -f ./$CONFIG_FILE ]
- then
-
- cat <<EOC
-
- The configuration file $CONFIG_FILR is not created!
- please create it first by running the script ./Gen-conf
-
- Aborting installation!
- EOC
-
- exit 1
- fi
-
- # check if root
- uidfile="/tmp/Count$$"
- touch $uidfile
- user=`ls -al $uidfile | awk '{print $3}'`
-
- if [ "$user" != "root" ]
- then
- cat << EOR
-
- WARNING: You are not root! To install the package in the system,
- you will need root access!
-
- EOR
- else
- cat <<EOJ
-
- *** You are installing Counter as root ***
-
- EOJ
- rm -f $uidfile
-
- fi
- # if [ "`whoami`x" != "root"x ]; then
- #cat << EOR
-
- # WARNING: You are not root! To install the package in the system,
- # you will need root access!
-
- #EOR
- # else
- #cat <<EOJ
-
- # *** You are installing Counter as root ***
-
- #EOJ
- # fi
-
- (echo "hi there\c" ; echo " ") >./.echotest
- if grep c ./.echotest >/dev/null 2>&1 ; then
- n='-n'
- c=''
- else
- n=''
- c='\c'
- fi
- rm -f ./.echotest >/dev/null 2>&1
-
-
- # debug
- cat<<DUM
-
- ===================
- Your configuration:
-
- cgi-bin directory= $CGIBIN_DIR
- conf directory= $CONFIG_DIR
- conf file= $CONFIG_FILE
- digit directory=$DIGIT_DIR
- data directory=$DATA_DIR
- log directory=$LOG_DIR
- log file=$LOG_FILE
- rgb file= $RGB_FILE
- ===================
-
- DUM
-
- echo $n "Continue [y|n]$c? "
- read answer
-
- if [ .$answer = . ]
- then
- answer=x
- fi
- until [ $answer = "y" -o $answer = "Y" -o $answer = "n" -o $answer = "N" ]
- do
- echo $n "Continue [y|n]$c? "
- read answer
- if [ .$answer = . ]
- then
- answer=x
- fi
- done
-
- case $answer in
- y|Y)
- echo "proceeding..."
- ;;
- n|N)
- echo "Exiting..Better luck next time!"
- exit 1
- ;;
-
- *)
- echo ""
- echo "Illegal choice"
- esac
-
-
- cat <<EOU
-
- Now if you know what user and group id child processes of http
- server use, I can change the ownership and access permission
- accordigly. If you do not know, they are usually defined in the
- file httpd.conf with User and Group. I suggest create a unique
- user and group say httpd and set the User and Group to httpd.
-
- EOU
- echo $n "*Do you know the user and group id of httpd' child process[y|n]:$c? "
- read answer
- if [ .$answer = . ]
- then
- answer=x
- fi
- until [ $answer = "y" -o $answer = "Y" -o $answer = "n" -o $answer = "N" ]
- do
- echo $n "*Do you know the user and group id of httpd' child process[y|n]:$c? "
- read answer
- if [ .$answer = . ]
- then
- answer=x
- fi
- done
-
- case $answer in
- y|Y)
- userid_flag=1
- groupid_flag=1
- ###
- # enter user id -starts
- ###
- echo $n "*Enter user id of httpd's child process [no default]:$c? "
- read answer
- if [ .$answer = . ]
- then
- answer=x
- fi
- until [ $answer != "x" ]
- do
- echo $n "*Enter user id of httpd's child process [no default]:$c? "
- read answer
- if [ .$answer = . ]
- then
- answer=x
- fi
- done
-
- UserId=$answer
- ###
- # enter user id -ends
- ###
-
- ##
- # enter groud id -starts
- ##
- echo $n "*Enter group id of httpd's child process [no default]:$c? "
- read answer
- if [ .$answer = . ]
- then
- answer=x
- fi
- until [ $answer != "x" ]
- do
- echo $n "*Enter group id of httpd's child process [no default]:$c? "
- read answer
- if [ .$answer = . ]
- then
- answer=x
- fi
- done
-
- GroupId=$answer
-
- ##
- # enter groud id -ends
- ##
- echo "installing Count.cgi->$CGIBIN_DIR"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 755 ./Count.cgi $CGIBIN_DIR/Count.cgi
- echo "installing $CONFIG_FILE->$CONFIG_DIR"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 664 $CONFIG_FILE $CONFIG_DIR/$CONFIG_FILE
- echo "installing sample datafile $SAMPLE_DAT->$DATA_DIR"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 664 $SAMPLE_DAT $DATA_DIR/sample.dat
- chmod 775 $DATA_DIR
-
- echo "installing rgb.txt->$BASE_DIR"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Rgbfile $BASE_DIR/rgb.txt
-
- echo "creating Log directory $LOG_DIR"
- ./mkdirhier $LOG_DIR
- chown $UserId $LOG_DIR
- chgrp $GroupId $LOG_DIR
- chmod 775 $LOG_DIR
-
- echo "installing image strip for digit style A->$DIGIT_DIR/A"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitA/strip.gif\
- $DIGIT_DIR/A/strip.gif
-
- echo "installing image strip for digit style B->$DIGIT_DIR/B"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitB/strip.gif\
- $DIGIT_DIR/B/strip.gif
-
- echo "installing strip image for digit style C->$DIGIT_DIR/C"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitC/strip.gif\
- $DIGIT_DIR/C/strip.gif
-
- echo "installing strip image for digit style D->$DIGIT_DIR/D"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitD/strip.gif\
- $DIGIT_DIR/D/strip.gif
-
- echo "installing sample image lenna.gif->$DIGIT_DIR/D"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitD/lenna.gif\
- $DIGIT_DIR/D/lenna.gif
-
- echo "installing strip image for digit style E->$DIGIT_DIR/E"
- $INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitE/strip.gif\
- $DIGIT_DIR/E/strip.gif
- ##
- # change ownership
- # -R is not portable, reported by Geoff Scully <gws@dis.on.ca> and suggested
- # the alternative (01/15/96)
- #chown -R $UserId.$GroupId $BASE_DIR
- find $BASE_DIR -exec chown $UserId {} \;
- find $BASE_DIR -exec chgrp $GroupId {} \;
- # echo "UserId=$UserId"
- # echo "GroupId=$GroupId"
- ;;
- n|N)
- cat <<EOM
-
- I am not changing any ownership or access permissions.
- You are on your own. If the counter program can not access digit
- images or can not write to datafile, you have to set permisson
- manually.
- good luck!
-
- EOM
- echo "installing Count.cgi->$CGIBIN_DIR"
- $INSTALL_PROG -c -m 755 ./Count.cgi $CGIBIN_DIR/Count.cgi
- echo "installing $CONFIG_FILE->$CONFIG_DIR"
- $INSTALL_PROG -c $CONFIG_FILE $CONFIG_DIR/$CONFIG_FILE
- echo "installing sample datafile $SAMPLE_DAT->$DATA_DIR"
- $INSTALL_PROG -c $SAMPLE_DAT $DATA_DIR/sample.dat
-
- echo "installing rgb.txt->$BASE_DIR"
- $INSTALL_PROG -c $Rgbfile $BASE_DIR/rgb.txt
-
- echo "creating Log directory $LOG_DIR"
- ./mkdirhier $LOG_DIR
-
- echo "installing image strip for digit style A->$DIGIT_DIR/A"
- $INSTALL_PROG -c $DigitA/strip.gif $DIGIT_DIR/A/strip.gif
-
- echo "installing image strip for digit style B->$DIGIT_DIR/B"
- $INSTALL_PROG -c $DigitB/strip.gif $DIGIT_DIR/B/strip.gif
-
- echo "installing image strip for digit style C->$DIGIT_DIR/C"
- $INSTALL_PROG -c $DigitC/strip.gif $DIGIT_DIR/C/strip.gif
-
- echo "installing image strip for digit style D->$DIGIT_DIR/D"
- $INSTALL_PROG -c $DigitD/strip.gif $DIGIT_DIR/D/strip.gif
-
- echo "installing sample image lenna.gif->$DIGIT_DIR/D"
- $INSTALL_PROG -c $DigitD/lenna.gif $DIGIT_DIR/D/lenna.gif
-
- echo "installing image strip for digit style E->$DIGIT_DIR/E"
- $INSTALL_PROG -c $DigitE/strip.gif $DIGIT_DIR/E/strip.gif
- ;;
- *)
- esac
-
-