Ignore:
Timestamp:
Feb 14, 2010 2:25:46 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
b7f6ccc
Parents:
d87778f
Message:

Moving toward the federation scripts that don't rely on tmcd forwarding.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/smbmount.FreeBSD.pl

    rd87778f rc0a8738  
    4040}
    4141
    42 open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     42# open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     43open(TM, "/usr/local/federation/etc/userconf")or die("Failed to open userconf");
    4344open(CONFIG, ">/etc/nsmb.conf") or die("Failed to open /etc/nsmb.conf");
    4445open(MAP, ">$AMDMAP") or die("Failed to open $AMDMAP");
     
    5253
    5354while(<TM>) {
    54         if (/ADDUSER LOGIN=(\S+) PSWD=(\S+) UID=(\d+) GID=(\d+).*HOMEDIR=(\S+) / ) {
    55                 $user = $1;
    56                 $pswd = $2;
    57                 $uid  = $3;
    58                 $gid  = $4;
    59                 $homedir = $5;
     55    /ADDUSER/ && do {
     56        /LOGIN=(\S+)/ && do { $user = $1; };
     57        /WPSWD=(\S+)/ && do { $pswd = $1; };
     58        /UID=(\S+)/ && do { $uid = $1; };
     59        /GID=(\S+)/ && do { $gid = $1; };
     60        /HOMEDIR=(\S+)/ && do { $homedir = $1; };
    6061
    61                 $userlc = $user;
    62                 # SMB demands upper case.
    63                 $user =~  tr/a-z/A-Z/;
    64                 my $pass = `smbutil crypt '$pswd'`;
     62        $userlc = $user;
     63        # SMB demands upper case.
     64        $user =~  tr/a-z/A-Z/;
     65        my $pass = `smbutil crypt '$pswd'`;
    6566
    66                 print CONFIG "[$SHARE:$user]\npassword=$pass\n";
    67                
    68                 if(! -d "$AMDROOT$homedir") {
    69                         system("$MKDIR -p $AMDROOT$homedir") && die("Failed to make directory");
    70                 }
     67        print CONFIG "[$SHARE:$user]\npassword=$pass\n";
     68       
     69        if(! -d "$AMDROOT$homedir") {
     70                system("$MKDIR -p $AMDROOT$homedir") &&
     71                    die("Failed to make directory");
     72        }
    7173
    72                 print FSTAB "//$user\@$SHARE/$user\t";
    73                 print FSTAB "$AMDROOT$homedir\tsmbfs\t";
    74                 print FSTAB "noauto,rw,-N,-f744,-d755,-u$uid,-g$gid\t0\t0\n";
     74        print FSTAB "//$user\@$SHARE/$user\t";
     75        print FSTAB "$AMDROOT$homedir\tsmbfs\t";
     76        print FSTAB "noauto,rw,-N,-f744,-d755,-u$uid,-g$gid\t0\t0\n";
    7577
    76                 print MAP "\n$userlc type:=program;fs:=$AMDROOT$homedir;\\\n";
    77                 print MAP "mount:=\"$MOUNT mount $AMDROOT$homedir\";\\\n";
    78                 print MAP "unmount:=\"$UMOUNT unmount $AMDROOT$homedir\";";
     78        print MAP "\n$userlc type:=program;fs:=$AMDROOT$homedir;\\\n";
     79        print MAP "mount:=\"$MOUNT mount $AMDROOT$homedir\";\\\n";
     80        print MAP "unmount:=\"$UMOUNT unmount $AMDROOT$homedir\";";
    7981
    80                 #
    81                 # If we are PUSER, the user assigned to mount the project directory,
    82                 # then we add in the mount for that.  The share is called proj-$PNAME
    83                 # where PNAME is the name of the project at the mothership.  We need
    84                 # a second map for this since we will be mounting under /proj.
    85                 # We should really not use share in federation.
    86                 #
     82        #
     83        # If we are PUSER, the user assigned to mount the project directory,
     84        # then we add in the mount for that.  The share is called proj-$PNAME
     85        # where PNAME is the name of the project at the mothership.  We need
     86        # a second map for this since we will be mounting under /proj.
     87        # We should really not use share in federation.
     88        #
    8789
    88                 if($user =~ m/$PUSER/i) {
    89                         print FSTAB "//$user\@$SHARE/proj-$PNAME\t";
    90                         print FSTAB "$AMDROOT/proj\tsmbfs\t";
    91                         print FSTAB "noauto,rw,-N,-f774,-d775,-u$uid,-g$gid\t0\t0\n";
     90        if($user =~ m/$PUSER/i) {
     91            print FSTAB "//$user\@$SHARE/proj-$PNAME\t";
     92            print FSTAB "$AMDROOT/proj\tsmbfs\t";
     93            print FSTAB "noauto,rw,-N,-f774,-d775,-u$uid,-g$gid\t0\t0\n";
    9294
    93                         print PMAP "$PNAME type:=program;fs:=$AMDROOT/proj;\\\n";
    94                         print PMAP "mount:=\"$MOUNT mount $AMDROOT/proj\";\\\n";
    95                         print PMAP "unmount:=\"$UMOUNT unmount $AMDROOT/proj\";\n";
     95            print PMAP "$PNAME type:=program;fs:=$AMDROOT/proj;\\\n";
     96            print PMAP "mount:=\"$MOUNT mount $AMDROOT/proj\";\\\n";
     97            print PMAP "unmount:=\"$UMOUNT unmount $AMDROOT/proj\";\n";
    9698
    97                         if(! -d "$AMDROOT/proj") {
    98                                 system("$MKDIR -p $AMDROOT/proj") && die("Failed to make directory");
    99                         }
    100                 }
    101         }
     99            if(! -d "$AMDROOT/proj") {
     100                    system("$MKDIR -p $AMDROOT/proj") &&
     101                        die("Failed to make directory");
     102            }
     103        }
     104    }
    102105}
    103106
Note: See TracChangeset for help on using the changeset viewer.