[Koha-cvs] CVS: koha Install.pm,1.1.2.22,1.1.2.23

Steve Tonnesen tonnesen at users.sourceforge.net
Mon Dec 9 17:57:21 CET 2002


Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1:/tmp/cvs-serv19859

Modified Files:
      Tag: rel-1-2
	Install.pm 
Log Message:
Installer now works with a blank mysql root password, although it warns that
the password should be set.

Also fixes a bug where branchcodes that didn't contain any uppercase letters
were getting est to blank.  It now allows all letters or numbers, and will
default to "DEF" if blank.



Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/Attic/Install.pm,v
retrieving revision 1.1.2.22
retrieving revision 1.1.2.23
diff -C2 -r1.1.2.22 -r1.1.2.23
*** Install.pm	6 Dec 2002 21:53:06 -0000	1.1.2.22
--- Install.pm	9 Dec 2002 16:57:19 -0000	1.1.2.23
***************
*** 643,647 ****
  	until (-f $choice) {
  	    $choice=showmessage($message, "free", 1);
! 	    unless (-f $choice) {
  		showmessage(getmessage('NotAFile', [$choice]),'PressEnter', '', 1);
  	    }
--- 643,649 ----
  	until (-f $choice) {
  	    $choice=showmessage($message, "free", 1);
! 	    if (-f $choice) {
! 		$::realhttpdconf=$choice;
! 	    } else {
  		showmessage(getmessage('NotAFile', [$choice]),'PressEnter', '', 1);
  	    }
***************
*** 662,666 ****
  	$::realhttpdconf=$confpossibilities[0];
      }
!     open (HTTPDCONF, $::realhttpdconf) or warn "Insufficient privileges to open $::realhttpdconf for reading.\n";
      while (<HTTPDCONF>) {
  	if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
--- 664,672 ----
  	$::realhttpdconf=$confpossibilities[0];
      }
!     unless (open (HTTPDCONF, $::realhttpdconf)) {
! 	warn "Insufficient privileges to open $::realhttpdconf for reading.\n";
! 	sleep 4;
!     }
! 
      while (<HTTPDCONF>) {
  	if (/^\s*User\s+"?([-\w]+)"?\s*$/) {
***************
*** 1110,1113 ****
--- 1116,1131 ----
  $messages->{'PrinterQueue'}->{en}="Printer Queue [%s]: ";
  $messages->{'PrinterName'}->{en}="Printer Name [%s]: ";
+ $messages->{'BlankMysqlPassword'}->{en}=qq|
+ ========================
+ = Blank MySql Password =
+ ========================
+ 
+ Do not leave your MySql root password blank unless you know exactly what you
+ are doing.  To change your MySql root password use the mysqladmin command:
+ 
+ mysqladmin password NEWPASSWORDHERE
+ 
+ Press <ENTER> to continue: 
+ |;
  
  sub databasesetup {
***************
*** 1147,1154 ****
  	$::mysqlpass_quoted = $::mysqlpass;
  	$::mysqlpass_quoted =~ s/"/\\"/g;
! 	my $result=system("$::mysqldir/bin/mysqladmin -u$::mysqluser -p\"$::mysqlpass_quoted\" proc > /dev/null 2>&1");
  	if ($result) {
  	    print getmessage('InvalidMysqlRootPassword');
  	} else {
  	    $needpassword=0;
  	}
--- 1165,1177 ----
  	$::mysqlpass_quoted = $::mysqlpass;
  	$::mysqlpass_quoted =~ s/"/\\"/g;
! 	$::mysqlpass_quoted="-p\"$::mysqlpass_quoted\"";
! 	$::mysqlpass eq '' and $::mysqlpass_quoted='';
! 	my $result=system("$::mysqldir/bin/mysqladmin -u$::mysqluser $::mysqlpass_quoted proc > /dev/null 2>&1");
  	if ($result) {
  	    print getmessage('InvalidMysqlRootPassword');
  	} else {
+ 	    if ($::mysqlpass eq '') {
+ 		showmessage(getmessage('BlankMysqlPassword'), 'PressEnter');
+ 	    }
  	    $needpassword=0;
  	}
***************
*** 1162,1170 ****
      } else {
  	# Populate the Koha database
! 	system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname < koha.mysql");
  	# Set up permissions
! 	system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" mysql -e \"insert into user (Host,User,Password) values ('$::hostname','$::user',password('$::pass'))\"\;");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" 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 ('%','$::dbname','$::user','Y','Y','Y','Y','Y','Y','Y','Y')\"");
! 	system("$::mysqldir/bin/mysqladmin -u$::mysqluser -p\"$::mysqlpass_quoted\" reload");
  
  
--- 1185,1193 ----
      } else {
  	# Populate the Koha database
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname < koha.mysql");
  	# Set up permissions
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted mysql -e \"insert into user (Host,User,Password) values ('$::hostname','$::user',password('$::pass'))\"\;");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted 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 ('%','$::dbname','$::user','Y','Y','Y','Y','Y','Y','Y','Y')\"");
! 	system("$::mysqldir/bin/mysqladmin -u$::mysqluser $::mysqlpass_quoted reload");
  
  
***************
*** 1190,1199 ****
      if ($response =~/^y/i) {
  	system("gunzip sampledata-1.2.gz");
! 	system("cat sampledata-1.2 | $::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname");
  	system("gzip -9 sampledata-1.2");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser -\"p$::mysqlpass_quoted\" $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main Library', 1)\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('Circulation Desk Printer', 'lp', 'hp')\"");
  	showmessage(getmessage('SampleDataInstalled'), 'PressEnter','',1);
      } else {
--- 1213,1222 ----
      if ($response =~/^y/i) {
  	system("gunzip sampledata-1.2.gz");
! 	system("cat sampledata-1.2 | $::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname");
  	system("gzip -9 sampledata-1.2");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('MAIN', 'Main Library', 1)\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
! 	system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('Circulation Desk Printer', 'lp', 'hp')\"");
  	showmessage(getmessage('SampleDataInstalled'), 'PressEnter','',1);
      } else {
***************
*** 1203,1207 ****
  	unless ($response =~/^n/i) {
  	    my $branch='Main Library';
- 	    print "Enter a name for the library branch [$branch]: ";
  	    $branch=showmessage(getmessage('BranchName', [$branch]), 'free', $branch, 1);
  	    $branch=~s/[^A-Za-z0-9\s]//g;
--- 1226,1229 ----
***************
*** 1212,1222 ****
  	    $branchcode=substr($branchcode,0,4);
  	    $branchcode=showmessage(getmessage('BranchCode', [$branchcode]), 'free', $branchcode, 1);
! 	    $branchcode=~s/[^A-Z]//g;
  	    $branchcode=uc($branchcode);
  	    $branchcode=substr($branchcode,0,4);
  
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\"");
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
  
  	    my $printername='Library Printer';
--- 1234,1245 ----
  	    $branchcode=substr($branchcode,0,4);
  	    $branchcode=showmessage(getmessage('BranchCode', [$branchcode]), 'free', $branchcode, 1);
! 	    $branchcode=~s/[^A-Za-z0-9]//g;
  	    $branchcode=uc($branchcode);
  	    $branchcode=substr($branchcode,0,4);
+ 	    $branchcode || $branchcode='DEF';
  
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\"");
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'IS')\"");
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into branchrelations (branchcode,categorycode) values ('MAIN', 'CU')\"");
  
  	    my $printername='Library Printer';
***************
*** 1227,1231 ****
  	    $printerqueue=showmessage(getmessage('PrinterQueue', [$printerqueue]), 'free', $printerqueue, 1);
  	    $printerqueue=~s/[^A-Za-z0-9]//g;
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser -p\"$::mysqlpass_quoted\" $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\"");
  
  	}
--- 1250,1254 ----
  	    $printerqueue=showmessage(getmessage('PrinterQueue', [$printerqueue]), 'free', $printerqueue, 1);
  	    $printerqueue=~s/[^A-Za-z0-9]//g;
! 	    system("$::mysqldir/bin/mysql -u$::mysqluser $::mysqlpass_quoted $::dbname -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\"");
  
  	}





More information about the Koha-cvs mailing list