Changeset 2566


Ignore:
Timestamp:
2001-06-19T13:01:40+12:00 (23 years ago)
Author:
sjboddie
Message:

Added a -make_writable option to build script so the collector can tell it
to make new collections globally writable (allowing them to be removed
from the command line on Unix installations)

Location:
trunk/gsdl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/build

    r2488 r2566  
    168168    print STDOUT "   -out                    Filename or handle to print output status to.\n";
    169169    print STDOUT "                           The default is STDERR\n";
     170    print STDOUT "   -make_writable          If set build will make the collection and any\n";
     171    print STDOUT "                           temporary files it created globally writable after\n";
     172    print STDOUT "                           it finishes\n";
    170173    print STDOUT "   -log_events             Log important events (collection built successfully\n";
    171174    print STDOUT "                           etc.) to event_log_file\n";
     
    548551             'save_archives', \$save_archives,
    549552             'out/.*/STDERR', \$out,
     553             'make_writable', \$make_writable,
    550554             'log_events', \$log_events,
    551555             'event_log_file/.*/', \$event_log_file,
     
    558562    }
    559563}
     564
     565
     566END {
     567
     568    if ($make_writable) {
     569    # chmod a+rw new collection
     570    my $installed_collection = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection);
     571    &recursive_chmod($installed_collection);
     572
     573    # chmod a+rw anything we've left laying about in the tmp directory
     574    if (($collectdir ne "") && 
     575        (!&util::filenames_equal ($collectdir, &util::filename_cat($ENV{'GSDLHOME'}, "collect")))) {
     576        &recursive_chmod($collectdir);
     577    }
     578    }
     579
     580    sub recursive_chmod {
     581    my ($dir) = @_;
     582    return unless -d $dir;
     583
     584    chmod (0777, $dir);
     585
     586    opendir (DIR, $dir) || die;
     587    my @files = readdir DIR;
     588    closedir DIR;
     589   
     590    foreach my $file (@files) {
     591        next if $file =~ /^\.\.?$/;
     592        $file = &util::filename_cat($dir, $file);
     593        if (-d $file) {
     594        &recursive_chmod ($file);
     595        } else {
     596        chmod (0777, $file);
     597        }
     598    }
     599    }
     600}
  • trunk/gsdl/src/recpt/collectoraction.cpp

    r2558 r2566  
    16501650   
    16511651  // set up build options
    1652   text_t options = "-remove_import -out \"";
     1652  text_t options = "-make_writable -remove_import -out \"";
    16531653  options += filename_cat (tmpdir, collection + ".bld");
    16541654  options += "\" -collectdir \"" + get_collectdir (args) + "\"";
Note: See TracChangeset for help on using the changeset viewer.