home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- #
- # Copyright (C) Ready-to-Run Software, Inc. 1991, 1992, 1993.
- # Groton, MA 01450.
- #
- # All Rights Reserved.
- #
- # This Module contains Proprietary Information of
- # Ready-to-Run Software, Inc.
- #
- # Ready-to-Run Software, Inc. is a software service company. Most
- # of the software provided to our customers is "publically
- # available"; we provide the service of locating and building
- # the software for you. In general, you may make as many copies
- # as you want of the software that we deliver to you (individual
- # package license information is provided during the installation
- # process). The major exception to that is Ready-to-Run Software's
- # "Smart Installation System". We view the installation system
- # and the proprietary techniques used in it, as the vehicle that
- # allows us to effectively deliver our services to you. Accordingly:
- #
- # Use of this "Smart Installation System" is limited as follows:
- #
- # 1) by anyone, to install a SAMPLE ReadyPak(tm) from
- # Ready-to-Run Software, Inc.
- # 2) by a ReadyPak Purchaser to install a ReadyPak obtained from
- # Ready-to-Run Software, Inc. on any machine within your
- # organization.
- # 3) It may not be copied or otherwise distributed without written
- # permission from Ready-to-Run Software, Inc.
- #
- # $Id: build,v 1.2 1993/01/16 14:05:15 jeff Exp jeff $
- #
- # $Log: build,v $
- # Revision 1.2 1993/01/16 14:05:15 jeff
- # Actual release version
- #
- # Revision 1.1 1992/12/18 02:34:10 jeff
- # Initial revision
- #
- #
- $0 =~ m|(.*/)(.*)|, $PROG = $2; $EXECDIR = $1; # find program name
-
- # set up some necessary constants and defaults
- $TRUE = 1;
- $FALSE = 0;
- $SYMLINK_EXISTS = (eval 'symlink("","");', $@ eq '' );
-
- $MACHINE = shift @ARGV;
- $CDROM = shift @ARGV;
- $SourcePak = $TRUE;
-
- $[ = 0; # set array base to 0
- $, = ' '; # set output field separator
- $\ = "\n"; # set output record separator
-
- $TESTING = $FALSE; # Should be FALSE when we ship
-
- $INFO = 1;
- $START = 1;
- $PROCESS = 2;
- $END = 3;
-
- $DEFAULT = 1;
- $REQUIRED = 2;
- $OPTIONAL = 3;
-
- $SIG{'INT'} = $SIG{'TERM'} = 'abort';
-
- chop($workdir = `pwd`);
- die( "You don't have write permission in: $workdir\n" ) if ! -w $workdir;
-
- # figure out the naming conventions on the CDROM
- $UPPER = 1;
- $REVISION = 2;
- $DOT = 4;
- $UPPERZ = 8;
- $NAMEFAULT = 16;
- for ($NAMING = 0 ; $NAMING < 16 ; $NAMING++) {
- last if -f &iso9660("config1") &&
- -f &iso9660("config2.rev") &&
- -f &iso9660("config3.Z");
- }
- die "Can't determine CDROM naming conventions\n" if $NAMING >= $NAMEFAULT;
-
- # start processing
- open(PAKS, &iso9660("COMMON/PACKAGES"));
-
- local($PAKname);
- while (<PAKS>) {
- undef @packages; $pak_cnt = 0;
- chop;
- $PAKname = $_;
- while (<PAKS>) {
- chop;
- last if $_ eq '';
- @field = split;
- next if $field[1] eq 'S' && !$SourcePak;
- next if $field[1] eq 'R' && $SourcePak;
- next if $field[1] eq 'T' && $SourcePak;
- $packages[$pak_cnt++] = $field[0];
- $packages{$field[0]} = $TRUE;
- $fullname{&standard($field[0])} = $field[0];
- }
- next if defined(%pak) && !defined($pak{$PAKname});
- }
-
- if (defined $packages{$ARGV[0]}) {
- $buildtype = 'L.X';
- $buildtype = 'U.X', $up = 'UPPER'
- if ($NAMING & $UPPER);
- $buildtype .= 'D' if ($NAMING & $DOT);
- $buildtype .= 'Z' if ($NAMING & $UPPERZ);
- $buildtype .= 'R' if ($NAMING & $REVISION);
- $buildtype =~ s/X(\w)/$1/;
-
- exec( &iso9660s('SOURCES/'.&standard($ARGV[0])."/BUILD$buildtype") ." $MACHINE");
- }
-
- printf( STDERR "\nBUILD is available for the following packages:\n\n" );
- for $p (sort keys %packages) {
- $line = sprintf( "$line%-13s", $p );
- printf("$line\n"), $line='', $cnt=0 if (++$cnt == 6);
- }
- printf "$line\n" if $cnt;
- printf "\n";
-
- exit 0;
-
- sub iso9660 {
- local( $path ) = @_;
- $path =~ s:($CDROM/|;1$)::g;
- if ($NAMING & $UPPER) {
- $path =~ tr/a-z+!\-/A-Z_/;
- }
- else {
- $path =~ tr/A-Z+!\-/a-z_/;
- }
- if ($path !~ /\*$/) {
- if ($NAMING & $DOT) {
- $path .= '.' if $path !~ /(.*\/)?.*\./;
- }
- $path .= ';1' if $NAMING & $REVISION;
- }
- $path =~ s/\.z/\.Z/ if $NAMING & $UPPERZ;
-
- return "$CDROM/$path";
- }
-
- sub iso9660s {
- local( $path ) = @_;
- ($path = &iso9660($path)) =~ s/;/\\;/g;
- return $path;
- }
-
- #
- # Subroutines
- #
-
- sub abort {
- local($reason) = @_;
- warn("$reason\n");
- exit 1;
- }
-
-
- sub standard {
- local($name) = @_;
- ($name = substr($name,0,8)) =~ tr/A-Z/a-z/;
- return $name;
- }
-