From: Nick J. <nje...@us...> - 2003-01-05 22:18:35
|
Update of /cvsroot/sandweb/sandweb/tools In directory sc8-pr-cvs1:/tmp/cvs-serv25339 Modified Files: install_script.pl instcachedir.pl Log Message: added some error checking in install scripts to help with permissions problems, and stuff. Index: install_script.pl =================================================================== RCS file: /cvsroot/sandweb/sandweb/tools/install_script.pl,v retrieving revision 1.17 retrieving revision 1.18 diff -U2 -r1.17 -r1.18 --- install_script.pl 23 Apr 2002 07:17:40 -0000 1.17 +++ install_script.pl 5 Jan 2003 22:18:32 -0000 1.18 @@ -14,7 +14,7 @@ "cachedir = $config::cachedir\n". "logdir = $config::logdir\n". - "httpuser = $config::httpuser\n"; - "expectbin = $config::expectbin\n"; - "cvs_bin = $config::cvs_bin\n"; + "httpuser = $config::httpuser\n". + "expectbin = $config::expectbin\n". + "cvs_bin = $config::cvs_bin\n". "ssh_bin = $config::ssh_bin\n"; @@ -39,4 +39,8 @@ $bindir = instbin($bindir, 'sandweb-admin'); $bindir = instbin($bindir, 'sandweb-expect'); + +# errors +my @errors = (); + exit(2) if (!$bindir); @@ -86,12 +90,13 @@ # Cache directory -my @return = instcachedir($cachedir, $httpuser); +my @return = instcachedir($cachedir, $httpuser, \@errors); if (@return) { ($cachedir, $httpuser) = @return; -} else { exit(5); } + @errors = @{$return[2]}; +} else { print "function instcachedir() failed\n"; exit(5); } # create log dir print "Creating SandWeb log file : $logdir/sandweb.log\n"; -system('tools/mkdirto.pl', '755', '0:0', $logdir); +system('tools/mkdirto.pl', '755', $logdir); my $httpuser_uid = &getuid($httpuser); system("touch", "$logdir/sandweb.log"); @@ -100,5 +105,5 @@ # install config file print "Installing SandWeb config file in $cfgdir\n"; -system('tools/mkdirto.pl', '755', '0:0', $cfgdir); +system('tools/mkdirto.pl', '755', $cfgdir); system('cp', 'etc/sandweb.cfg', "$cfgdir/sandweb.cfg"); system('cp', 'etc/repository.cfg', "$cfgdir/repository.cfg"); @@ -138,5 +143,5 @@ chown($httpuser_uid, 0, "$bindir/sandweb-admin"); # setguid for sandweb-admin - system("chmod", "u=rwxs,g=rx,o=", "$bindir/sandweb-admin"); + system("chmod", "u=rwx,g=rx,o=rx", "$bindir/sandweb-admin"); } else { print "unable to locate $bindir/sandweb-admin\n"; @@ -179,4 +184,16 @@ print "Installation complete!\n"; print "----------------------\n"; + +if (@errors) { + print "\n"; + print "----------------------------------\n"; + print "The following errors have occured:\n"; + print "----------------------------------\n"; + foreach my $error (@errors) { + print " * $error\n"; + } + print "\n"; +} + exit(0); @@ -187,4 +204,5 @@ open (PW, "</etc/passwd") or die "Unable to read password file\n"; foreach my $line (<PW>) { + next if ($line =~ /^\s*$/); if ($line =~ /^$user\:/) { ($junk, $junk2, $uid, $junk3) = split(':', $line, 4); Index: instcachedir.pl =================================================================== RCS file: /cvsroot/sandweb/sandweb/tools/instcachedir.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -U2 -r1.6 -r1.7 --- instcachedir.pl 28 Mar 2002 06:09:12 -0000 1.6 +++ instcachedir.pl 5 Jan 2003 22:18:32 -0000 1.7 @@ -7,4 +7,5 @@ return(0) if ((!$_[0]) && (!$_[1])); my ($cachedir, $httpuser) = @_; + my @errors = @{$_[2]}; my $verified = 0; @@ -38,17 +39,17 @@ if (system('tools/mkdirto.pl', '755', $httpuser . ':0', "$cachedir")) { - return(0); + push @errors, "Failed to set $cachedir read/write for $httpuser user."; } print("Creating SandWeb cache/data dir '$cachedir/data'...\n"); if (system('tools/mkdirto.pl', '750', $httpuser . ':0', "$cachedir/data")) { - return(0); + push @errors, "Failed to set $cachedir/data read/write for $httpuser user."; } print("Creating SandWeb cache/users dir '$cachedir/users'...\n"); if (system('tools/mkdirto.pl', '750', $httpuser . ':0', "$cachedir/users")) { - return(0); + push @errors, "Failed to set $cachedir/users read/write for $httpuser user."; } - return($cachedir, $httpuser); + return($cachedir, $httpuser, \@errors); } 1; |