[Koha-cvs] CVS: koha/misc uninstall.pl,NONE,1.1 installer.pl,1.15,1.16 Install.pm,1.72,1.73

Paul POULAIN tipaul at users.sourceforge.net
Mon Jun 21 19:13:36 CEST 2004


Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26271

Modified Files:
	installer.pl Install.pm 
Added Files:
	uninstall.pl 
Log Message:
* uninstaller.pl to uninstall Koha
* -i auto_install_file to install without questions (useful for developper)

--- NEW FILE ---
#!/usr/bin/perl

sub ReadConfigFile
{
	my $fname = shift;	# Config file to read
	my $retval = {};	# Return value: ref-to-hash holding the configuration
	open (CONF, $fname) or return undef;
	while (<CONF>) {
		my $var;		# Variable name
		my $value;		# Variable value
		chomp;
		s/#.*//;		# Strip comments
		next if /^\s*$/;	# Ignore blank lines
		next if (!/^\s*(\w+)\s*=\s*(.*?)\s*$/);
		$var = $1;
		$value = $2;
		$retval->{$var} = $value;
	}
	close CONF;
	return $retval;
}

my $config = ReadConfigFile("/etc/koha.conf");
# to remove web sites:
print "\nrm -rf ".$config->{intranetdir};
print "\nrm -rf ".$config->{opacdir};
# remove mySQL stuff
# DB
print "\nmysqladmin -f -u".$config->{user}." -p".$config->{pass}." drop ".$config->{database};
# user
print "enter mySQL root password, please\n";
my $response=<STDIN>;
chomp $response;
print "\nmysql -uroot -p$response -Dmysql -e\"delete from user where user='".$config->{user}.'"';
# reload mysql
print "\nmysqladmin -uroot -p$response reload";
print "\nrm -f /etc/koha-httpd.conf";
print "\nrm -f /etc/koha.conf";
print "\nEDIT httpd.conf to remove /etc/koha-httpd.conf\n";

Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/installer.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** installer.pl	9 Jul 2003 00:16:22 -0000	1.15
--- installer.pl	21 Jun 2004 17:13:32 -0000	1.16
***************
*** 4,7 ****
--- 4,9 ----
  
  use Install;
+ use Getopt::Long;
+ 
  use strict; # please develop with the strict pragma
  
***************
*** 34,37 ****
--- 36,45 ----
  system("mkdir -p $etcdir");
  
+ my $auto_install_file;
+ GetOptions(
+     'i:s'    => \$auto_install_file,
+ );
+ my $auto_install = read_autoinstall_file($auto_install_file);
+ 
  Install::setetcdir $etcdir;
  
***************
*** 91,114 ****
  
  # Check for missing Perl Modules
! checkperlmodules();
  
  # Ask for installation directories
! getapacheinfo();
  
! getinstallationdirectories();
  
! getdatabaseinfo();
  
! getapachevhostinfo();
  
  updateapacheconf();
  
! basicauthentication();
  
! installfiles();
  
  backupmycnf();
  
! databasesetup();
  
  updatedatabase();
--- 99,122 ----
  
  # Check for missing Perl Modules
! checkperlmodules($auto_install);
  
  # Ask for installation directories
! getapacheinfo($auto_install);
  
! getinstallationdirectories($auto_install);
  
! getdatabaseinfo($auto_install);
  
! getapachevhostinfo($auto_install);
  
  updateapacheconf();
  
! # basicauthentication();
  
! installfiles($auto_install);
  
  backupmycnf();
  
! databasesetup($auto_install);
  
  updatedatabase();

Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -r1.72 -r1.73
*** Install.pm	11 Feb 2004 08:42:01 -0000	1.72
--- Install.pm	21 Jun 2004 17:13:33 -0000	1.73
***************
*** 55,60 ****
  
  @ISA = qw(Exporter);
! @EXPORT = qw(	&checkperlmodules
!                 &checkabortedinstall
  		&getmessage
  		&showmessage
--- 55,62 ----
  
  @ISA = qw(Exporter);
! @EXPORT = qw(
! 		&read_autoinstall_file
! 		&checkperlmodules
! 		&checkabortedinstall
  		&getmessage
  		&showmessage
***************
*** 139,142 ****
--- 141,147 ----
  at the prompt.
  
+ You also can define an auto_install_file, that will answer every question automatically.
+ To use this feature, run ./installer.pl -i /path/to/auto_install_file 
+ 
  Are you ready to begin the installation? ([Y]/N): |;
  
***************
*** 307,310 ****
--- 312,316 ----
  Press <ENTER> to exit the installer: |;
  
+ #'
  sub releasecandidatewarning {
      my $message=getmessage('ReleaseCandidateWarning', [$newversion, $newversion]);
***************
*** 320,323 ****
--- 326,362 ----
  }
  
+ sub read_autoinstall_file
+ {
+ 	my $fname = shift;	# Config file to read
+ 	my $retval = {};	# Return value: ref-to-hash holding the
+ 				# configuration
+ 
+ 	open (CONF, $fname) or return undef;
+ 
+ 	while (<CONF>)
+ 	{
+ 		my $var;		# Variable name
+ 		my $value;		# Variable value
+ 
+ 		chomp;
+ 		s/#.*//;		# Strip comments
+ 		next if /^\s*$/;	# Ignore blank lines
+ 
+ 		# Look for a line of the form
+ 		#	var = value
+ 		if (!/^\s*(\w+)\s*=\s*(.*?)\s*$/)
+ 		{
+ 			next;
+ 		}
+ 
+ 		# Found a variable assignment
+ 		# variable that was already set.
+ 		$var = $1;
+ 		$value = $2;
+ 		$retval->{$var} = $value;
+ 	}
+ 	close CONF;
+ 	return $retval;
+ }
  
  =back
***************
*** 810,814 ****
  # Test for Perl and Modules
  #
! 
      my $message = getmessage('CheckingPerlModules');
      showmessage($message, 'none');
--- 849,853 ----
  # Test for Perl and Modules
  #
! 	my ($auto_install) = @_;
      my $message = getmessage('CheckingPerlModules');
      showmessage($message, 'none');
***************
*** 857,861 ****
  	exit;
      } else {
! 	showmessage(getmessage('AllPerlModulesInstalled'), 'PressEnter', '', 1);
      }
  
--- 896,900 ----
  	exit;
      } else {
! 	showmessage(getmessage('AllPerlModulesInstalled'), 'PressEnter', '', 1) unless $auto_install->{NoPressEnter};
      }
  
***************
*** 914,918 ****
  
  sub getinstallationdirectories {
! 	if (!$ENV{prefix}) { $ENV{prefix} = "/usr/local"; }
      $opacdir = $ENV{prefix}.'/koha/opac';
      $intranetdir = $ENV{prefix}.'/koha/intranet';
--- 953,958 ----
  
  sub getinstallationdirectories {
! 	my ($auto_install) = @_;
! 	if (!$ENV{prefix}) { $ENV{prefix} = "/usr/local"; } #"
      $opacdir = $ENV{prefix}.'/koha/opac';
      $intranetdir = $ENV{prefix}.'/koha/intranet';
***************
*** 920,929 ****
      while ($getdirinfo) {
  	# Loop until opac directory and koha directory are different
! 	my $message=getmessage('GetOpacDir', [$opacdir]);
! 	$opacdir=showmessage($message, 'free', $opacdir);
! 
! 	$message=getmessage('GetIntranetDir', [$intranetdir]);
! 	$intranetdir=showmessage($message, 'free', $intranetdir);
! 
  	if ($intranetdir eq $opacdir) {
  	    print qq|
--- 960,978 ----
      while ($getdirinfo) {
  	# Loop until opac directory and koha directory are different
! 	my $message;
! 	if ($auto_install->{GetOpacDir}) {
! 		$opacdir=$auto_install->{GetOpacDir};
! 		print "auto-setting OpacDir to $opacdir\n";
! 	} else {
! 		$message=getmessage('GetOpacDir', [$opacdir]);
! 		$opacdir=showmessage($message, 'free', $opacdir);
! 	}
! 	if ($auto_install->{GetIntranetDir}) {
! 		$intranetdir=$auto_install->{GetIntranetDir};
! 		print "auto-setting IntranetDir to $intranetdir\n";
! 	} else {
! 		$message=getmessage('GetIntranetDir', [$intranetdir]);
! 		$intranetdir=showmessage($message, 'free', $intranetdir);
! 	}
  	if ($intranetdir eq $opacdir) {
  	    print qq|
***************
*** 938,943 ****
      }
      $kohalogdir=$ENV{prefix}.'/koha/log';
!     my $message=getmessage('GetKohaLogDir', [$kohalogdir]);
!     $kohalogdir=showmessage($message, 'free', $kohalogdir);
  
  
--- 987,997 ----
      }
      $kohalogdir=$ENV{prefix}.'/koha/log';
! 	if ($auto_install->{GetOpacDir}) {
! 		$kohalogdir=$auto_install->{KohaLogDir};
! 		print "auto-setting OpacDir to $opacdir\n";
! 	} else {
! 	    my $message=getmessage('GetKohaLogDir', [$kohalogdir]);
!     	$kohalogdir=showmessage($message, 'free', $kohalogdir);
! 	}
  
  
***************
*** 986,990 ****
  
  MySQL installation directory: |;
! 
  sub getmysqldir {
      foreach my $mysql (qw(/usr/local/mysql
--- 1040,1044 ----
  
  MySQL installation directory: |;
! #'
  sub getmysqldir {
      foreach my $mysql (qw(/usr/local/mysql
***************
*** 993,997 ****
  			  /usr
  			  )) {
!        if ( -d $mysql  && -f "$mysql/bin/mysqladmin") {
  	    $mysqldir=$mysql;
         }
--- 1047,1051 ----
  			  /usr
  			  )) {
!        if ( -d $mysql  && -f "$mysql/bin/mysqladmin") { #"
  	    $mysqldir=$mysql;
         }
***************
*** 1056,1060 ****
  
  sub getdatabaseinfo {
! 
      $database = 'Koha';
      $hostname = 'localhost';
--- 1110,1114 ----
  
  sub getdatabaseinfo {
! 	my ($auto_install) = @_;
      $database = 'Koha';
      $hostname = 'localhost';
***************
*** 1063,1089 ****
  
  #Get the database name
! 
!     my $message=getmessage('DatabaseName', [$database]);
!     $database=showmessage($message, 'free', $database);
! 
  #Get the hostname for the database
      
!     $message=getmessage('DatabaseHost', [$hostname]);
!     $hostname=showmessage($message, 'free', $hostname);
! 
  #Get the username for the database
  
!     $message=getmessage('DatabaseUser', [$database, $hostname, $user]);
!     $user=showmessage($message, 'free', $user);
! 
  #Get the password for the database user
  
      while ($pass eq '') {
! 	my $message=getmessage('DatabasePassword', [$user, $user]);
! 	$pass=showmessage($message, 'free', $pass);
! 	if ($pass eq '') {
! 	    my $message=getmessage('BlankPassword');
! 	    showmessage($message,'PressEnter');
! 	}
      }
  }
--- 1117,1161 ----
  
  #Get the database name
! 	my $message;
! 	
! 	if ($auto_install->{database}) {
! 		$database=$auto_install->{database};
! 		print "auto-setting database to $database\n";
! 	} else {
! 		$message=getmessage('DatabaseName', [$database]);
! 		$database=showmessage($message, 'free', $database);
! 	}
  #Get the hostname for the database
      
! 	if ($auto_install->{DatabaseHost}) {
! 		$hostname=$auto_install->{DatabaseHost};
! 		print "auto-setting database host to $hostname\n";
! 	} else {
! 		$message=getmessage('DatabaseHost', [$hostname]);
! 		$hostname=showmessage($message, 'free', $hostname);
! 	}
  #Get the username for the database
  
! 	if ($auto_install->{DatabaseUser}) {
! 		$user=$auto_install->{DatabaseUser};
! 		print "auto-setting DB user to $user\n";
! 	} else {
! 		$message=getmessage('DatabaseUser', [$database, $hostname, $user]);
! 		$user=showmessage($message, 'free', $user);
! 	}
  #Get the password for the database user
  
      while ($pass eq '') {
! 		my $message=getmessage('DatabasePassword', [$user, $user]);
! 		if ($auto_install->{DatabasePassword}) {
! 			$pass=$auto_install->{DatabasePassword};
! 			print "auto-setting database password to $pass\n";
! 		} else {
! 				$pass=showmessage($message, 'free', $pass);
! 		}
! 		if ($pass eq '') {
! 			my $message=getmessage('BlankPassword');
! 			showmessage($message,'PressEnter');
! 		}
      }
  }
***************
*** 1140,1143 ****
--- 1212,1216 ----
  
  sub getapacheinfo {
+ 	my ($auto_install) = @_;
      my @confpossibilities;
  
***************
*** 1157,1191 ****
  			  /etc/httpd/2.0/conf/httpd2.conf
  			  )) {
! 	if ( -f $httpdconf ) {
! 	    push @confpossibilities, $httpdconf;
! 	}
      }
  
      if ($#confpossibilities==-1) {
! 	my $message=getmessage('NoApacheConfFiles');
! 	my $choice='';
! 	$realhttpdconf='';
! 	until (-f $realhttpdconf) {
! 	    $choice=showmessage($message, "free", 1);
! 	    if (-f $choice) {
! 		$realhttpdconf=$choice;
! 	    } else {
! 		showmessage(getmessage('NotAFile', [$choice]),'PressEnter', '', 1);
! 	    }
! 	}
      } elsif ($#confpossibilities>0) {
! 	my $conffiles='';
! 	my $counter=1;
! 	my $options='';
! 	foreach (@confpossibilities) {
! 	    $conffiles.="   $counter: $_\n";
! 	    $options.="$counter";
! 	    $counter++;
! 	}
! 	my $message=getmessage('FoundMultipleApacheConfFiles', [$conffiles]);
! 	my $choice=showmessage($message, "restrictchar $options", 1);
! 	$realhttpdconf=$confpossibilities[$choice-1];
      } else {
! 	$realhttpdconf=$confpossibilities[0];
      }
      unless (open (HTTPDCONF, "<$realhttpdconf")) {
--- 1230,1264 ----
  			  /etc/httpd/2.0/conf/httpd2.conf
  			  )) {
! 		if ( -f $httpdconf ) {
! 			push @confpossibilities, $httpdconf;
! 		}
      }
  
      if ($#confpossibilities==-1) {
! 		my $message=getmessage('NoApacheConfFiles');
! 		my $choice='';
! 		$realhttpdconf='';
! 		until (-f $realhttpdconf) {
! 			$choice=showmessage($message, "free", 1);
! 			if (-f $choice) {
! 			$realhttpdconf=$choice;
! 			} else {
! 			showmessage(getmessage('NotAFile', [$choice]),'PressEnter', '', 1);
! 			}
! 		}
      } elsif ($#confpossibilities>0) {
! 		my $conffiles='';
! 		my $counter=1;
! 		my $options='';
! 		foreach (@confpossibilities) {
! 			$conffiles.="   $counter: $_\n";
! 			$options.="$counter";
! 			$counter++;
! 		}
! 		my $message=getmessage('FoundMultipleApacheConfFiles', [$conffiles]);
! 		my $choice=showmessage($message, "restrictchar $options", 1);
! 		$realhttpdconf=$confpossibilities[$choice-1];
      } else {
! 		$realhttpdconf=$confpossibilities[0];
      }
      unless (open (HTTPDCONF, "<$realhttpdconf")) {
***************
*** 1195,1217 ****
  
      while (<HTTPDCONF>) {
! 	if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
! 	    $httpduser = $1;
! 	}
      }
      close(HTTPDCONF);
  
      unless (defined($httpduser)) {
! 	my $message=getmessage('EnterApacheUser', [$etcdir]);
! 	until (defined($httpduser) && length($httpduser) && getpwnam($httpduser)) {
! 	    $httpduser=showmessage($message, "free", '');
! 	    if (length($httpduser)>0) {
! 		unless (getpwnam($httpduser)) {
! 		    my $message=getmessage('InvalidUserid', [$httpduser]);
! 		    showmessage($message,'PressEnter');
  		}
- 	    } else {
- 	    }
  	}
-     }
  }
  
--- 1268,1300 ----
  
      while (<HTTPDCONF>) {
! 		if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
! 			$httpduser = $1;
! 		}
      }
      close(HTTPDCONF);
  
      unless (defined($httpduser)) {
! 		my $message;
! 		if ($auto_install->{EnterApacheUser}) {
! 			$message = $auto_install->{EnterApacheUser};
! 			print "auto-setting ApacheUser to $message\n";
! 		} else {
! 			$message=getmessage('EnterApacheUser', [$etcdir]);
! 		}
! 		until (defined($httpduser) && length($httpduser) && getpwnam($httpduser)) {
! 			if ($auto_install->{EnterApacheUser}) {
! 				$httpduser = $auto_install->{EnterApacheUser};
! 			} else {
! 				$httpduser=showmessage($message, "free", '');
! 			}
! 			if (length($httpduser)>0) {
! 				unless (getpwnam($httpduser)) {
! 					my $message=getmessage('InvalidUserid', [$httpduser]);
! 					showmessage($message,'PressEnter');
! 				}
! 			} else {
! 			}
  		}
  	}
  }
  
***************
*** 1276,1280 ****
  
  sub getapachevhostinfo {
! 
      $svr_admin = "webmaster\@$domainname";
      $servername=`hostname`;
--- 1359,1363 ----
  
  sub getapachevhostinfo {
! 	my ($auto_install) = @_;
      $svr_admin = "webmaster\@$domainname";
      $servername=`hostname`;
***************
*** 1283,1294 ****
      $intranetport=8080;
  
!     showmessage(getmessage('ApacheConfigIntroduction',[$etcdir,$etcdir]), 'PressEnter');
! 
!     $svr_admin=showmessage(getmessage('GetVirtualHostEmail', [$svr_admin]), 'email', $svr_admin);
!     $servername=showmessage(getmessage('GetServerName', [$servername]), 'free', $servername);
! 
! 
!     $opacport=showmessage(getmessage('GetOpacPort', [$opacport]), 'numerical', $opacport);
!     $intranetport=showmessage(getmessage('GetIntranetPort', [$opacport, $intranetport]), 'numerical', $intranetport);
  
  }
--- 1366,1394 ----
      $intranetport=8080;
  
! 	if ($auto_install->{GetVirtualHostEmail}) {
! 		$svr_admin=$auto_install->{GetVirtualHostEmail};
! 		print "auto-setting VirtualHostEmail to $svr_admin\n";
! 	} else {
! 		showmessage(getmessage('ApacheConfigIntroduction',[$etcdir,$etcdir]), 'PressEnter');
! 		$svr_admin=showmessage(getmessage('GetVirtualHostEmail', [$svr_admin]), 'email', $svr_admin);
! 	}
! 	if ($auto_install->{servername}) {
! 		$servername=$auto_install->{servername};
! 		print "auto-setting server name to $servername\n";
! 	} else {
!     	$servername=showmessage(getmessage('GetServerName', [$servername]), 'free', $servername);
! 	}
! 	if ($auto_install->{opacport}) {
! 		$opacport=$auto_install->{opacport};
! 		print "auto-setting opac port to $opacport\n";
! 	} else {
! 	    $opacport=showmessage(getmessage('GetOpacPort', [$opacport]), 'numerical', $opacport);
! 	}
! 	if ($auto_install->{intranetport}) {
! 		$servername=$auto_install->{intranetport};
! 		print "auto-setting intranet port to $intranetport\n";
! 	} else {
! 	    $intranetport=showmessage(getmessage('GetIntranetPort', [$opacport, $intranetport]), 'numerical', $intranetport);
! 	}
  
  }
***************
*** 1448,1499 ****
  =cut
  
! $messages->{'IntranetAuthenticationQuestion'}->{en} =
!    heading('LIBRARIAN AUTHENTICATION') . qq|
! The Librarian site can be password protected using
! Apache's Basic Authorization instead of Koha user details.
! 
! This method going to be phased out very soon.  Most users should answer N here.
! 
! Would you like to do this (Y/[N]): |;	#'
! 
! $messages->{'BasicAuthUsername'}->{en}="Please enter a username for librarian access [%s]: ";
! $messages->{'BasicAuthPassword'}->{en}="Please enter a password for %s: ";
! $messages->{'BasicAuthPasswordWasBlank'}->{en}="\nYou cannot use a blank password!\n\n";
! 
! sub basicauthentication {
!     my $message=getmessage('IntranetAuthenticationQuestion');
!     my $answer=showmessage($message, 'yn', 'n');
!     my $httpdconf = $etcdir."/koha-httpd.conf";
! 
!     my $apacheauthusername='librarian';
!     my $apacheauthpassword='';
!     if ($answer=~/^y/i) {
! 	($apacheauthusername) = showmessage(getmessage('BasicAuthUsername', [ $apacheauthusername]), 'free', $apacheauthusername, 1);
! 	$apacheauthusername=~s/[^a-zA-Z0-9]//g;
! 	while (! $apacheauthpassword) {
! 	    ($apacheauthpassword) = showmessage(getmessage('BasicAuthPassword', [ $apacheauthusername]), 'free', 1);
! 	    if (!$apacheauthpassword) {
! 		($apacheauthpassword) = showmessage(getmessage('BasicAuthPasswordWasBlank'), 'none', '', 1);
! 	    }
! 	}
! 	open AUTH, ">$etcdir/kohaintranet.pass";
! 	my $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
! 	my $salt=substr($chars, int(rand(length($chars))),1);
! 	$salt.=substr($chars, int(rand(length($chars))),1);
! 	print AUTH $apacheauthusername.":".crypt($apacheauthpassword, $salt)."\n";
! 	close AUTH;
! 	open(SITE,">>$httpdconf") or warn "Insufficient priveleges to open $realhttpdconf for writing.\n";
! 	print SITE <<EOP
! 
! <Directory $intranetdir>
!     AuthUserFile $etcdir/kohaintranet.pass
!     AuthType Basic
!     AuthName "Koha Intranet (for librarians only)"
!     Require  valid-user
! </Directory>
! EOP
!     }
!     close(SITE);
! }
  
  
--- 1548,1599 ----
  =cut
  
! # $messages->{'IntranetAuthenticationQuestion'}->{en} =
! #    heading('LIBRARIAN AUTHENTICATION') . qq|
! # The Librarian site can be password protected using
! # Apache's Basic Authorization instead of Koha user details.
! # 
! # This method going to be phased out very soon.  Most users should answer N here.
! # 
! # Would you like to do this (Y/[N]): |;	#'
! # 
! # $messages->{'BasicAuthUsername'}->{en}="Please enter a username for librarian access [%s]: ";
! # $messages->{'BasicAuthPassword'}->{en}="Please enter a password for %s: ";
! # $messages->{'BasicAuthPasswordWasBlank'}->{en}="\nYou cannot use a blank password!\n\n";
! # 
! # sub basicauthentication {
! #     my $message=getmessage('IntranetAuthenticationQuestion');
! #     my $answer=showmessage($message, 'yn', 'n');
! #     my $httpdconf = $etcdir."/koha-httpd.conf";
! # 
! #     my $apacheauthusername='librarian';
! #     my $apacheauthpassword='';
! #     if ($answer=~/^y/i) {
! # 	($apacheauthusername) = showmessage(getmessage('BasicAuthUsername', [ $apacheauthusername]), 'free', $apacheauthusername, 1);
! # 	$apacheauthusername=~s/[^a-zA-Z0-9]//g;
! # 	while (! $apacheauthpassword) {
! # 	    ($apacheauthpassword) = showmessage(getmessage('BasicAuthPassword', [ $apacheauthusername]), 'free', 1);
! # 	    if (!$apacheauthpassword) {
! # 		($apacheauthpassword) = showmessage(getmessage('BasicAuthPasswordWasBlank'), 'none', '', 1);
! # 	    }
! # 	}
! # 	open AUTH, ">$etcdir/kohaintranet.pass";
! # 	my $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
! # 	my $salt=substr($chars, int(rand(length($chars))),1);
! # 	$salt.=substr($chars, int(rand(length($chars))),1);
! # 	print AUTH $apacheauthusername.":".crypt($apacheauthpassword, $salt)."\n";
! # 	close AUTH;
! # 	open(SITE,">>$httpdconf") or warn "Insufficient priveleges to open $realhttpdconf for writing.\n";
! # 	print SITE <<EOP
! # 
! # <Directory $intranetdir>
! #     AuthUserFile $etcdir/kohaintranet.pass
! #     AuthType Basic
! #     AuthName "Koha Intranet (for librarians only)"
! #     Require  valid-user
! # </Directory>
! # EOP
! #     }
! #     close(SITE);
! # }
  
  
***************
*** 1538,1542 ****
  		my $src = shift;
  		my $tgt = shift;
- 		
  		if (-e $tgt) {
      		print getmessage('CopyingFiles', ["old ".$desc,$tgt.strftime("%Y%m%d%H%M",localtime())]);
--- 1638,1641 ----
***************
*** 1550,1553 ****
--- 1649,1653 ----
  	}
  
+ 	my ($auto_install) = @_;
      showmessage(getmessage('InstallFiles'),'none');
  
***************
*** 1608,1612 ****
  	}
  
!     showmessage(getmessage('OldFiles'),'PressEnter');
  }
  
--- 1708,1712 ----
  	}
  
!     showmessage(getmessage('OldFiles'),'PressEnter') unless $auto_install->{NoPressEnter};
  }
  
***************
*** 1673,1689 ****
  
  sub databasesetup {
      $mysqluser = 'root';
      $mysqlpass = '';
  	my $mysqldir = getmysqldir();
  
!     # we must not put the mysql root password on the command line
! 	$mysqlpass=	showmessage(getmessage('MysqlRootPassword'),'silentfree');
  	
! 	showmessage(getmessage('CreatingDatabase'),'none');
  	# set the login up
  	setmysqlclipass($mysqlpass);
  	# Set up permissions
  	startsysout();
! 	print system("$mysqldir/bin/mysql -u$mysqluser mysql -e \"insert into user (Host,User,Password) values ('$hostname','$user',password('$pass'))\"\;");
  	system("$mysqldir/bin/mysql -u$mysqluser mysql -e \"insert into db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv, index_priv, alter_priv) values ('%','$database','$user','Y','Y','Y','Y','Y','Y','Y','Y')\"");
  	system("$mysqldir/bin/mysqladmin -u$mysqluser reload");
--- 1773,1794 ----
  
  sub databasesetup {
+ 	my ($auto_install) = @_;
      $mysqluser = 'root';
      $mysqlpass = '';
  	my $mysqldir = getmysqldir();
  
! 	if ($auto_install->{MysqlRootPassword}) {
! 		$mysqlpass=$auto_install->{MysqlRootPassword};
! 	} else {
!     	# we must not put the mysql root password on the command line
! 		$mysqlpass=	showmessage(getmessage('MysqlRootPassword'),'silentfree');
! 	}
  	
! 	showmessage(getmessage('CreatingDatabase'),'none') unless ($auto_install->{NoPressEnter});
  	# set the login up
  	setmysqlclipass($mysqlpass);
  	# Set up permissions
  	startsysout();
! 	print system("$mysqldir/bin/mysql -u$mysqluser mysql -e \"insert into user (Host,User,Password) values ('$hostname','$user',password('$pass'))\"\;");#"
  	system("$mysqldir/bin/mysql -u$mysqluser mysql -e \"insert into db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv, index_priv, alter_priv) values ('%','$database','$user','Y','Y','Y','Y','Y','Y','Y','Y')\"");
  	system("$mysqldir/bin/mysqladmin -u$mysqluser reload");





More information about the Koha-cvs mailing list