Ignore:
Timestamp:
Feb 14, 2010 2:25:46 PM (14 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.Linux.pl

    rd87778f rc0a8738  
    4343}
    4444
    45 open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     45# open(TM, "$TMCC accounts windows |") or die("Failed to execute TMCC");
     46open(TM, "/usr/local/federation/etc/userconf")or die("Failed to open userconf");
    4647open(FSTAB,">>$FSTAB") or die("Cannot Open File $FSTAB");
    4748
     
    4950
    5051while(<TM>) {
    51         if (/ADDUSER LOGIN=(\S+) PSWD=(\S+) UID=(\d+) GID=(\d+).*HOMEDIR=(\S+) / ) {
    52                 ($user, $pswd, $uid, $gid, $homedir) = ($1, $2, $3, $4, $5);
     52    /ADDUSER/ && do {
     53        /LOGIN=(\S+)/ && do { $user = $1; };
     54        /WPSWD=(\S+)/ && do { $pswd = $1; };
     55        /UID=(\S+)/ && do { $uid = $1; };
     56        /GID=(\S+)/ && do { $gid = $1; };
     57        /HOMEDIR=(\S+)/ && do { $homedir = $1; };
    5358
     59        open(PWDFILE, ">/tmp/$user.cifs_creds") ||
     60            warn "Can't create credentials for $user:$!\n";
     61        print PWDFILE "username=$user\npassword=$pswd\n";
     62        close(PWDFILE);
     63        chmod(0600, "/tmp/$user.cifs_creds") == 1 ||
     64            warn "Credential file /tmp/$user.cifs_creds may have " .
     65                "bad permissions:$!\n";
    5466
    55                 open(PWDFILE, ">/tmp/$user.cifs_creds") ||
    56                     warn "Can't create credentials for $user:$!\n";
    57                 print PWDFILE "username=$user\npassword=$pswd\n";
    58                 close(PWDFILE);
    59                 chmod(0600, "/tmp/$user.cifs_creds") == 1 ||
    60                     warn "Credential file /tmp/$user.cifs_creds may have " .
    61                         "bad permissions:$!\n";
     67        print FSTAB "//$SHARE/$user\t";
     68        print FSTAB "$homedir\tcifs\t";
     69        print FSTAB "auto,rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
    6270
    63                 print FSTAB "//$SHARE/$user\t";
    64                 print FSTAB "$homedir\tcifs\t";
    65                 print FSTAB "auto,rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
     71        #
     72        # If we are PUSER, the user assigned to mount the project
     73        # directory, then we add in the mount for that.  The share is
     74        # called proj-$PNAME where PNAME is the name of the project at
     75        # the mothership.  We need a second map for this since we will
     76        # be mounting under /proj.  We should really not use share in
     77        # federation.
     78        #
    6679
    67                 #
    68                 # If we are PUSER, the user assigned to mount the project
    69                 # directory, then we add in the mount for that.  The share is
    70                 # called proj-$PNAME where PNAME is the name of the project at
    71                 # the mothership.  We need a second map for this since we will
    72                 # be mounting under /proj.  We should really not use share in
    73                 # federation.
    74                 #
     80        if($user =~ m/$PUSER/i) {
     81            print FSTAB "//$SHARE/proj-$PNAME\t";
     82            print FSTAB "$PROJROOT/$PNAME\tcifs\t";
     83            print FSTAB "rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
    7584
    76                 if($user =~ m/$PUSER/i) {
    77                         print FSTAB "//$SHARE/proj-$PNAME\t";
    78                         print FSTAB "$PROJROOT/$PNAME\tcifs\t";
    79                         print FSTAB "rw,credentials=/tmp/$user.cifs_creds,ip=$ADDR\t0\t0\n";
    80 
    81                 }
    82         }
     85        }
     86    }
    8387}
    8488
Note: See TracChangeset for help on using the changeset viewer.