# Lookup volume type
($c = $cell) =~ s/\./_/g;
-$vtype = eval "\$vtypes_$c{$type}";
+$vtype = eval "\$vtypes_${c}{$type}";
die "Cannot create $type volumes in $cell\n" unless $vtype;
$vname = $vtype . "." . $locker;
$vname =~ s/[^-A-Za-z0-9_.]//g; # strip out illegal characters
-# Find free space
-($asrv,$apart) = &afs_find($cell,$type,$quota);
-die "Unable to find space to create $vname in $cell\n" unless ($asrv&&$apart);
-
-# Create volume
-system("$vos create $asrv $apart $vname -cell $cell >/dev/null") &&
- &fatal("Unable to create $vname in $cell");
+# Find free space/Create volume
+$tries = 0; $code = 1;
+while ($tries<3 && $code) {
+ ($asrv,$apart) = &afs_find($cell,$type,$quota,@except);
+ die "Unable to find space to create $vname in $cell\n" unless ($asrv&&$apart);
+ $code = system("$vos create $asrv $apart $vname -cell $cell >/dev/null");
+ push(@except, $asrv);
+ $tries++;
+}
+&fatal("Unable to create $vname in $cell") if ($code); # Too many create errors
push(@clean, "$vos remove $asrv $apart $vname -cell $cell >/dev/null");
# Create mountpoint and set quota
close(FS);
&fatal("Can't get information about $p") if ($?);
@tmp = (split(/ /,$_));
-system("$vos release $tmp[$#tmp] -cell $cell >/dev/null") &&
- &fatal("Can't release $tmp[$#tmp] in cell $cell");
+if ($tmp[$#tmp] !~ /user\../) {
+ system("$vos release $tmp[$#tmp] -cell $cell >/dev/null") &&
+ &fatal("Can't release $tmp[$#tmp] in cell $cell");
+}
-&afs_quota_adj($cell,$asrv,$apart,$quota);
+# Update the quota records.
+&afs_quota_adj($cell,$asrv,$apart,$quota,0);
exit(0);
sub fatal
# CONTRIB <user> all system:anyuser rl
# COURSE <user> all <group> all system:facdev all system:authuser rl
# HOMEDIR <user> all
+ # LEASE <user> all
+ # ORG <user> all <group> all system:cwisfac all system:anyuser rl
# PROJECT <user> all <group> all
# REF <user> all system:anyuser rl
# SW <user> all system:swmaint all system:authuser rl
@acl=("system:expunge ld");
push(@acl,"system:facdev all") if ($type =~ /^(COURSE|UROP)/);
push(@acl,"system:swmaint all") if ($type =~ /^(SW)/);
+ push(@acl,"system:cwisfac all") if ($type =~ /^(ORG)/);
push(@acl,"system:administrators all") if ($type =~ /^(SYSTEM)/);
push(@acl,"$user all")
- if ($uid != 0 && $type =~ /^(ACTIVITY|APROJ|AREF|CONTRIB|COURSE|HOMEDIR|PROJECT|REF|SW|UROP)/);
+ if ($uid != 0 && $type =~ /^(ACTIVITY|APROJ|AREF|CONTRIB|COURSE|HOMEDIR|LEASE|ORG|PROJECT|REF|SW|UROP)/);
push(@acl,"system:$group all")
- if ($gid != 0 && $type =~ /^(ACTIVITY|APROJ|COURSE|PROJECT|UROP)/);
+ if ($gid != 0 && $type =~ /^(ACTIVITY|APROJ|COURSE|ORG|PROJECT|UROP)/);
push(@acl,"system:$group rl") if ($gid != 0 && $type =~ /^(AREF)/);
push(@acl,"system:authuser rl")
if ($type =~ /^(COURSE|SW|UROP)/);
push(@acl,"system:anyuser rl")
- if ($type =~ /^(ACTIVITY|APROJ|CONTRIB|REF|SYSTEM)/);
+ if ($type =~ /^(ACTIVITY|APROJ|CONTRIB|ORG|REF|SYSTEM)/);
- if ($type !~ /^(AREF|SYSTEM)/) {
+ if ($type !~ /^(AREF|ORG|SYSTEM)/) {
system("$fs mkm $path/OldFiles $vname.backup");
warn "$locker: Unable to create OldFiles mountpoint\n" if ($?);
}
if ($type =~ /ACTIVITY|APROJ|PROJECT/) {
- chown($gid,0,$path) ||
- die "Unable to set volume ownership\n";
+ system("/moira/bin/uchown $path $gid");
+ die "Unable to set volume ownership\n" if ($?);
} elsif ($type =~ /HOMEDIR|UROP/) {
chown($uid,0,$path) ||
die "Unable to set volume ownership\n";
}
+ if ($type eq "COURSE") {
+ mkdir("$path/www",0755) &&
+ chown(0,0,"$path/www") ||
+ die "Unable to create subdirectories\n";
+ system("$fs sa $path/www @acl system:anyuser rl -clear") &&
+ die "Unable to set acl on www directory\n";
+
+ system("$fs sa $path @acl system:anyuser l -clear") &&
+ die "Unable to set acl on top-level directory\n";
+ return;
+ }
+
if ($type eq "HOMEDIR") {
die "Unable to get uid for user\n" unless ($uid);
- mkdir("$path/Public",0755) && chown($uid,0,"$path/Public") &&
+ chmod(0755, $path);
+ mkdir("$path/Public",0755) && mkdir("$path/www",0755) &&
mkdir("$path/Private",0700) && mkdir("$path/Mail", 0700) &&
- chown($uid,0,"$path/Public","$path/Private","$path/Mail") ||
- die "Unable to create subdirectories\n";
- system("$fs sa $path/Public @acl system:anyuser rl -clear") &&
+ chown($uid,0,"$path/Public","$path/www",
+ "$path/Private","$path/Mail") ||
+ die "Unable to create subdirectories\n";
+ system("$fs sa -dir $path/Public $path/www -acl @acl system:anyuser rl -clear") &&
die "Unable to set acl on Public directory";
system("$fs sa -dir $path/Private $path/Mail -acl @acl -clear") &&
die "Unable to set acl on Private and/or Mail directories\n";