version 1.6, 2004/10/18 19:05:34
|
version 1.9, 2005/07/01 23:17:58
|
Line 218 sub setup_www {
|
Line 218 sub setup_www {
|
############################################### |
############################################### |
############################################### |
############################################### |
sub uid_of_www { |
sub uid_of_www { |
my $num = `grep ^www /etc/passwd | cut -d':' -f3`; |
my ($num) = (getpwnam('www'))[2]; |
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"); |
|
return $num; |
return $num; |
} |
} |
|
|
Line 236 sub uid_of_www {
|
Line 229 sub uid_of_www {
|
############################################### |
############################################### |
sub build_and_install_mod_auth_external { |
sub build_and_install_mod_auth_external { |
my $num = &uid_of_www(); |
my $num = &uid_of_www(); |
# Patch mod_auth_external |
# Patch pwauth |
print_and_log("Building authentication system for LON-CAPA users.\n"); |
print_and_log("Building authentication system for LON-CAPA users.\n"); |
my $patch = <<"ENDPATCH"; |
my $patch = <<"ENDPATCH"; |
148c148 |
148c148 |
Line 247 ENDPATCH
|
Line 240 ENDPATCH
|
|
|
if (! -e "/usr/bin/patch") { |
if (! -e "/usr/bin/patch") { |
print_and_log("You must install the software development tools package ". |
print_and_log("You must install the software development tools package ". |
"when installing RedHat.\n"); |
"when installing Fedora.\n"); |
die; |
die; |
} |
} |
&die_if_nonempty(`cd /tmp; tar zxf $instdir/mod_auth_external-2.1.13.tar.gz`, |
&die_if_nonempty(`cd /tmp; tar zxf $instdir/pwauth-2.2.8.tar.gz`, |
"Unable to extract mod_auth_external\n"); |
"Unable to extract pwauth\n"); |
my $dir = "/tmp/mod_auth_external-2.1.13/pwauth"; |
my $dir = "/tmp/pwauth-2.2.8"; |
open PATCH, "| patch $dir/config.h" || |
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; |
print PATCH $patch; |
close PATCH; |
close PATCH; |
print_and_log("\n"); |
print_and_log("\n"); |
Line 270 END
|
Line 263 END
|
if ($result ne $expected) { |
if ($result ne $expected) { |
die "Unable to compile patched pwauth. Halting.\n"; |
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 |
# Install patched pwauth |
print_and_log("Copying pwauth to /usr/local/sbin\n"); |
print_and_log("Copying pwauth to /usr/local/sbin\n"); |
if (! copy "$dir/pwauth","/usr/local/sbin/pwauth") { |
if (! copy "$dir/pwauth","/usr/local/sbin/pwauth") { |
Line 319 sub setup_mysql {
|
Line 312 sub setup_mysql {
|
} |
} |
print_and_log("\n"); |
print_and_log("\n"); |
# |
# |
|
|
|
my ($mysqlinfo,$mysql_ver); |
|
open(PIPE,"/usr/bin/mysql -V |"); |
|
$mysqlinfo = <PIPE>; |
|
close(PIPE); |
|
if ($mysqlinfo =~ /Distrib\s+([\d]+)\./) { |
|
$mysql_ver = $1; |
|
} |
my $mysql_commands = "CREATE DATABASE loncapa;\n"; |
my $mysql_commands = "CREATE DATABASE loncapa;\n"; |
if ($setup_mysql_permissions) { |
if ($setup_mysql_permissions) { |
## |
## |
Line 331 to remember it.
|
Line 332 to remember it.
|
END |
END |
my $rootpass = <>; |
my $rootpass = <>; |
chomp $rootpass; |
chomp $rootpass; |
$mysql_commands .= <<"END"; |
$mysql_commands .= <<"BLOCKONE"; |
INSERT INTO user (Host, User, Password) |
INSERT INTO user (Host, User, Password) |
VALUES ('localhost','www',password('localhostkey')); |
VALUES ('localhost','www',password('localhostkey')); |
|
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'); |
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'); |
SET PASSWORD FOR root\@localhost=PASSWORD('$rootpass'); |
DELETE FROM user WHERE host<>'localhost'; |
DELETE FROM user WHERE host<>'localhost'; |
FLUSH PRIVILEGES; |
FLUSH PRIVILEGES; |