]> andersk Git - moira.git/commitdiff
tsm.sh and Makefile.in goo to install it.
authorzacheiss <zacheiss>
Tue, 29 May 2007 18:49:15 +0000 (18:49 +0000)
committerzacheiss <zacheiss>
Tue, 29 May 2007 18:49:15 +0000 (18:49 +0000)
Make tsm.gen include membership of root list, and don't append @mit.edu
to USER entries; that was left over from an earlier incarnation.

gen/Makefile.in
gen/tsm.gen
gen/tsm.sh [new file with mode: 0755]

index 62271bcbe7caf69f4222ab796aea452700ae35d5..003ad76c5f2275a305ff2fa7bf97ffd82263e153 100644 (file)
@@ -47,7 +47,7 @@ SCRIPTS=access.gen access.sh acl.sh aliases.sh boot.sh ca.gen calendar.gen \
        ip-billing.sh ldap.gen longjobs.gen longjobs.sh mailhub.sh \
        mailman.gen mailman.sh nagios-printers.gen nagios-printers.sh ndb.sh \
        nfs.sh null.sh postoffice.sh print.sh sapprint.gen sapprint.sh \
-       spwatch.gen tsm.gen warehouse.gen warehouse.sh winstats.gen winstats.sh \
+       spwatch.gen tsm.gen tsm.sh warehouse.gen warehouse.sh winstats.gen winstats.sh \
        www.sh zephyr.sh install_dirs install_quotas zero_quotas
 
 .SUFFIXES: .pc .gen
index 2674471770a3599fc4e69a4ceb9c5abfa65a5d34..977cf586d194d0b223fed146d937ebbc350ff5e3 100755 (executable)
@@ -25,6 +25,37 @@ $sth0->execute;
 while (($root_list_id, $hostname) = $sth0->fetchrow_array) {
     open(OUT, ">$outdir/$hostname");
 
+    $sth = $dbh->prepare("SELECT l.name, l.gid FROM list l " .
+                        "WHERE l.list_id = " . 
+                        $dbh->quote($root_list_id)) || 
+                        exit $MR_DBMS_ERR;
+    $sth->execute;
+
+    while (($name, $gid) = $sth->fetchrow_array) {
+       $row = "$name:$gid:";
+       $row =~ s/\0//g;
+       print OUT $row;
+       $maybecomma = "";
+    }
+
+    $sth = $dbh->prepare("SELECT u.login FROM users u, imembers i " .
+                        "WHERE i.list_id = " . $dbh->quote($root_list_id) .
+                        "AND i.direct = 1 " .
+                        "AND i.member_type = 'USER' " .
+                        "AND u.users_id = i.member_id") || exit $MR_DBMS_ERR;
+    $sth->execute;
+
+    while (($login) = $sth->fetchrow_array) { 
+       $row = "$maybecomma$login";
+       $row =~ s/\0//g;
+       print OUT $row;
+       $maybecomma = ",";
+    }
+
+    $row = "\n";
+    $row =~ s/\0//g;
+    print OUT $row;
+
     $sth = $dbh->prepare("SELECT l.name, l.gid FROM list l, imembers i " .
                         "WHERE i.list_id = " . $dbh->quote($root_list_id) .
                         "AND i.member_type = 'LIST' " .
@@ -53,7 +84,6 @@ while (($root_list_id, $hostname) = $sth0->fetchrow_array) {
                                                  "WHERE users_id = " . 
                                                  $dbh->quote($id)) ||
                                                      exit $MR_DBMS_ERR;
-               $member = $member . "\@mit.edu";
            }
            elsif ($type eq "STRING") {
                ($member) = $dbh->selectrow_array("SELECT string " .
diff --git a/gen/tsm.sh b/gen/tsm.sh
new file mode 100755 (executable)
index 0000000..cbc6643
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+# $Id$
+
+outfile=/tsm-mit/data/tsmlists
+loadprog=/tsm-mit/bin/loadAdminTable.pl
+
+PATH="/etc:/bin:/usr/bin:/usr/etc:/usr/athena/etc"
+
+if [ -d /var/athena ] && [ -w /var/athena ]; then
+    exec >/var/athena/moira_update.log 2>&1
+else
+    exec >/tmp/moira_update.log 2>&1
+fi
+
+# The following exit codes are defined and MUST BE CONSISTENT with the
+# error codes the library uses:
+MR_MISSINGFILE=47836473
+MR_MKCRED=47836474
+
+if [ ! -f $outfile ]; then
+    exit $MR_MISSINGFILE
+fi
+
+if [ ! -x $loadprog ]; then
+    exit $MR_MISSINGFILE
+fi
+
+$loadprog
+
+if [ $? != 0 ]; then
+    exit $MR_MKCRED
+fi
+
+exit 0
This page took 0.08246 seconds and 5 git commands to generate.