diff --git a/textarchive/lib/TA/ObjReg.pm b/textarchive/lib/TA/ObjReg.pm index 7307572f4d1fbbdb13f1f00681893ca7c896a0be..77f65719e7700f70b85226c06afcbbfec8d82f2f 100644 --- a/textarchive/lib/TA/ObjReg.pm +++ b/textarchive/lib/TA/ObjReg.pm @@ -67,7 +67,15 @@ sub _get_project_paths { my $proj_name= shift; - my $proj_cfg_dir= join ('/', $ENV{'TABASE'}, 'projects', $proj_name); + my $proj_cfg_dir; + if (exists ($ENV{'TAPROJ'})) + { + $proj_cfg_dir = join ('/', $ENV{'TAPROJ'}, $proj_name); + } + else + { + $proj_cfg_dir = join ('/', $ENV{'TABASE'}, 'projects', $proj_name); + } my $proj_cfg_fnm= join ('/', $proj_cfg_dir, 'config.json'); return ($proj_cfg_dir, $proj_cfg_fnm); diff --git a/textarchive/vlib001.pl b/textarchive/vlib001.pl index 50fdcd7f41504806cbf4c34203256b29bed002c2..42d7532142c92ade5c83eff40dc5e96563ca1c96 100755 --- a/textarchive/vlib001.pl +++ b/textarchive/vlib001.pl @@ -32,9 +32,12 @@ =head1 DESCRIPTION Updates a file catalog using md5cat library methods and registers the -files in the project's object registry. The environment variable TABASE -must point to the directory where the object registry's configuration -is stored. +files in the project's object registry. Either the environment variable +TAPROJ or TABASE must point to the directory where the object registry's +configuration is stored. The configuration is named either + $ENV{'TAPROJ'}/<project>/config.json +or + $ENV{'TABASE'}/projects/<project>/config.json =head1 BACKENDS @@ -122,14 +125,25 @@ while (my $arg= shift (@ARGV)) print "debug level: $DEBUG\n"; -&usage ('environment variable TABASE not set') unless (exists ($ENV{'TABASE'})); +my $TAPROJ; +if (exists ($ENV{'TAPROJ'})) +{ + $TAPROJ= $ENV{'TAPROJ'}; +} +else +{ + &usage ('environment variable TAPROJ or TABASE not set') unless (exists ($ENV{'TABASE'})); + $TAPROJ= join ('/', $ENV{'TABASE'}, 'projects'); +} + # &usage ('no project specified') unless (defined ($project)); unless (defined ($project)) { print "no project specified; check these:\n"; - system ("ls -ls \"$ENV{'TABASE'}/projects\""); + system ('ls -ls "$TAPROJ"'); exit (2); } + # &usage ('no store specified') unless (defined ($store)); if ($op_mode eq 'edit') @@ -157,7 +171,8 @@ if ($op_mode eq 'refresh') my $store_cfg= $stores_p->{$store}; unless (defined ($store_cfg)) { - print "no store config found for '$store', check these: ", Dumper ($stores_p); + print "no store config found", (($store) ? " for '$store'" : ''), "; check these: ", join (', ', sort keys %$stores_p), "\n"; + print "or use --edit to find out more\n"; exit (2); } @@ -630,9 +645,13 @@ __END__ locate all the stores on a given machine, so there should be an option that updates everything. * specifing the store should be optional. + * environment variable TAPROJ: + * add pod section + * allow command line option to specify alternative base directory name * environment variable TABASE: * add pod section * allow command line option to specify alternative base directory name + * maybe a better name than TAPROJ (or even TABASE) would make sense =head2 misc