--- doc/install/fedora/install.pl 2003/12/12 22:06:08 1.3 +++ doc/install/fedora/install.pl 2005/07/01 23:17:58 1.9 @@ -2,7 +2,7 @@ # The LearningOnline Network # Fedora installation script # -# $Id: install.pl,v 1.3 2003/12/12 22:06:08 matthew Exp $ +# $Id: install.pl,v 1.9 2005/07/01 23:17:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,7 +35,7 @@ my $test; # note: The filehandle LOG is global. open LOG,">>loncapa_install.log" || die "Unable to open log file.\n"; -print LOG '$Id: install.pl,v 1.3 2003/12/12 22:06:08 matthew Exp $'."\n"; +print LOG '$Id: install.pl,v 1.9 2005/07/01 23:17:58 raeburn Exp $'."\n"; # Some friendly subroutines sub die_if_nonempty { @@ -180,7 +180,7 @@ if ($install_httpd_conf) { } #my $lctarball = 'loncapa-current.tar.gz'; -my $lctarball = 'loncapa-fedora-1.0.99.2.tar.gz'; +my $lctarball = 'loncapa-fedora-current.tar.gz'; if ($download_loncapa) { &download_loncapa($lctarball); } else { @@ -218,14 +218,7 @@ sub setup_www { ############################################### ############################################### sub uid_of_www { - my $num = `grep ^www /etc/passwd | cut -d':' -f3`; - chomp $num; - if (int($num) == $num) { - writelog ("uid of www = $num\n"); - } else { - die "Unable to determine UID of user www\n Halting.\n"; - } - print_and_log("\n"); + my ($num) = (getpwnam('www'))[2]; return $num; } @@ -236,7 +229,7 @@ sub uid_of_www { ############################################### sub build_and_install_mod_auth_external { my $num = &uid_of_www(); - # Patch mod_auth_external + # Patch pwauth print_and_log("Building authentication system for LON-CAPA users.\n"); my $patch = <<"ENDPATCH"; 148c148 @@ -247,14 +240,14 @@ ENDPATCH if (! -e "/usr/bin/patch") { print_and_log("You must install the software development tools package ". - "when installing RedHat.\n"); + "when installing Fedora.\n"); die; } - &die_if_nonempty(`cd /tmp; tar zxf $instdir/mod_auth_external-2.1.13.tar.gz`, - "Unable to extract mod_auth_external\n"); - my $dir = "/tmp/mod_auth_external-2.1.13/pwauth"; + &die_if_nonempty(`cd /tmp; tar zxf $instdir/pwauth-2.2.8.tar.gz`, + "Unable to extract pwauth\n"); + my $dir = "/tmp/pwauth-2.2.8"; open PATCH, "| patch $dir/config.h" || - die "Unable to start patch for mod_auth_external. Halting\n"; + die "Unable to start patch for pwauth. Halting\n"; print PATCH $patch; close PATCH; print_and_log("\n"); @@ -270,7 +263,7 @@ END if ($result ne $expected) { die "Unable to compile patched pwauth. Halting.\n"; } - print_and_log( "appearant success compiling pwauth:\n".$result ); + print_and_log( "apparent success compiling pwauth:\n".$result ); # Install patched pwauth print_and_log("Copying pwauth to /usr/local/sbin\n"); if (! copy "$dir/pwauth","/usr/local/sbin/pwauth") { @@ -319,6 +312,14 @@ sub setup_mysql { } print_and_log("\n"); # + + my ($mysqlinfo,$mysql_ver); + open(PIPE,"/usr/bin/mysql -V |"); + $mysqlinfo = ; + close(PIPE); + if ($mysqlinfo =~ /Distrib\s+([\d]+)\./) { + $mysql_ver = $1; + } my $mysql_commands = "CREATE DATABASE loncapa;\n"; if ($setup_mysql_permissions) { ## @@ -331,11 +332,20 @@ to remember it. END my $rootpass = <>; chomp $rootpass; - $mysql_commands .= <<"END"; + $mysql_commands .= <<"BLOCKONE"; INSERT INTO user (Host, User, Password) VALUES ('localhost','www',password('localhostkey')); -INSERT INTO db VALUES ('localhost','loncapa','www', -'Y','Y','Y','Y','Y','Y','N','Y','Y','Y'); +BLOCKONE + if ($mysql_ver < 4) { + $mysql_commands .=<<"BLOCKTWO"; +INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv) VALUES ('localhost','loncapa','www','Y','Y','Y','Y','Y','Y','N','Y','Y','Y'); +BLOCKTWO + } else { + $mysql_commands .=<<"BLOCKTHREE"; +INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv) VALUES ('localhost','loncapa','www','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); +BLOCKTHREE + } + $mysql_commands .=<<"END"; SET PASSWORD FOR root\@localhost=PASSWORD('$rootpass'); DELETE FROM user WHERE host<>'localhost'; FLUSH PRIVILEGES; @@ -400,7 +410,7 @@ You seem to have a version of loncapa-cu This copy will be used and a new version will NOT be downloaded. If you wish, you may download a new version by executing: -wget http://install.loncapa.org/versions/loncapa-current.tar.gz +wget http://install.loncapa.org/versions/loncapa-fedora-current.tar.gz ------------------------------------------------------------------------ END