diff --git a/GNUmakefile.in b/GNUmakefile.in index 14fb173145b04dec4d01a196c954cdab20710518..1e1c2ff16d77b04b78dc868335597d387525332c 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -23,6 +23,7 @@ boss-install: install-subdirs install-mkdirs @echo "DON'T FORGET TO RUN A POST-INSTALL AS ROOT" post-install: + @$(MAKE) -C db post-install @$(MAKE) -C ipod post-install @$(MAKE) -C tbsetup post-install @$(MAKE) -C security post-install diff --git a/configure b/configure index 9c7ad31a82e4467631f673d43344cbadbb69c375..b6404e56e81fc5356729144b21331bb6926b4ebc 100755 --- a/configure +++ b/configure @@ -925,7 +925,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ assign/GNUmakefile \ capture/GNUmakefile \ db/GNUmakefile db/nalloc db/nfree db/if2port db/backup \ - db/webcontrol db/node_status discvr/GNUmakefile \ + db/webcontrol db/node_status db/genelists discvr/GNUmakefile \ db/libdb.pm \ ipod/GNUmakefile \ lib/GNUmakefile \ diff --git a/configure.in b/configure.in index feb631b874c9bbae7c0afc3718d0e9e65d96ffe8..419d3f1773be4bf5dec3c31a4cb00cea3261fe47 100755 --- a/configure.in +++ b/configure.in @@ -98,7 +98,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ assign/GNUmakefile \ capture/GNUmakefile \ db/GNUmakefile db/nalloc db/nfree db/if2port db/backup \ - db/webcontrol db/node_status discvr/GNUmakefile \ + db/webcontrol db/node_status db/genelists discvr/GNUmakefile \ db/libdb.pm \ ipod/GNUmakefile \ lib/GNUmakefile \ diff --git a/db/GNUmakefile.in b/db/GNUmakefile.in index 6dcf66844926c923f002cfa9d15f2ce6a157b536..3a43bbbc7a19a777133a8aa5e299a71e6fb957d5 100644 --- a/db/GNUmakefile.in +++ b/db/GNUmakefile.in @@ -9,7 +9,8 @@ SUBDIR = db include $(OBJDIR)/Makeconf BIN_SCRIPTS = mac2if nalloc nfree nodeip -SBIN_SCRIPTS = avail inuse showgraph if2port backup webcontrol node_status +SBIN_SCRIPTS = avail inuse showgraph if2port backup webcontrol node_status \ + genelists LIBEXEC_SCRIPTS = ptopgen LIB_SCRIPTS = libdb.pm @@ -29,6 +30,10 @@ install: $(addprefix $(INSTALL_BINDIR)/, $(BIN_SCRIPTS)) \ $(addprefix $(INSTALL_LIBDIR)/, $(LIB_SCRIPTS)) \ $(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_SCRIPTS)) +post-install: + chown root $(INSTALL_SBINDIR)/genelists + chmod u+s $(INSTALL_SBINDIR)/genelists + # # Control node installation (okay, plastic) # diff --git a/db/genelists.in b/db/genelists.in new file mode 100644 index 0000000000000000000000000000000000000000..711dd8f439ca831fe4e8bac0c84f15ac91956cef --- /dev/null +++ b/db/genelists.in @@ -0,0 +1,82 @@ +#!/usr/bin/perl -wT +use English; +#use Getopt::Std; + +sub usage() { + print STDOUT "Usage: genelists\n". + "Generate the email list files after things change\n"; + exit(-1); +} +my $optlist = ""; + +# Configure variables +my $TB = "@prefix@"; +my $TBOPS = "@TBOPSEMAIL@"; + +my $lockfile = "/var/tmp/testbed_genelists_lockfile"; +my $active = 0; +my $userlist = 0; + +my $d = 0; + +if (@ARGV != 0) { usage(); } + +$| = 1; # Turn off line buffering on output + +# Load the Testbed support stuff. +push(@INC, "$TB/lib"); +require libdb; + +foreach $active ( 0, 1 ) { + + if ($active) { + print "Getting Active Users\n" if $d; + # All active users on the testbed + if (! ($query_result = + DBQuery("SELECT DISTINCT u.usr_email from experiments as e ". + "left join proj_memb as p on e.pid=p.pid ". + "left join users as u on u.uid=p.uid ". + "where u.status='active' order by u.usr_email")) + ) { + DBFatal("Getting Active Users!"); + } + $userlist = "testbed-ops\@flux.cs.utah.edu +testbed-active-users-archive\@flux.cs.utah.edu\n"; + open(LIST,">/mnt/usr/site/lib/lists/testbed-active-users") || + die("Couldn't open testbed-active-users: $!\n"); + print "Opened testbed-active-users\n" if $d; + } else { + print "Getting All Users\n" if $d; + # All approved users on the testbed + if (!($query_result = + DBQuery("SELECT DISTINCT usr_email FROM users ". + "where status='active' order by usr_email")) + ) { + DBFatal("Getting Users!"); + } + $userlist = "testbed-ops\@flux.cs.utah.edu +testbed-users-archive\@flux.cs.utah.edu\n"; + open(LIST,">/mnt/usr/site/lib/lists/testbed-users") || + die("Couldn't open testbed-users: $!\n"); + print "Opened testbed-users list\n" if $d; + } + + for ($i = 0; $i < $query_result->numrows; $i++) { + $user_email = ($query_result->fetchrow_array())[0]; + if (! defined($user_email)) { next; } + if ($userlist) { $userlist .= "$user_email\n"; } + else { $userlist = "$user_email\n"; } + } + print LIST $userlist; + print $userlist if $d; + close(LIST); +} + +exit 0; + +sub fatal { + local($msg) = $_[0]; + system("echo \"$msg\" | /usr/bin/mail ". + "-s 'TESTBED: Failure Generating Email Lists' $TBOPS"); + die($msg); +}