Discus Setup$platform has successfully created a Perl script to finish the
installation. All you need to do is to run the Perl script from the command
line$windows_click, and $FORM{'title'} will be up and running.
Specifically, here is the procedure:
_End_Of_YAY_
if ($unix) {
print "
cd $ch_d\nperl install.pl
\n";
} else {
print "Start a MS-DOS prompt and enter these commands:
Alternatively, you may use Windows Explorer to navigate to the $ch_d_2 directory and double-click on the \"install.pl\" script.\n";
}
print <<_End_Of_YAY_2_;
AFTER YOU HAVE RUN install.pl, you may go to $FORM{'title'}.
_End_Of_YAY_2_
exit(0);
########################################################
# COPY FILES
sub copy_file {
local ($source_fn, $final_fn, $is_script, $is_source, $remove_flock, $remove_chmod, $remove_ssi, $is_html, $perm, $binary, $owwarn) = @_;
open (INSTPL, ">>$install_pl");
eval 'flock(INSTPL, 2);' if $implemented_flock;
print INSTPL "###################################################\n";
print INSTPL "# Copy $source_fn -> $final_fn\n\n";
if ($owwarn) {
print INSTPL "if (!-e '$final_fn') {\n";
}
print INSTPL <<_End_Open_Code;
open(SOURCE, "$source_fn") || print "Warning: Could not open $source_fn: \$! \$\@\\n";
_End_Open_Code
print INSTPL "eval 'binmode(SOURCE);';\n" if $binary;
print INSTPL <<_End_Open_Code;
\@source = ;
close (SOURCE);
open (DEST, ">$final_fn") || print "Warning: Could not write $final_fn: \$! \$\@\\n";;
_End_Open_Code
print INSTPL "flock (DEST, 2);\n" if $implemented_flock;
print INSTPL "eval 'binmode(DEST);';\n" if $binary;
print INSTPL '@source = grep(!/^(\s*)flock\s?\(\w+\s?,\s?\d\);/, @source);',"\n" if $remove_flock;
print INSTPL '@source = grep(!/^(\s*)chmod\s?\(\d+,/, @source);',"\n" if $remove_chmod;
if ($is_script) {
print INSTPL "print DEST \"#!$chosen_perl\\n\";\n";
print INSTPL "print DEST \"\\\$discus_conf = '$FORM{'admin_dir'}/discus.conf';\\n\";\n";
}
if ($is_html) {
print INSTPL <<_End_Of_HTML_Updates;
foreach \$line (\@source) {
if (\$line =~ /board-menu\\.html/) {
\$line = "\$`$FORM{'html_url'}/board-menu.html\$'";
} elsif (\$line =~ m|messages/board-topics.html|) {
\$line = "\$`$FORM{'html_url'}/messages/board-topics.html\$'";
} elsif (\$line =~ m|warning.html|) {
\$line = "\$`$FORM{'html_url'}/warning.html\$'";
} elsif (\$line =~ /board-search.cgi/) {
\$line = "\$`$FORM{'script_url'}/board-search.$cgi_extension\$'";
} elsif (\$line =~ /board-newmessages.cgi/) {
\$line = "\$`$FORM{'script_url'}/board-newmessages.$cgi_extension\$'";
} elsif (\$line =~ /board-profile.cgi/) {
\$line = "\$`$FORM{'script_url'}/board-profile.$cgi_extension\$'";
} elsif (\$line =~ /board-contact.cgi/) {
\$line = "\$`$FORM{'script_url'}/board-contact.$cgi_extension\$'";
} elsif (\$line =~ /board-image-lister.cgi/) {
\$line = "\$`$FORM{'script_url'}/board-image-lister.$cgi_extension\$'";
} elsif (\$line =~ /board-admin-menuonly.cgi/) {
\$line = "\$`$FORM{'script_url'}/board-admin-menuonly.$cgi_extension\$'";
} elsif (\$line =~ /board-viewtree.cgi/) {
\$line = "\$`$FORM{'script_url'}/board-viewtree.$cgi_extension\$'";
} elsif (\$line =~ /\\.\\.\\/clipart\\/board_logo.gif/) {
\$line = "\$`$FORM{'html_url'}/clipart/board_logo.gif\$'";
}
}
foreach \$line (\@source) {
\$line =~ s/([^!]+)/$title/g;
\$line =~ s/([^!]+)/$title_stripped<\\/TITLE>/g;
}
_End_Of_HTML_Updates
}
print INSTPL "print DEST \@source;\n";
if ($is_script || $is_source) {
print INSTPL "print DEST \"\\r\\n\";" if $windows;
print INSTPL "print DEST \"\\n\";" if $unix;
}
print INSTPL "flock (DEST, 8);\n" if $implemented_flock;
print INSTPL "close (DEST);\n";
print INSTPL "chmod(0$perm, '$final_fn');\n" if $implemented_chmod;
if ($owwarn) {
print INSTPL "}\n";
}
print INSTPL "\n";
eval 'flock(INSTPL, 8);' if $implemented_flock;
close (INSTPL);
open (SCR, ">>$cleanup_pl");
eval 'flock(SCR, 2);' if $implemented_flock;
print SCR "# Remove source file: $source_fn\n";
print SCR "unlink(\"$source_fn\");\n";
print SCR "\n";
eval 'flock(SCR, 8);' if $implemented_flock;
close (SCR);
open (SCR, ">>$uninstall_pl");
eval 'flock(SCR, 2);' if $implemented_flock;
print SCR "# Remove destination file: $final_fn\n";
print SCR "unlink(\"$final_fn\");\n";
print SCR "\n";
eval 'flock(SCR, 8);' if $implemented_flock;
close (SCR);
}
sub make_directory {
local ($directory, $permissions) = @_;
open (INSTPL, ">>$install_pl");
print INSTPL "# Make '$directory'\n";
print INSTPL "if (!(-e \"$directory\")) {\n";
print INSTPL " if (!(mkdir(\"$directory\", $permissions))) {\n";
print INSTPL " print \"ERROR! Could not create $directory.\\n\";\n";
print INSTPL " exit(0);\n";
print INSTPL " }\n";
print INSTPL " chmod($permissions, \"$directory\");\n";
print INSTPL "}\n\n";
close (INSTPL);
push (@dirs_made, $directory);
}
sub config_change {
local ($variable, $value) = @_;
local (@file, $line, $change);
open (FILE, ">>$install_pl");
print FILE "# Set '$variable' to '$value'\n";
print FILE "open (FILE, \"$config_file\");\n";
print FILE "\@file = ;\n";
print FILE "close (FILE);\n";
print FILE "\$change = 0;\n";
print FILE "foreach \$line (\@file) {\n";
print FILE " if (\$line =~ /$variable=(.*)/) {\n";
print FILE " \$line = \"$variable=$value\\n\";\n";
print FILE " \$change = 1;\n";
print FILE " }\n";
print FILE "}\n";
print FILE "if (\$change == 0) {\n";
print FILE " open (FILE, \">>$config_file\");\n";
print FILE " flock (FILE, 2);\n" if $implemented_flock;
print FILE " print FILE \"$variable=$value\\n\";\n";
print FILE " flock (FILE, 8);\n" if $implemented_flock;
print FILE " close (FILE);\n";
print FILE "} else {\n";
print FILE " open (FILE, \">$config_file\");\n";
print FILE " flock (FILE, 2);\n" if $implemented_flock;
print FILE " print FILE \@file;\n";
print FILE " flock (FILE, 8);\n" if $implemented_flock;
print FILE " close (FILE);\n";
print FILE "}\n";
print FILE "\n";
close (FILE);
}
sub generate {
local ($filename, $text, $permissions) = @_;
open (FILE, ">>$install_pl");
print FILE <<_End_generate;
if (!(-e "$filename")) {
open (FILE, ">$filename");
print FILE "$text";
close (FILE);
_End_generate
print FILE " chmod(0$permissions, \"$filename\");\n" if $implemented_chmod;
print FILE "}\n";
close (FILE);
open (SCR, ">>$uninstall_pl");
print SCR "# Remove destination file: $filename\n";
print SCR "unlink(\"$filename\");\n";
print SCR "\n";
eval 'flock(SCR, 8);' if $implemented_flock;
close (SCR);
}
########################################################
# MISCELLANEOUS SUBROUTINES USED FOR VARIOUS TASKS
sub parse_form {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/\r//g;
$FORM{$name} = $value;
}
}
sub give_up {
print "Content-type: text/html\n\n";
print "Setup Error\n";
print "\n";
print "
Setup Error
\n";
print "The server could not determine its current working directory, and it cannot see the 'install.pl' file that was created when the setup script was run. This is because:\n";
print "
Directory permissions prohibit the server from accessing files in '$install_dir', or\n";
print "
Your server is running in a 'chroot'-ed environment, which means that the server sees a different directory structure than you see when you log in through telnet.
\n";
print "
Consult your server administrator, and ask him or her to tell you the directory path that your server sees. Do not contact Discus technical support with this problem, because we won't be able to help -- sorry!\n";
print "\n";
exit(0);
}
sub error_message {
local ($message) = @_;
print "Content-type: text/html\n\n";
print "
Setup Error\n";
print "\n";
print "
Setup Error
\n";
print "$message. Please correct the error on the previous form and resubmit.";
print "\n";
exit(0);
}
##########################
# End of src-board-setup #
##########################