Commit 3eadc480 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Minor fixes to regular expressions.

parent e9005e54
......@@ -66,7 +66,7 @@ if ($_ =~ /^FREE/) {
print STDOUT " Free!\n";
exit(0);
}
if ($_ =~ /ALLOCATED=(\w*)\/(\w*)/) {
if ($_ =~ /ALLOCATED=([-\@\w.]*)\/([-\@\w.]*)/) {
print STDOUT " Allocated: $1/$2!\n";
$project = $1;
}
......@@ -190,7 +190,7 @@ open(TM, "$TMCC $NODE $ACCTCMD |")
or die "Cannot start $TMCC: $!";
while (<TM>) {
if ($_ =~ /^ADDGROUP NAME=([0-9a-zA-Z]+) GID=([0-9]+)/) {
if ($_ =~ /^ADDGROUP NAME=([-\@\w.]+) GID=([0-9]+)/) {
print STDOUT " Group: $1/$2\n";
$group = $1;
......@@ -219,14 +219,22 @@ while (<TM>) {
$name = $1;
}
print STDOUT " User: $login/$uid/$gid/$root/$name\n";
($exists) = getpwuid($uid);
if ($exists) {
if ($root) {
$GLIST = "-G wheel,$gid";
}
else {
$GLIST = "-G $gid";
}
system("$PW usermod $login $GLIST");
next;
}
$GLIST = " ";
if ($root) {
$GLIST = "-G wheel ";
$GLIST = "-G wheel";
}
if (system("$PW useradd $login -u $uid -g $gid $GLIST ".
......
......@@ -19,6 +19,7 @@ my $DELAYCMD = "delay";
my $IFCONFIG = "/sbin/ifconfig eth%d inet %s netmask %s\n";
my $CP = "/bin/cp -f";
my $USERADD = "/usr/sbin/useradd";
my $USERMOD = "/usr/sbin/usermod";
my $GROUPADD = "/usr/sbin/groupadd";
my $IFACE = "eth";
my $CTLIFACE = "eth4";
......@@ -66,7 +67,7 @@ if ($_ =~ /^FREE/) {
print STDOUT " Free!\n";
exit(0);
}
if ($_ =~ /ALLOCATED=(\w*)\/(\w*)/) {
if ($_ =~ /ALLOCATED=([-\@\w.]*)\/([-\@\w.]*)/) {
print STDOUT " Allocated: $1/$2!\n";
$project = $1;
}
......@@ -122,7 +123,7 @@ open(TM, "$TMCC $NODE $ACCTCMD |")
or die "Cannot start $TMCC: $!";
while (<TM>) {
if ($_ =~ /^ADDGROUP NAME=([0-9a-zA-Z]+) GID=([0-9]+)/) {
if ($_ =~ /^ADDGROUP NAME=([-\@\w.]+) GID=([0-9]+)/) {
print STDOUT " Group: $1/$2\n";
$group = $1;
......@@ -151,8 +152,16 @@ while (<TM>) {
$name = $1;
}
print STDOUT " User: $login/$uid/$gid/$root/$name\n";
($exists) = getpwuid($uid);
if ($exists) {
if ($root) {
$GLIST = "-G root,$gid";
}
else {
$GLIST = "-G $gid";
}
system("$USERMOD $GLIST $login");
next;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment