source: fedkit/smbmount.pl @ b814529

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since b814529 was 3c7da22, checked in by Ted Faber <faber@…>, 17 years ago

Parameterize federate.sh and smbmount.pl (several parameters were hard wired)

make_hosts runs on deter nodes when DETER is the master testbed. It puts
all the federated hosts into /etc/hosts

  • Property mode set to 100755
File size: 1.7 KB
Line 
1#!/usr/local/bin/perl
2use IO::Handle;
3
4$TMCC="/usr/local/etc/emulab/tmcc";
5$SHARE=shift || "USERS";
6$PUSER=shift || "jhickey";
7$ADDR=shift || `cat /usr/local/etc/emulab/bossnode`;
8
9chomp $ADDR;
10print $ADDR;
11
12#
13# Do SMB Mounts
14#
15#system("umount -A -f -t nfs,smbfs"); # or die("Failed to unmount NFS");
16
17open(TM, "$TMCC -s $ADDR accounts windows |") or die("Failed to execute TMCC");
18
19# create a smb config to set  autoflush for smb config
20open(CONFIG, ">/etc/nsmb.conf") or die("Failed to open /etc/nsmb.conf");
21CONFIG->autoflush(1);
22
23print CONFIG "[$SHARE]\naddr=$ADDR\n\n";
24
25while(<TM>) {
26        if (/ADDUSER LOGIN=(\S+) PSWD=(\S+) UID=(\d+) GID=(\d+).*HOMEDIR=(\S+) / ) {
27                $user = $1;
28                $pswd = $2;
29                $uid  = $3;
30                $gid  = $4;
31                $homedir = $5;
32
33                $user =~  tr/a-z/A-Z/;
34                my $pass = `smbutil crypt '$pswd'`;
35
36                print CONFIG "[$SHARE:$user]\npassword=$pass\n";
37                print "mount_smbfs -N -f 744 -d 755 -u $uid -g $gid //$user\@$SHARE/$user $homedir\n";
38                system("mount_smbfs -N -f 744 -d 755 -u $uid -g $gid //$user\@$SHARE/$user $homedir");
39
40                if($user =~ m/$PUSER/i) {
41                        print "mount_smbfs -N -f 774 -d 755 -u $uid -g $gid //$user\@$SHARE/share /share\n";
42                        system("mount_smbfs -N -f 774 -d 755 -u $uid -g $gid //$user\@$SHARE/share /share");
43                        open(MOUNTS, "$TMCC -s $ADDR mounts |") or die("Failed to execute TMCC");
44                        while(<MOUNTS>) {
45                                if(/LOCAL=\/proj\/(\S+)/) {
46                                        print "mount_smbfs -N -f 774 -d 755 -u $uid -g $gid //$user\@$SHARE/proj-$1 /proj/$1\n";
47                                        system("mount_smbfs -N -f 774 -d 755 -u $uid -g $gid //$user\@$SHARE/proj-$1 /proj/$1");
48                                }
49                        }
50                }
51        }
52}
53
54close(CONFIG);
55
Note: See TracBrowser for help on using the repository browser.