Update of /cvsroot/mhonarc/mharc
In directory subversions:/tmp/cvs-serv31655
Modified Files:
install.pl
Log Message:
Added verification of an existing config.sh to make sure certain
variables are defined.
Index: install.pl
===================================================================
RCS file: /cvsroot/mhonarc/mharc/install.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** install.pl 27 Sep 2002 05:12:12 -0000 1.3
--- install.pl 28 Sep 2002 05:05:01 -0000 1.4
***************
*** 344,347 ****
--- 344,352 ----
run_prg($Cp, 'lib/config.sh.dist', 'lib/config.sh');
$run_config = 1;
+ } else {
+ if (verify_config_sh('lib/config.sh', $cur_config,
+ MHArc::Config->load('lib/config.sh.dist'))) {
+ $run_config = 1;
+ }
}
if (manual_file_edit('lib/config.sh', 1)) {
***************
*** 368,373 ****
print <<EOT;
-----------------------------------------------------------------------
! | Please read the mharc installation document for instructions on
! | finishing the installation process. A copy is located at:
| $InstallDir/doc/install.html
-----------------------------------------------------------------------
--- 373,378 ----
print <<EOT;
-----------------------------------------------------------------------
! | Please read the mharc installation document to finish the installation
! | process. A copy is located at:
| $InstallDir/doc/install.html
-----------------------------------------------------------------------
***************
*** 634,638 ****
foreach (sort keys %vars) {
next if $found{$_};
! print CFG_OUT "\n", '# Added by install.pl', "\n";
print CFG_OUT $_, '=';
if ($vars{$_} =~ /\s/) {
--- 639,644 ----
foreach (sort keys %vars) {
next if $found{$_};
! print CFG_OUT "\n", '# Added by install.pl on ',
! scalar(localtime(time)), "\n";
print CFG_OUT $_, '=';
if ($vars{$_} =~ /\s/) {
***************
*** 651,654 ****
--- 657,687 ----
}
+ sub verify_config_sh {
+ my $filename = shift;
+ my $config = shift;
+ my $dist_config = shift;
+ my @check_vars = qw(
+ CGI_DIR
+ FORMAIL
+ LOCKFILE
+ MKNMZ
+ PROCMAIL
+ );
+ my(@add_vars) = ( );
+ my($var);
+ foreach $var (@check_vars) {
+ if (!$config->{$var}) {
+ push(@add_vars, $var => $dist_config->{$var});
+ print qq/NOTE: Adding $var="/, $dist_config->{$var},
+ qq/" to $filename\n/;
+ }
+ }
+ if (@add_vars) {
+ edit_config_sh($filename, @add_vars);
+ return 1;
+ }
+ 0;
+ }
+
sub manual_file_edit {
return 0 if $Batch;
***************
*** 656,660 ****
my $default = shift;
my $editor = $ENV{'EDITOR'} || 'vi';
! if (prompt_user_yn(qq/Would like to edit "$file" with "$editor"?/,
$default)) {
if (cmd($editor, $file) != 0) {
--- 689,693 ----
my $default = shift;
my $editor = $ENV{'EDITOR'} || 'vi';
! if (prompt_user_yn(qq/Would you like to edit "$file" with "$editor"?/,
$default)) {
if (cmd($editor, $file) != 0) {
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV