From 8f07d7f084fb392d8068c9bbb79977ac58518238 Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Tue, 22 Jan 2008 22:03:07 +0000 Subject: [PATCH] Allow data_dir to be configured at install time to decouple tinderbox data from cgi installation. Bug #409052 r=bear --- webtools/tinderbox/Makefile | 22 ++++++++++++++++------ webtools/tinderbox/tbglobals.pl | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/webtools/tinderbox/Makefile b/webtools/tinderbox/Makefile index 603755f0fd8..8efeaefbdb6 100755 --- a/webtools/tinderbox/Makefile +++ b/webtools/tinderbox/Makefile @@ -33,6 +33,12 @@ #TINDERBOX_DIR = /var/www/html/tinderbox +# Directory for passwd file & transient data +DATA_DIR = data +ifeq (,$(filter /%,$(DATA_DIR))) +DATA_DIR := $(TINDERBOX_DIR)/$(DATA_DIR) +endif + # Set these to the user/group that will run the tinderbox processes #TINDERBOX_USER = tinderbox #TINDERBOX_GROUP = tinderbox @@ -111,6 +117,7 @@ install: echo Installing $$I && \ sed -e s#/usr/bonsaitools/bin/perl#$(PERL)#g \ -e s#@CVSROOT@#$(CVSROOT)#g \ + -e s#@DATA_DIR@#$(DATA_DIR)#g \ -e s#@TINDERBOX_DIR@#$(TINDERBOX_DIR)#g \ -e s#@SETUID_PATH@#$(SETUID_PATH)#g \ $$I > $(TINDERBOX_DIR)/$$I && \ @@ -122,13 +129,15 @@ install: cp $$I $(TINDERBOX_DIR) && \ chmod 644 $(TINDERBOX_DIR)/$$I; \ done - mkdir -p $(TINDERBOX_DIR)/data/bad chown -R $(TINDERBOX_USER) $(TINDERBOX_DIR) chgrp -R $(TINDERBOX_GROUP) $(TINDERBOX_DIR) chmod 755 $(TINDERBOX_DIR) - chmod 770 $(TINDERBOX_DIR)/data - chmod 770 $(TINDERBOX_DIR)/data/bad chmod 770 $(TINDERBOX_DIR)/examples + mkdir -p $(DATA_DIR)/bad + chown -R $(TINDERBOX_USER) $(DATA_DIR) + chgrp -R $(TINDERBOX_GROUP) $(DATA_DIR) + chmod 770 $(DATA_DIR) + chmod 770 $(DATA_DIR)/bad chmod 755 $(addprefix $(TINDERBOX_DIR)/,$(EXE_FILES)) chmod 4755 $(addprefix $(TINDERBOX_DIR)/,$(SETUID_SCRIPTS)) @@ -136,6 +145,7 @@ define READPASS $(PERL) -e ' \ use Digest::MD5 qw(md5_hex); \ use Term::ReadKey; \ +umask(027); \ open(PASSWD, ">$1") or die "$1:$$!\n"; \ print "Enter the new admin password: "; \ ReadMode("noecho"); \ @@ -147,6 +157,6 @@ close(PASSWD);' endef genpasswd: - @$(call READPASS,$(TINDERBOX_DIR)/data/passwd) - @chown $(TINDERBOX_USER) $(TINDERBOX_DIR)/data/passwd - @chgrp $(TINDERBOX_USER) $(TINDERBOX_DIR)/data/passwd + @$(call READPASS,$(DATA_DIR)/passwd) + @chown $(TINDERBOX_USER) $(DATA_DIR)/passwd + @chgrp $(TINDERBOX_USER) $(DATA_DIR)/passwd diff --git a/webtools/tinderbox/tbglobals.pl b/webtools/tinderbox/tbglobals.pl index 6f02bfc8bec..3a39cedb2f6 100755 --- a/webtools/tinderbox/tbglobals.pl +++ b/webtools/tinderbox/tbglobals.pl @@ -55,7 +55,7 @@ $::CI_LOG=11; # Variables set from Makefile $::default_cvsroot = "@CVSROOT@"; -$::data_dir='data'; +$::data_dir='@DATA_DIR@'; $::tree_dir = 'trees'; $::static_rel_path = '../../'; if ( ! -d "$::tree_dir/." ) { @@ -131,7 +131,7 @@ sub make_tree_list { return @::global_tree_list if defined(@::global_tree_list); foreach my $t (<$::tree_dir/*>) { $t =~ s@^$::tree_dir/@@; - if (-d "$::tree_dir/$t" && $t ne "$::data_dir" && $t ne 'CVS' && -f "$::tree_dir/$t/treedata.pl") { + if (-d "$::tree_dir/$t" && -f "$::tree_dir/$t/treedata.pl") { push @::global_tree_list, $t; } }