source: ProjectBuilder/devel/lib/common.pm@ 2

Last change on this file since 2 was 2, checked in by Bruno Cornec, 17 years ago

Initial check in coming from mondorescue project rewritten partially in perl

  • Property svn:executable set to *
File size: 725 bytes
Line 
1#!/usr/bin/perl -w
2#
3# Creates common environment
4#
5# $Id$
6#
7require Exporter;
8@ISA = qw(Exporter);
9@EXPORT = qw(set_env);
10
11use strict;
12use File::Basename;
13use ExtUtils::Command;
14use File::Temp qw /tempdir/;
15
16sub set_env {
17
18my $tmp = dirname($PROGRAM_NAME);
19#print "$tmp\n";
20if ($tmp =~ /^\//) {
21 $ENV{'TOOLHOME'} = $tmp;
22 }
23else {
24 $ENV{'TOOLHOME'} = "$ENV{PWD}/$tmp";
25 }
26
27die "TOOLHOME doesn't exist" if (not (defined $ENV{'TOOLHOME'}));
28
29# Adapt to your needs
30$ENV{'TOPDIR'}=$ENV{'TOOLHOME'}."/../delivery";
31mkpath $ENV{'TOPDIR'};
32
33if (undef $ENV{'TMPDIR'}) {
34 $ENV{'TMPDIR'}="/tmp";
35}
36$ENV{'PROJTMP'} = tempdir( "projbuild.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
37
38umask 0022
39}
401;
Note: See TracBrowser for help on using the repository browser.