$NetBSD: patch-bg,v 1.4 2005/05/29 14:38:33 wiz Exp $

--- progs/glupart/glupart_script.pl.orig	1997-11-05 23:30:11.000000000 +0100
+++ progs/glupart/glupart_script.pl
@@ -73,7 +73,7 @@ my $gl_reservationFile = "$gl_dataDir/re
 my $gl_lockFile = "$gl_dataDir/glupart.lock";
 my $gl_logFile = "$gl_dataDir/reservation-log";
 my $gl_tmpFile = "$gl_dataDir/.__glupart$$-tmp";
-my $gl_emailAdmin = "glunix-admin\@now.CS.Berkeley.EDU";
+my $gl_emailAdmin = "root";
 my $gl_datePath = "/bin/date";
 my $gl_emailPath = "%%MAIL_PATH%%";
 
@@ -134,7 +134,7 @@ sub usage {
     my($pager);
 
     &unlock();
-    open(USAGE, "|/usr/sww/bin/less") || open(USAGE, "|/bin/less") ||
+    open(USAGE, "|/usr/bin/less") || open(USAGE, "|/bin/less") ||
 	open(USAGE, "|/bin/more") || open(USAGE, ">&STDOUT");
     print USAGE $str;
     print USAGE "---------------------------------------\n";
@@ -1489,7 +1489,8 @@ sub my_mkdir {
 	    $tmp = "$tmp/$s";
 	    if (!(-e $tmp)) {
 		print "Creating directory $tmp\n";
-		mkdir($tmp, 0755);
+                mkdir $tmp, 0755 || die("$!");
+		system("/usr/sbin/chown glunix:glunix $tmp");
 	    }
 	}
     }
@@ -1499,12 +1500,13 @@ sub my_touch {
     my(@files) = @_;
     my($f);
 
-    umask 0755;
+    umask 0022;
     foreach $f (@files) {
 	if (!(-e $f)) {
 	    open(TOUCHFD,">$f");
 	    close(TOUCHFD);
 	    print "Created file $f\n";
+	    system("/usr/sbin/chown glunix:glunix $f");
 	}
     }
 }
@@ -1993,13 +1995,23 @@ if ($command eq "help" || $command eq "h
 }
 
 if ($command eq "install") {
-    if ($> != 0) {
+    my $tid = $>;
+
+    if ($< != 0) {
 	print STDERR "You must be root to do \"glupart install\"\n";
 	exit(-2);
     }
+    if ($< == 0 && $> != 0) {
+        $> = $<;
+    }
     &my_mkdir($gl_dataDir);
     &my_touch($gl_machineFile, $gl_groupFile, $gl_aliasFile,
 	      $gl_reservationFile, $gl_lockFile, $gl_logFile);
+
+    if ($> != $tid) {
+        $> = $tid;
+    }
+
     exit(0);
 }
 
