source: gs2-extensions/open-office/trunk/src/open-office-setup.pl@ 23704

Last change on this file since 23704 was 23704, checked in by ak19, 13 years ago

setup.pl file added so that gliserver.pl can call it to set up the environment for OpenOffice the way sourcing its setup.bash does.

File size: 1.2 KB
Line 
1
2BEGIN {
3 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
4 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
5 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
6 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
7}
8
9use Cwd;
10require util;
11
12my $env_ext = "GEXT_OPENOFFICE";
13my $ext_desc = "the Open Office Extension";
14
15if (!defined $ENV{$env_ext}) {
16
17 my $ext_home = cwd();
18 $ENV{$env_ext} = $ext_home;
19
20 my $ext_bin_script = &util::filename_cat($ENV{$env_ext},"bin","script");
21 if (-d $ext_bin_script) {
22 &util::envvar_prepend("PATH",$ext_bin_script);
23 }
24
25 my ($ext_dir,$_prefix_dir) = File::Basename::fileparse($ext_home);
26 # GSDLEXTS always uses : as a separator
27 if (defined $ENV{'GSDLEXTS'}) {
28 $ENV{'GSDLEXTS'} .= ":$ext_dir";
29 }
30 else {
31 $ENV{'GSDLEXTS'} = $ext_dir;
32 }
33
34 print STDERR "+Your environment is now setup for $ext_desc\n";
35}
36else {
37 print STDERR "+Your environment is already setup for $ext_desc\n";
38}
39
40if (scalar(@ARGV>0)) {
41
42 print STDERR "\n";
43
44 my $cmd = join(" ",map {$_ = "\"$_\""} @ARGV);
45
46 if (system($cmd)!=0) {
47 print STDERR "\nError: Failed to run '$cmd'\n";
48 print STDERR "$!\n";
49 }
50}
51
521;
Note: See TracBrowser for help on using the repository browser.