From e5e992f52e39ffe1b46725160eecadf468486354 Mon Sep 17 00:00:00 2001 From: acli Date: Sat, 25 Jan 2003 17:10:46 +0000 Subject: [PATCH] Moved knowledge of "koha.conf.tmp" to the Install.pm POD updates --- misc/Install.pm | 51 +++++++++++++++++++++++++++++++++++++++++++---- misc/installer.pl | 20 +++++++++++++------ 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/misc/Install.pm b/misc/Install.pm index f48665ab11..03100260ba 100644 --- a/misc/Install.pm +++ b/misc/Install.pm @@ -61,6 +61,7 @@ $VERSION = 0.01; &updatedatabase &populatedatabase &restartapache + &finalizeconfigfile &loadconfigfile ); @@ -91,7 +92,7 @@ in the "traditional Koha installer" style, i.e., surrounded by a box of equal signs). This reduces the likelihood of pod2man(1) etc. misinterpreting -a line of equal signs as POD directives. +a line of equal signs as illegal POD directives. =cut @@ -440,7 +441,7 @@ Shows a message and optionally gets a response from the user. The first two arguments, the message and the response type, are mandatory. The message must be the actual string to -display. The caller is responsible for calling getmessage if +display; the caller is responsible for calling getmessage if required. The response type must be one of "none", "yn", "free", @@ -460,7 +461,8 @@ guarantee that the returned value is a well-formed RFC-822 email address, nor does it accept all well-formed RFC-822 email addresses. What it does is to restrict the returned value to a string that is looks reasonably likely to be an email address -in the "real world". +in the "real world", given the premise that the user is trying +to enter a real email address. If a response type other than "none" or "PressEnter" is specified, a third argument, specifying the default value, can @@ -481,7 +483,9 @@ if a fourth argument is specified and is nonzero, this screen-clearing is not done. FIXME: A response type of "yn" should allow the user to specify -"y" or "n" in either upercase or lowercase. +"y" or "n" in either uppercase or lowercase. This is especially +true since the message shown to the user will contain uppercase +characters as valid choices. FIXME: If the response type is "free", the user cannot specify an empty string; showmessage will return "1" as the result. @@ -807,6 +811,8 @@ Database user [%s]: |; $messages->{'DatabasePassword'}->{en} = heading('Database Password') . qq| Please provide a good password for the user %s. +This password will also be used to access Koha's INTRANET interface. + Database Password: |; $messages->{'BlankPassword'}->{en} = heading('BLANK PASSWORD') . qq| @@ -1564,6 +1570,43 @@ sub restartapache { } +=item finalizeconfigfile + + finalizeconfigfile; + +This function must be called when the installation is complete, +to rename the koha.conf.tmp file to koha.conf. + +Currently, failure to rename the file results only in a warning. + +=cut + +sub finalizeconfigfile { + rename "$etcdir/koha.conf.tmp", "$etcdir/koha.conf" + || showmessage(<) { + $domainname = $1 if /^domain\s+([-a-z0-9\.]+)\s*$/i; + last if defined $domainname; + } + close INPUT; + } +} Install::setdomainname $domainname; my $etcdir = '/etc'; @@ -98,16 +109,13 @@ databasesetup(); updatedatabase(); -#updatemarc(); - populatedatabase(); -restartapache(); +finalizeconfigfile(); +restartapache(); -# Installation is complete. Rename the koha.conf.tmp file -rename "$etcdir/koha.conf.tmp", "$etcdir/koha.conf" || warn "Couldn't rename file at $etcdir. Must have write capability.\n"; showmessage(getmessage('AuthenticationWarning', [$etcdir]), 'PressEnter'); -- 2.39.5