2 # Copyright 2000, International Business Machines Corporation and others.
5 # This software has been released under the terms of the IBM Public
6 # License. For details, see the LICENSE file in the top-level source
7 # directory or online at http://www.openafs.org/dl/license10.html
9 ##Installation and setup script for AFS Web Secure for the APACHE server
11 PRODUCT_NAME
="AFS Web Security Pack"
14 Use this script for configuring and setting up $PRODUCT_NAME for use
15 with the Apache Web server. Before executing this script, be sure to
16 read the Transarc $PRODUCT_NAME documentation provided in the
17 AFSWebSecure_docs.tar file (the html documentation for $PRODUCT_NAME)
19 Users should have some familiarity with Apache configuration,
20 especially for troubleshooting purposes. Users must also have
21 appropriate permissions in the relevant directories.
23 NOTE: This script does not configure other features of the Apache
24 server or SSL implementation for Apache. See related documentation for
25 setting up Apache with SSL.
27 This script prompts you to perform three operations:
29 1) Set up the configuration file for compiling $PRODUCT_NAME into
30 the Apache source code and linking it with the appropriate
31 libraries. Configure and build the Apache server binary.
33 2) Set up the Apache run-time directives configuration file with
34 the directives required for $PRODUCT_NAME (configurable parameters)
35 See the Transarc $PRODUCT_NAME documentation for explanations of these
36 parameters and be sure you understand what each of them do.
38 3) Set up the startup and shutdown scripts for the Web server and
39 starts up the server if you want it to.
41 Default parameters are provided wherever appropriate. Please make sure
42 you read the prompts and give the FULL PATH name (PATHNAME) where required.
43 If you are familiar with Apache configuration and prefer to add the
44 required parameters to the configuration files with a text editor,
45 you can do so as with any other Apache module.
54 PRODUCT
="AFS_Web_Security_Pack"
55 COMPANY
="IBM Transarc"
70 AIX
) platform
=${os}_${osver}.${osrev} ;;
71 SunOS
) platform
=${os}_
${osver} ;;
72 *) echo "$prog:Unsupported Platform $os"; exit 0 ;;
80 ServerRoot_default
=`pwd`
81 Apache_src_default
=`pwd`/src
83 ConfigScript_default
=Configure
84 Weblog_Starter_default
=${ServerRoot_default}/weblog_starter
85 make_conf_default
=Configuration
86 run_conf_default
=httpd.conf
88 startscr_default
=start.httpd
89 stopscr_default
=stop.httpd
90 DocRoot_default
=htdocs
94 echo "$fs:No such file or directory"
95 echo $ac_n "Enter full path and filename for the fs binary on"\
96 " this AFS client machine: [$fs] $ac_c"
101 default_cell_name
=`$fs wscell | awk -F"'" '{ print $2 }'`
102 case $default_cell_name in
103 '') default_cell_name
="CellName" ;;
107 ## Display a nice fancy header prompt
112 title
="$PRODUCT_NAME SETUP AND INSTALLATION"
116 echo |
awk 'BEGIN { len="'$colen'" ; pos=(80-len)/2 }
117 { for (i=0; i<pos; i++) { printf " " }
119 echo $ac_n "$COMPANY $ac_c"
121 echo |
awk 'BEGIN { len="'$titlen'" ; pos=(80-len)/2 }
122 { for (i=0; i<pos; i++) { printf " " }
124 echo $ac_n "$title $ac_c"
126 echo |
awk '{ for (i=0; i < 80; i++) { printf "-" } }'
132 ## Attempt to change the defaults in this file
140 *) echo "$rn: incorrect arguments:$#" ;
144 tempfile
=/tmp
/$file.$$
147 echo "$file not found for automatic update"
150 $cp -p $file $tempfile
153 awk -F= 'BEGIN { d="'$def'"
159 printf "%s=%s\n", d, v
170 ## Exit with the error message provided as the argument with exit status 1
179 ## Insert text into a file in various ways - wrapper around an awk script
189 *) die
"incorrect number of arguments to $rn - $args expected. \
194 tempfile
=/tmp
/${file##*/}.$$
200 "-f") #echo "$rn:$line in $file IN $field"
202 "-p") #echo "$rn:$line in $file AFTER $field"
204 "-n") #echo "$rn:$line in $file AT:$field"
206 "-pn") #echo "$rn:$line in $file AFTER LINE $field"
208 *) die
"$rn:unrecognized option $type";;
211 $cp -p $file $tempfile
213 test $retval -eq 0 || die
"$rn:copy failed"
221 version = "'$apache_version'"
223 { if ( type == "-f" ) {
225 if ( field == str[1] ) {
226 printf "%s %s\n", $0, line
233 else if ( type == "-n" ) {
235 printf "%s\n%s\n", line, $0
242 else if ( type == "-p" ) {
244 if ( field == str[1] ) {
245 printf "%s\n%s=\n", $0, line
252 else if ( type == "-pn") {
254 if ( version == "1.3") {
255 printf "%s\nAddModule %s\n", $0,line
258 printf "%s\nModule afs_module\t %s\n", $0,line
269 if ( type == "-f" ) {
270 printf "%s=%s\n",field,line
286 $mv -f /tmp
/$file.$$
$file
294 ## Used for Configuring run-time AFS directives
300 0) die
"$rn:Insufficient Arguments provided"
305 while test "$1" != ""
309 echo $ac_n "$directive [$value]:$ac_c"
311 test $in && value
=$in
312 echo "$directive $value" >> $file
317 ## Given the Directive name ($2) it returns the value from the given
318 ## file name ($1) - only for Directives beginning with SetAFS
326 *) die
"$rn:Incorrect args:$#" ;;
330 if ( $1 == "'$2'" ) {
337 ## Given the Directive name ($2) it returns the value from the given
338 ## file name ($1) - FOR ALL DIRECTIVES
346 *) die
"$rn:Incorrect args:$#" ;;
350 if ( $1 == "'$2'" ) {
357 ## Replace or insert single Directive value pair
364 $args) file=$1; directive
=$2; value
=$3 ;;
365 *) die
"$rb:Incorrect args: $args - $#"
367 ttempfile
=/tmp
/${prog}_${rn}.${file##*/}.$$
368 ed
=`grep $directive $file | grep -v '^#'`
369 ediff
=`echo $ed | awk '{ print $2 }'`
370 echo $ac_n "$directive ($ediff) [$value]:$ac_c"
377 '') echo "$directive $value" >> $file
379 *) if [ ! $ediff = $value ]
381 awk '{ if ($1 == "'$directive'") {
382 printf "%s %s\n", $1, "'$value'"
385 }' $file > $ttempfile
386 $mv -f $ttempfile $file
390 *) die
"$rn: mv failed: $retval"
398 ## Replace directives if they exist with new values or create the Directive
399 ## value pair if none exists in the run-time configuration file
405 0) die
"$rn: incorrect arguments: $#" ;;
409 ttempfile
=/tmp
/${prog}_${rn}.${file##*/}.$$
412 echo "Use the following syntax"
413 echo "<Enter> or <space> to accept [default] value"
414 echo "<-> to keep (Existing) value"
415 echo "<#> to comment out directive"
417 while test "$1" != ""
421 edir
=`grep $directive $file | grep -v '^#'`
422 ediff
=`echo $edir | awk '{ print $2 }'`
424 '') t
=`grep $directive $file|grep '^#'` ;
426 '') existprompt
="NO EXISTING DIRECTIVE" ;;
427 *) existprompt
="DIRECTIVE COMMENTED OUT" ;;
430 *) existprompt
=$ediff
433 echo $ac_n "$directive ($existprompt) [$value]:$ac_c"
436 '') echo "Default $value unchanged"
438 '#') echo "This directive $directive will be commented out"
441 '-') echo "Existing $ediff unchanged" ;
453 '') #search for commented out directive first
454 if [ ! $value = '#' ]
456 edir
=`grep $directive $file|grep $value|grep '^#'`
458 '') echo "$directive $value" >> $file
460 *) edir
=`echo $edir|sed 's/.*#//g'|sed 's/^ //g'`
461 edir2
=`echo $edir|awk '{ print $2 }'`
462 if [ $edir2 = $value ]
465 echo "$directive $value" >> $file
466 #echo "Uncommented: $edir"
472 '#') echo "Commenting out $directive" ;
473 awk '{ if ($1 == "'$directive'") {
477 }' $file > $ttempfile ;
478 $mv -f $ttempfile $file ;
482 *) die
"$rn: mv failed: $retval" ;;
486 *) if [ ! $ediff = $value ]
488 echo "Changing: $directive $ediff $value"
489 awk '{ if ($1 == "'$directive'") {
490 printf "%s %s\n", $1, "'$value'"
493 }' $file > $ttempfile
495 $mv -f $ttempfile $file
499 *) die
"$rn: mv failed: $retval" ;;
513 *) die
"$rn: Incorrect args:$#"
517 AIX
) insertfield
$1 /bin
/cc
-f CC
;;
523 ## Add a module to the Configuration file - prompt to go to main menu and
524 ## reconfigure and re-compile. If module commented out - uncomment it
531 $args) f
=$1; mn
=$2 mf
=$3 ;;
532 *) die
"$rn: Incorrect args:$#"
537 if [ ! -f $Apache_src/$cmf ]
539 echo "Module file $Apache_src/$cmf does not exist"
540 echo "Ensure you have this C source file in the " \
541 "apache src ($Apache_src)directory"
545 tf
=/tmp
/${prog}_
${rn}
548 '') echo "Module $mn not found";
549 echo "Choose a module after which module you wish to insert " \
550 "this module. Note that modules are prioritised bottom-up";
551 echo "See Apache documentation for more details";
553 modulelist
=`grep Module $f | grep -v '^#'` ;
554 echo $ac_n "View a list of current modules: [$val] $ac_c";
555 read in; test $in && val
=$in;
557 y|Y
) echo "$modulelist" |
more
561 echo $ac_n "Enter module name to enter this module after: $ac_c"
563 test $aftm ||
{ echo "No module entered ... returning"; return 2; }
564 eg
=`echo "$modulelist" | grep $aftm` ;
566 '') echo "Module $aftm not found in list"
568 echo "... returning";
570 *) echo "$aftm found in $modulelist"
582 printf "%s\nModule %s\t%s\n", $0,mname,mfile
591 *) jk
=`echo $ed | grep '^#'` ;
593 '') echo "Module already exists: $ed. Returning";
597 awk '{ if (( $2 == "'$mn'" )||( $3 == "'$mn'" )) {
598 printf "Module %s\t%s\n", "'$mn'", "'$omf'"
615 echo "Configuring Makefile"
619 make_conf_dir
=${make_conf%/*}
622 echo $ac_n "Configuration file name [$make_conf]:$ac_c"
626 /*) make_conf
=$uconf ;
627 make_conf_dir
=${make_conf%/*}
629 *) make_conf
=${make_conf_dir}/${uconf};
630 make_conf_dir
=${make_conf%/*}
634 test -f $mc ||
echo "$mc: does not exist"
637 # Back up original Configuration file
638 backup
=$make_conf.BEFOREAFS
642 backup
=$make_conf.BEFOREAFS.
$number
643 number
=$
(($number+1))
646 $cp -p $make_conf $backup
648 ( do_reconfig_makefile
$make_conf )
651 0) echo "Configured $make_conf successfully";;
652 *) $mv -f $backup $make_conf ;
653 die
"Configuration for Makefile FAILED: Exiting" ;;
656 ConfigScript
=$ConfigScript_default
658 echo $ac_n "Run Configuration script ($ConfigScript):"\
662 if [ $val = Y
] ||
[ $val = y
]
664 while [[ ! -x ${make_conf_dir}/${ConfigScript} ]]
666 echo "$ConfigScript: not found or not "\
667 "executable in $make_conf_dir"
668 echo $ac_n "Enter Configure script name"\
669 ":[$ConfigScript]$ac_c"
671 test $in && ConfigScript
=$in
674 ( cd $make_conf_dir; $ConfigScript -file $make_conf )
677 0) echo "Configuration succesful";;
678 *) die
"Configuration FAILED - Exiting";;
682 echo $ac_n "Compile: [$val] $ac_c"
685 if [ $val = Y
] ||
[ $val = y
]
687 ( cd $Apache_src ; make )
688 test $?
!= 0 && die
"ERROR: make failed"
693 configure_and_compile
()
695 ConfigScript
=$ConfigScript_default
697 echo $ac_n "Run Configuration script ($ConfigScript):[$val] $ac_c"
700 if [ $val = Y
] ||
[ $val = y
]
702 while [[ ! -x ${make_conf_dir}/${ConfigScript} ]]
704 echo "$ConfigScript: not found or not "\
705 "executable in $make_conf_dir"
706 echo $ac_n "Enter Configure script name"\
707 ":[$ConfigScript]$ac_c"
709 test $in && ConfigScript
=$in
712 ( cd $make_conf_dir; .
/$ConfigScript -file $make_conf )
715 0) echo "Configuration successful";;
716 *) die
"Configuration FAILED - Exiting";;
720 echo $ac_n "Compile: [$val] $ac_c"
723 if [ $val = Y
] ||
[ $val = y
]
725 ( cd $Apache_src ; make )
726 test $?
!= 0 && die
"ERROR: make failed"
732 ## Make a symbolic link from arg1 to arg2
733 ## check if it exists first and present options if it does
739 2) target
=$2; source=$1 ;;
740 *) die
"$rn:Incorrect number of args:$#" ;;
744 ## symlink already exists - leave it or change it?
745 echo "Symbolic Link already exists" ;
751 echo "Creating Symbolic Link $source->$target"
754 echo $ac_n "WARNING: $target is not a directory. Create anyway:[$val]" $ac_c;
756 test $in && val
=$in ;
762 ln -s $target $source ;
773 ## Edit run time configuration file
780 2) conf
=$1; tempfile
=$2;;
781 *) die
"$rn:Incorrect number of args:$#" ;;
784 test -f $conf || die
"No Configuration file called $conf found"
787 ## Check for AFS Directives
790 afsdirective
="AFSAuthType AFS"
791 line
=`grep -i "$afsdirective" $conf | grep -v '^#'`
793 "") #echo "Editing $conf to add AFS Directives"
795 *) echo "AFS Directives already found in file $conf \n\n$line" ;
800 tempfile
=${tempfile:-/tmp/$prog.$$}
801 #echo "Tempfile:$tempfile"
803 echo "##" >> $tempfile
804 echo "##AFS Authentication Directives for $PRODUCT_NAME $product_version" >> $tempfile
805 echo "##Inserted by installation script $prog\n##" >> $tempfile
808 afsdirectives
="${ap}DefaultCell $default_cell_name ${ap}CacheExpiration 120 ${ap}TokenExpiration 600 ${ap}WeblogPath $Weblog_Starter_default" ;
809 AFSModuleFile
=afs_module.c
811 echo "<ifmodule $AFSModuleFile>" >> $tempfile
812 read_directives
$tempfile $afsdirectives
815 ## Check to ensure WebLogPath exists and is executable
817 loc
=`get_directive $tempfile ${ap}WeblogPath`
818 while [[ ! -x $loc ]]
820 echo "${ap}WeblogPath: $loc Does not exist or not executable"
821 echo "Make sure you copy both binaries weblog and "\
822 "weblog_starter into the same dir that you specify the"\
823 " FULL path to here - see installation instructions"
824 echo $ac_n "Enter full path to weblog_starter: [$loc] $ac_c"
827 new_directive
="${ap}WeblogPath $loc"
828 # echo $tempfile; cat $tempfile
829 put_directives
$tempfile $new_directive
830 # echo $tempfile; cat $tempfile
835 ## Get the SetAFSLocation directive's value and put AFSAuthType AFS
837 AFSAuthDirective
="AFSAuthType AFS"
839 echo $ac_n "Enter a Location for which AFS Authentication is desired: [$loc] $ac_c"
843 ## Make a symlink from documentRoot to afs mount points
846 echo $ac_n "Make a symbolic link from the DocumentRoot " \
847 "directory to the directory where the AFS cell mount points" \
848 " for this AFS client machine are stored: [$val] $ac_c"
852 y|Y
) echo "Making symbolic link"
853 directive
=`grep -i "DocumentRoot" $conf | grep -v '^#'`;
854 if [ ! "$directive" ] ||
[ "$directive" = "" ] ||
[ -z "$directive" ]
856 echo "No directive for DocumentRoot exists in $conf"
857 echo $ac_n "Document Root Directory (full path):[$DocRoot] $ac_c"
859 test $in && DocRoot
=$in
860 echo "DocumentRoot $DocRoot" >> $tempfile
862 DocRoot
=`echo $directive | awk '{ print $2 }'`
864 test -d "$DocRoot" || die
"$DocRoot not a Directory";
868 echo $ac_n "Enter directory where AFS mount points are: [$afsdir] $ac_c";
870 test $in && afsdir
=$in ;
871 test -d $afsdir || die
"ERROR:$afsdir is not a directory";
872 make_symlink
$mtp $afsdir
875 1) echo "Symlink Exists or cancelled" ;;
876 *) die
"ERROR making symlink from $mtp to $afsdir."\
884 echo "<Location $loc>" >> $tempfile
885 echo $AFSAuthDirective >> $tempfile
886 authname_default
='"AFS Login (user@<%ccellname>)"'
887 echo "Set the AuthName directive to customize the Login prompt" \
888 "that users will see"
889 echo "You may use text intersperced with the following " \
890 "expressions (these should be enclosed in angle brackets):"
891 echo "%c to specify the AFS cell name where the requested file resides"
892 echo "%u to specify the first two components of the URL"
893 echo "%d to specify the default cell"
894 echo "Consult documentation for more details"
895 echo $ac_n "AFSLoginPrompt [$authname_default]" $ac_c
899 *) authname_default
="$n" ;;
901 echo AFSLoginPrompt
$authname_default >> $tempfile
902 echo "</Location>" >> $tempfile
905 echo $ac_n "Log access denied requests: [$val] $ac_c"
906 read in ; test $in && val
=$in
908 y|Y
) accesslogfile
=$ServerRoot/logs
/forbiddenlog
;
909 echo $ac_n "Log file: [$accesslogfile]" $ac_c;
910 read in ; test $in && accesslogfile
=$in;
911 echo "SetAFSAccessLog $accesslogfile">>$tempfile
916 if [ $apache_version != 1.3 ]
918 ud
=`grep -i UserDir $conf`
921 echo $ac_n "Add support for User Directories: [$val] $ac_c";
922 read in ; test $in && val
=$in
925 echo $ac_n "UserDir: [$userdir]" $ac_c;
926 read in ; test $in && userdir
=$in;
927 echo "UserDir $userdir">>$tempfile;
928 echo "Need to ensure userdir_module is included"
929 echo "in the Makefile configuration .... "
931 make_conf_dir
=${make_conf%/*} ;
934 echo $ac_n "Makefile Configuration file name [$make_conf]:$ac_c"
938 /*) make_conf
=$uconf ;
939 make_conf_dir
=${make_conf%/*};
941 *) make_conf
=${make_conf_dir}/${uconf};
942 make_conf_dir
=${make_conf%/*};
946 test -f $mc ||
echo "$mc: does not exist"
948 add_module
$make_conf userdir_module mod_userdir
;
950 1) echo "Need to reconfigure and recompile";
951 configure_and_compile
953 2) echo "Failed to add module userdir_module"
962 fi # /* if Apache 1.3 */
964 echo "</ifmodule>" >> $tempfile
965 echo "##\n##End AFS Authentication Directives for $PRODUCT_NAME \n##" >> $tempfile
968 ## Append tempfile to run time config file and remove tempfile
970 cat $tempfile >> $conf
976 ## Configures the Configuration file for the Apache Makefile
980 rn
=do_config_makefile
983 *) die
"Incorrect number of args given to $rn: $#";;
989 ## see if there is a line for EXTRA_LIBS and add
990 ## EXTRA_LIBS=libsys.a and libapacheafs.a
991 ## or append to whatever was there before
994 elib
=`grep $currfield $conf | grep -v '^#'`
996 '') prevfield
="EXTRA_CFLAGS";
997 echo "WARNING: No $currfield line was found in $conf" ;
998 echo "Attempting to insert $currfield after $prevfield" ;
999 echo "Ensure you have a $currfield entry in $conf" ;
1001 echo $ac_n "Go ahead with this: [$r] $ac_c" ;
1004 if [ $r != "Y" ] ||
[ $r != "y" ]
1006 die
"Edit $conf and add $currfield ="
1008 insertfield
$conf $currfield -p $prevfield
1016 if (str[1] == "'$currfield'")
1024 for lib
in $aplib $syslib
1026 elibval
=`echo $elib | grep "$lib"`
1027 if [ ! "$elibval" ]||
[ "$elibval" = "" ]||
[ -z "$elibval" ]
1029 #echo "$lib doesn't exist in $currfield $elib"
1031 until [[ -f $libfull ]]
1034 $syslib) libpath
="/usr/afsws/lib/afs/"
1036 $aplib) libpath
=$ServerRoot ;;
1039 echo $ac_n "Enter only the path" \
1040 " (not the filename) for $lib:[$libpath]$ac_c "
1042 test $in && libpath
=$in
1043 libfull
=$libpath/$lib
1044 if [ ! -f $libfull ]
1046 echo "$libfull DOESN'T EXIST"
1049 insertfield
$conf $libfull -f $currfield
1051 echo "$lib Exists in $elib" >> $Log
1056 ## Check for afs_module
1058 if [ $apache_version = 1.3 ]
1060 AFSModule
=modules
/extra
/afs_module.o
1062 AFSModule
=afs_module.o
1065 AFSModuleName
="afs_module"
1066 tmod
=`grep $AFSModuleName $conf | grep -v '^#' | awk '{ if ($2 == "'$AFSModuleName'" ) printf "%d:%s\n", NR, $0 }'`
1069 echo "AFS module already exists in file $conf" >> $Log
1070 echo "Line: $tmod" >> $Log
1073 ## List the active modules and prompt user where to insert AFS MODULE
1077 echo "YOUR LIST OF CURRENT MODULES IS"
1078 awk '{ if ($1 == "Module" || $1 == "AddModule") print $0 }' $conf |
$more
1079 if [ $apache_version = 1.3 ]
1081 defmod
=modules
/standard
/mod_auth.o
1085 echo $ac_n "After which module would you like to put the AFS Module [$defmod]: $ac_c"
1087 test $after_module || after_module
=$defmod
1088 tmod
=`awk '{ if ($2 == "'$after_module'") print $0 }' $conf`
1090 test ! "$tmod" ||
test "$tmod" = "" ||
test -z "$tmod" && die
"Module $after_module NOT FOUND IN MODULE LIST"
1098 insertfield
$conf "$AFSModule" -pn $after_module
1102 ## Attempt to set the correct compiler according to OSTYPE
1108 ## Edit the start and stop scripts
1116 *) die
"rn: Incorrect number of parameters supplied: $#";;
1120 START
) start
=1; bin
=$3 ;;
1121 STOP
) start
=0; run_conf
=$3; edit
=0 ;;
1122 E_STOP
) start
=0; run_conf
=$3; edit
=1 ;;
1123 *) die
"$rn: Incorrect type of ARG passed: $1" ;;
1126 until [[ -f $run_conf ]]
1129 echo "No run_time configuration file $run_conf found"
1130 echo $ac_n "Run-time conf file:[$run_conf]$ac_c"
1132 test $in && run_conf
=$in
1137 echo "#!/bin/sh" > $file
1139 echo "##Apache $PRODUCT_NAME StartUp" >> $file
1141 echo "$bin -f $run_conf" >> $file
1146 pfl
=`grep -i pidfile $run_conf | grep -v "#"`
1148 test ! "$pfl" ||
test "$pfl" = "" ||
test -z "$pfl" && die
"No PidFile specified in $run_conf. Edit this file and specify the PidFile directive. Exiting"
1149 pid_file
=`echo $pfl| awk '{ print $2 }'`
1151 test ! "$pid_file" ||
test "$pid_file" = "" ||
test -z "$pid_file" && die
"No PidFile specified in $run_conf. Edit this file and specify the PidFile directive. Exiting"
1156 echo "#!/bin/sh" > $file
1158 echo "##Apache $PRODUCT_NAME Shutdown">>$file
1160 echo "kill -TERM \`cat $pid_file.afs\`">>$file
1161 echo "kill -TERM \`cat $pid_file\`" >> $file
1168 die
"$file: does not exist"\
1169 " or is not executable. Exiting"
1172 t
=`grep -i "\.afs" $file`
1173 if [ ! "$t" ] ||
[ -z "$t" ] ||
[ "$t" = "" ]
1175 temp
=/tmp
/${prog}stopd.$$
1177 awk '{ line[NR]=$0 }
1179 printf "kill -TERM `%s.afs`\n", "'$pid_file'"
1180 for (i=1; i <= NR; i++) {
1181 printf "%s\n", line[i] }
1190 configure_makefile_forwebsecure
()
1193 echo $ac_n "Change Apache Configuration file [$val]:$ac_c"
1197 if [ $val = Y
] ||
[ $val = y
]
1200 make_conf_dir
=${make_conf%/*}
1201 while [[ ! -f $mc ]]
1203 echo $ac_n "Configuration file name [$make_conf]:$ac_c"
1207 /*) make_conf
=$uconf ;
1208 make_conf_dir
=${make_conf%/*};
1210 *) make_conf
=${make_conf_dir}/${uconf};
1211 make_conf_dir
=${make_conf%/*};
1215 test -f $mc ||
echo "$mc: does not exist"
1218 # Back up original Configuration file
1219 backup
=$make_conf.BEFOREAFS
1221 while [ -f $backup ]
1223 backup
=$make_conf.BEFOREAFS.
$number
1224 number
=$
(($number+1))
1227 $cp -p $make_conf $backup
1229 ( do_config_makefile
$make_conf )
1232 0) echo "Configured $make_conf successfully";;
1233 *) $mv -f $backup $make_conf ;
1234 die
"Configuration for Makefile FAILED: Exiting" ;;
1237 ConfigScript
=$ConfigScript_default
1239 echo $ac_n "Run Configuration script ($ConfigScript):"\
1243 if [ $val = Y
] ||
[ $val = y
]
1245 while [[ ! -x ${make_conf_dir}/${ConfigScript} ]]
1247 echo "$ConfigScript: not found or not "\
1248 "executable in $make_conf_dir"
1249 echo $ac_n "Enter Configure script name"\
1250 ":[$ConfigScript]$ac_c"
1252 test $in && ConfigScript
=$in
1255 ( cd $make_conf_dir; .
/$ConfigScript -file $make_conf )
1258 0) echo "Configuration successful";;
1259 *) die
"Configuration FAILED - Exiting";;
1263 # Before compiling - check afs_module is in appropriate directory
1264 if [ $apache_version = 1.3 ]
1266 sd
=${Apache_src}/modules
/extra
/afs_module.c
1268 sd
=${Apache_src}/afs_module.c
1272 echo "File $sd does not exist"
1273 val
=`pwd`/afs_module.c
1276 echo $ac_n "Enter the location of the source file afs_module.c that came with the $PRODUCT_NAME distribution [ $val ] $ac_c"
1280 echo "Copying $val to $sd"
1285 echo $ac_n "Compile: [$val] $ac_c"
1288 if [ $val = Y
] ||
[ $val = y
]
1290 ( cd $Apache_src ; make )
1291 test $?
!= 0 && die
"ERROR: make failed"
1292 echo "Successful compilation."
1293 echo "NOTE: If necessary do a make install after this script finishes"
1298 configure_runtime_forwebsecure
()
1301 run_conf_dir
=${run_conf%/*}
1302 while [[ ! -f $rc ]]
1304 echo $ac_n "Run time configuration file name "\
1309 /*) run_conf
=$uconf ;
1310 run_conf_dir
=${run_conf%/*};
1312 *) run_conf
=${run_conf_dir}/${uconf};
1313 run_conf_dir
=${run_conf%/*};
1317 test -f $rc ||
echo "$rc: does not exist"
1320 # Back up original Configuration file
1321 backup
=$run_conf.BEFOREAFS
1323 while [ -f $backup ]
1325 backup
=$run_conf.BEFOREAFS.
$number
1326 number
=$
(($number+1))
1329 $cp -p $run_conf $backup
1331 tempfile
=/tmp
/$prog.$$
1332 #( do_run_time $run_conf $tempfile )
1333 ( do_run_time
$run_conf )
1335 0) echo "Run time configuration complete."\
1336 " File $run_conf" ;;
1338 echo "Run-Time configuration not required" ;;
1339 *) $rm -f $tempfile;
1340 mv -f $backup $run_conf;
1341 die
"RUN_TIME CONFIGURATION FAILED";;
1350 if [ -f $Apache_src/*.BEFOREAFS
* ]
1352 eg
=`grep "mod_afs.o" $Apache_src/*`
1356 echo "Found backup config file for Makefile Configuration" ;
1357 /bin
/ls -l $Apache_src/*.BEFORE
* ;
1358 echo "You may have a previously installed version of AFS WebSecure" ;
1359 echo "This may conflict with installing this version." ;
1360 echo "Please restore all the configuration files to the state they" \
1361 "were before WebSecure was installed. " \
1362 "Remove *.BEFOREAFS* in the Apachesrc directory and re-run this script";
1368 if [ -f $ServerRoot/conf
/*.BEFOREAFS
* ]
1370 eg
=`grep -i setafslocation $ServerRoot/conf/*`
1373 *) echo "Found backup for run-time configuration" ;
1374 /bin
/ls -l $ServerRoot/conf
/*.BEFOREAFS
*
1375 echo "You may have a previously installed version of AFS WebSecure"
1376 echo "Please restore all the configuration files to the state " \
1377 "they were before WebSecure was installed. " \
1378 "Remove *.BEFOREAFS* in the Apache conf directory " \
1379 "and re-run this script." ;
1380 die
"Exiting ... " ;;
1387 install_web_secure
()
1392 configure_makefile_forwebsecure
1393 configure_runtime_forwebsecure
1394 echo "$product Configuration Complete"
1400 A
="Create new Startup Script"
1401 B
="Create new ShutDown Script"
1402 C
="Edit existing Shutdown Script to shutdown AFS Web Secure"
1404 select c
in "$A" "$B" "$C"
1407 $A) echo $ac_n "Full path to webserver binary:"\
1410 test $in && binary
=$in;
1414 echo "$binary does not exist"
1415 echo "Check the path or compile Apache first"
1418 echo $ac_n "Full path to new script: [$startscr]$ac_c";
1420 test $in && startscr
=$in;
1423 die
"$startscr already exists. Exiting"
1425 ( do_start_stop START
$startscr $binary );
1428 $B) echo $ac_n "Full path to new script:[$stopscr] $ac_c";
1430 test $in && stopscr
=$in;
1433 die
"$stopscr already exists. Exiting"
1435 ( do_start_stop STOP
$stopscr $run_conf );
1438 $C) echo $ac_n "Existing script:[$stopscr] $ac_c";
1440 test $in && stopscr
=$in;
1441 if [ ! -x $stopscr ]
1443 die
"$stopscr doesn't exist. Exiting"
1445 ( do_start_stop E_STOP
$stopscr $run_conf );
1456 die
"ERROR: Editing Start and Stop scripts. Exiting"
1463 echo $ac_n "Start up the server: [$val] $ac_c"
1466 if [ $val = Y
] ||
[ $val = y
]
1477 if [ $firsttime = 0 ]
1483 echo; echo; echo; echo
1484 echo |
awk '{ for (i=0; i < 80; i++) { printf "-" } }'
1486 echo $ac_n "Main menu (M) or Exit (X): [$prompt] $ac_c"
1488 test $in && prompt
=$in
1489 test $prompt = 'X' ||
test $prompt = 'x' && exit 0;
1494 A
="AFS Web Secure Setup"
1495 E
="Make or Edit start and stop scripts"
1496 F
="Start up Apache Server"
1499 select choice
in "$A" "$E" "$F" "$G"
1502 $A) install_web_secure
;;
1503 $E) make_start_stop
;;
1513 echo; echo; echo; echo
1515 echo "Thank you for downloading $PRODUCT_NAME for Apache."
1516 echo "This script will help you install this product."
1517 echo "Please read the documentation accompanying this product before continuing."
1518 echo "Also ensure that you have installed the source files, "
1519 echo "libraries and binaries in the recommended directories"
1521 echo "Contact $COMPANY for licensing information"
1522 echo "11 Stanwix Street"
1523 echo "Pittsburgh, PA 15222"
1526 val
=Y
; echo $ac_n "Continue? [$val] $ac_c"
1527 read in ; test $in && val
=$in
1529 Y|y
) clear ; break ;;
1530 *) echo "Exiting $prog" ; exit 0 ;;
1533 echo "$message" |
more
1536 val
=Y
; echo $ac_n "Continue? [$val] $ac_c"
1537 read in ; test $in && val
=$in
1539 Y|y
) clear; break ;;
1544 #############################################################################
1546 ## HERE IS WHERE IT ACTUALL STARTS
1548 ############################################################################
1551 #setting the nonew line stuff
1553 -n) ac_n
= ; ac_c
='\c' ;;
1554 *) ac_n
='-n' ; ac_c
= ;;
1557 case $show_welcome in
1559 *) welcome_screen
;;
1563 ## Initialize parameters to defaults
1565 ServerRoot
=$ServerRoot_default
1569 echo $ac_n "Enter Server Root directory: [$ServerRoot] $ac_c"
1576 test -d $ServerRoot ||
echo "$ServerRoot: No such directory"
1579 test $in && change_default ServerRoot_default
$ServerRoot
1581 Apache_src
=$Apache_src_default
1586 echo $ac_n "Enter Apache src directory: [$Apache_src] $ac_c"
1593 test -d $Apache_src ||
echo "$Apache_src: No such directory"
1597 test $in && change_default Apache_src_default
$Apache_src
1600 make_conf
=$Apache_src/$make_conf_default
1601 run_conf
=$ServerRoot/conf
/$run_conf_default
1602 binary
=$ServerRoot/$binary_default
1603 startscr
=$ServerRoot/$startscr_default
1604 stopscr
=$ServerRoot/$stopscr_default
1605 DocRoot
=$ServerRoot/$DocRoot_default
1610 ## Determine which version of Apache this is
1611 ## default to 1.3 since that is what everyone should be running!
1614 if [ ! -d $Apache_src/modules
/standard
]
1616 ## prompt user to confirm Apache 1.2
1617 echo $ac_n "Is this Apache 1.2.X?: [N] $ac_c"
1620 y|Y
) apache_version
=1.2;;
1624 echo "Apache Version: $apache_version" >> $Log