1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#!/usr/bin/perl -w
#*****************************************************************************
#
# ooffice - Wrapper script for OpenOffice.org
#
# Based on the Mandrake work.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#*****************************************************************************
use strict;
use IO::Handle;
use Fcntl ':flock';
my $Debug = $ENV{OOO_DEBUG};
# Define the vendor of this particular OOo package
my $VendorName = 'Gentoo';
# Define system installation directory
# Autoconf totally sucks for @libdir@ type substitution
my $SystemInstallDir = 'INSTDIR';
# Suffix for parallel installable versioning
my $BinSuffix = '2';
# ooo-build version
my $OOO_BUILDVERSION = 'PV';
#=============================================================================
# Main
#=============================================================================
# Parse command line arguments
my @ooo_argv;
my $session_quickstart;
my $widgets_set;
while ($ARGV[0]) {
$_ = shift;
if (m/^--session-quickstart/) {
$session_quickstart = 1;
} elsif (m/^--widgets-set/) {
$widgets_set = shift;
(defined $widgets_set) || die "Error: The option --widgets-set requires a value\n" .
"For example: --widgets-set gtk\n";
} elsif (m/^--version/) {
print "This is OpenOffice.org $OOO_BUILDVERSION\n";
exit 0;
} else {
push @ooo_argv, $_;
}
}
if (!@ooo_argv) {
my $arg;
if ($0 =~ m/\/oo(calc|draw|impress|math|web|writer|base)$BinSuffix$/) {
$arg = "-$1";
} elsif ($0 =~ m/\/oofromtemplate$BinSuffix$/) {
$arg = "slot:5500";
}
if ($arg) {
push @ooo_argv, "$arg";
$Debug && print "Append arg: $arg\n";
}
} else {
$Debug && print "Ignoring type - since have filenames\n";
}
if (defined $widgets_set) {
$ENV{SAL_USE_VCLPLUGIN} = $widgets_set;
}
# overcome ghastly up-stream evilness
$ENV{SAL_NOEXPANDFPICKER}='TRUE';
if ($session_quickstart) {
$Debug && print "Execute quickstarter\n";
push @ooo_argv, '-quickstart';
}
# FIXME: the following two fixes should be done by OOo itself
# create the user config directory with safe rights 700 if it we find
# the right path and the directory does not exist
if (open BOOTSTRAPRC, "$SystemInstallDir/program/bootstraprc") {
while (my $line = <BOOTSTRAPRC>) {
chomp $line;
if (($line =~ m/^\s*UserInstallation\s*=\s*([^\s]*)\s*$/) && ($1)) {
my $userConfDir=$1;
$userConfDir =~ s|\$SYSUSERCONFIG|$ENV{HOME}|;
$userConfDir =~ s|file://||;
mkdir ($userConfDir,0700) unless (-d $userConfDir);
last;
}
}
close BOOTSTRAPRC;
}
# touch ~/.recently-used with safe rights 700 if it does not exist
if (! -f "$ENV{HOME}/.recently-used") {
open (RECENTLY_USED, ">$ENV{HOME}/.recently-used") &&
close RECENTLY_USED &&
chmod 0600, "$ENV{HOME}/.recently-used";
}
if (!(-f '/proc/version')) {
print STDERR "\n\n --- Warning - OO.o will not work without a mounted /proc filesystem --- \n\n\n";
}
# Clear PYTHONPATH, otherwise Python scripting does not work
delete $ENV{'PYTHONPATH'};
# And here we go.
exec "$SystemInstallDir/program/soffice", @ooo_argv
|