2 eval 'exec perl -wS $0 ${1+"$@"}'
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: smoketest.pl,v $
16 # This file is part of OpenOffice.org.
18 # OpenOffice.org is free software: you can redistribute it and/or modify
19 # it under the terms of the GNU Lesser General Public License version 3
20 # only, as published by the Free Software Foundation.
22 # OpenOffice.org is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU Lesser General Public License version 3 for more details
26 # (a copy is included in the LICENSE file that accompanied this code).
28 # You should have received a copy of the GNU Lesser General Public License
29 # version 3 along with OpenOffice.org. If not, see
30 # <http://www.openoffice.org/license.html>
31 # for a copy of the LGPLv3 License.
33 #*************************************************************************
36 # smoketest - do the smoketest
39 use lib
("$ENV{SOLARENV}/bin/modules");
46 ########################
50 #########################
51 $is_debug = 0; # run without executing commands
52 $is_command_infos = 0; # print command details before exec
53 $is_protocol_test = 0;
54 $is_remove_on_error = 0;
55 $is_remove_at_end = 1;
57 $is_without_msiexec = 1;
61 $temp_path = $ENV{TEMP
};
64 $FileURLPrefix = "file:///";
65 $userinstalldir = "UserInstallation";
67 $prefered_lang = "en-US";
68 $global_instset_mask = "";
69 $smoketest_install = $ENV{SMOKETESTINSTALLSET
};
72 print "The workstamp is missing. Please use setsolar\n";
76 if (($gui eq "WNT") and ($ENV{USE_SHELL
} ne "4nt")) {
80 if (!defined($temp_path) and (($gui eq "UNX") or ($gui eq $cygwin))) {
81 $temp_path = $ENV{TMPDIR
};
82 if (!defined($temp_path) and (-d
"/tmp")) {
87 if (defined($ENV{INSTALLPATH_SMOKETEST
})) {
88 $installpath_without = $ENV{INSTALLPATH_SMOKETEST
};
91 $installpath_without = $temp_path;
94 if (!defined($installpath_without)) {
95 print "Your temp value is missing. Please set your temp-variable or define INSTALLPATH_SMOKETEST\n\n";
99 if (!((defined($ENV{UPDATER
})) and ($ENV{UPDATER
} eq "YES") and !defined($ENV{CWS_WORK_STAMP
})) ) {
100 $is_protocol_test = 0;
104 $PathSeparator = '\\';
105 $NewPathSeparator = ';';
106 $dos = "$ENV{COMSPEC} -c";
107 $PERL = "$dos $ENV{PERL}";
108 $REMOVE_DIR = "$dos del /qsxyz";
109 $REMOVE_FILE = "$dos del";
110 $LIST_DIR = "$dos ls";
111 $COPY_FILE = "$dos copy";
112 $COPY_DIR = "$dos copy /s";
114 $RENAME_FILE = "ren";
116 $RESPFILE="response_fat_wnt";
117 $SVERSION_INI = $ENV{USERPROFILE
} . $PathSeparator . "Anwendungsdaten" . $PathSeparator . "sversion.ini";
118 $SOFFICEBIN = "soffice.exe";
119 $bootstrapini = "bootstrap.ini";
120 $bootstrapiniTemp = $bootstrapini . "_";
121 $packpackage = "msi";
122 $installpath_without =~ s/\//\\/g
;
124 elsif ($gui eq "UNX") {
125 $is_do_deinstall = 0;
126 $PathSeparator = '/';
127 $NewPathSeparator = ':';
129 $PERL = "$ENV{PERL}";
130 $REMOVE_DIR = "rm -rf";
131 $REMOVE_FILE = "rm -f";
133 $COPY_FILE = "cp -f";
136 $nul = '> /dev/null';
137 $RESPFILE="response_fat_unx";
138 $SVERSION_INI = $ENV{HOME
} . $PathSeparator . ".sversionrc";
139 $bootstrapini = "bootstraprc";
140 $bootstrapiniTemp = $bootstrapini . "_";
141 $packpackage = $ENV{PKGFORMAT
};
142 $SOFFICEBIN = "soffice";
143 if ($ENV{OS
} eq "MACOSX") {
144 $COPY_DIR = "cp -RPfp";
147 $COPY_DIR = "cp -rf";
150 elsif ($gui eq $cygwin) {
151 $PathSeparator = '/';
152 $NewPathSeparator = ':';
154 $PERL = "$ENV{PERL}";
155 $REMOVE_DIR = "rm -rf";
156 $REMOVE_FILE = "rm -f";
158 $COPY_FILE = "cp -f";
159 $COPY_DIR = "cp -rf";
162 $nul = '> /dev/null';
163 $RESPFILE="response_fat_wnt";
164 $SVERSION_INI = $ENV{USERPROFILE
} . $PathSeparator . "Anwendungsdaten" . $PathSeparator . "sversion.ini";
165 $SOFFICEBIN = "soffice";
166 $bootstrapini = "bootstrap.ini";
167 $bootstrapiniTemp = $bootstrapini . "_";
168 $CygwinLineends = $/;
169 $WinLineends = "\r\n";
170 $packpackage = "msi";
171 $installpath_without =~ s/\\/\//g
;
174 print_error
("not supported system\n",1);
177 if ($is_without_msiexec) {
178 require installer
::windows
::admin
; import installer
::windows
::admin
;
179 $installer::globals
::logfilename
= $ENV{DMAKE_WORK_DIR
} . $PathSeparator . $ENV{OUTPATH
} . $ENV{PROEXT
} . $PathSeparator . "misc" . $PathSeparator . "installer.log";
180 $installer::globals
::exithandler
= \
&install_error
;
184 @install_list = ( 'instsetoo_native'
188 @install_list = ( 'instset_native'
192 @error_messages = ( '',
193 'lock flag for pkgadd still exist. Installation not possible!',
194 'Error during installation!',
195 'Error: patching configuration failed!',
196 'Error: starting office failed or office crashed!',
197 'Error during testing',
198 'can not copy extension',
199 'Error in setup log',
200 'installationsset is not complete',
201 'can not copy all basic scripts',
202 'can not patch bottstrapini',
203 'msiexec failed. Maybe you have got an installed version',
204 'deinstallation is incomplete',
205 'this packformat is not supported for this environment',
206 'can not set execute permission'
209 my $show_NoMessage = 0;
210 my $show_Message = 1;
212 my $error_logflag = 1;
214 my $error_patchConfig = 3;
215 my $error_startOffice = 4;
216 my $error_testResult = 5;
217 my $error_copyExtension = 6;
218 my $error_setup_log = 7;
219 my $error_installset = 8;
220 my $error_copyBasic = 9;
221 my $error_patchBootstrap = 10;
222 my $error_msiexec = 11;
223 my $error_deinst = 12;
224 my $error_packformat = 13;
225 my $error_permission = 14;
227 my $command_normal = 0;
228 my $command_withoutErrorcheck = 1;
229 my $command_withoutOutput = 2;
232 $PRODUCT="OpenOffice";
235 $PRODUCT="StarOffice";
238 if (($ENV{PKGFORMAT
} eq "installed") and (!defined ($ENV{FORCE2ARCHIVE
}))) {
239 $packpackage = $ENV{PKGFORMAT
}; # take it for all environments
241 elsif (defined ($ENV{FORCE2ARCHIVE
})) {
242 $packpackage = "archive"; # take it for all environments
244 $StandDir = $ENV{SOLARSRC
} . $PathSeparator;
245 $SHIP = defined $ENV{SHIPDRIVE
} ?
$ENV{SHIPDRIVE
} . $PathSeparator : "shipdrive_not_set";
246 $PORDUCT = "$SHIP$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator";
247 $DATA="$ENV{DMAKE_WORK_DIR}$PathSeparator" . "data$PathSeparator";
248 $WORK_STAMP_LC=$ENV{WORK_STAMP
};
249 $WORK_STAMP_LC =~ tr/A-Z/a-z/;
250 $ENV{DBGSV_INIT
} = $DATA . "dbgsv.ini";
251 $ExtensionDir = $ENV{DMAKE_WORK_DIR
} . $PathSeparator . $ENV{OUTPATH
} . $ENV{PROEXT
} . $PathSeparator . "bin" . $PathSeparator;
253 if (defined($vcsid)) {
254 $installpath_without .= $PathSeparator . $vcsid;
257 $installpath_without .= $PathSeparator . "StarOffice";
260 $installpath_without .= $PathSeparator . "OpenOffice";
263 $installpath = $installpath_without . $PathSeparator;
264 $installpath = glob $installpath;
266 $ENV{STAR_REGISTRY
}="";
275 $is_remove_at_end = 0; # do not remove installation
278 $milestone = $ARGV[0];
287 ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
289 $id_str = ' $Revision: 1.35 $ ';
290 $id_str =~ /Revision:\s+(\S+)\s+\$/
291 ?
($script_rev = $1) : ($script_rev = "-");
293 print "$script_name -- version: $script_rev\n";
299 if ($is_do_deinstall) {
300 deinstallInstallation
($installpath);
302 removeOldInstallation
($installpath);
303 save_sversion
($SVERSION_INI);
306 ($INSTSETNAME, $INSTALLSET) = getInstset
();
308 print "Install: $INSTALLSET$INSTSETNAME\n";
313 restore_sversion
($SVERSION_INI);
314 if ($is_remove_at_end) {
315 if ($is_do_deinstall) {
316 deinstallInstallation
($installpath);
318 removeInstallation
($installpath);
321 print_notRemoved
($installpath);
324 print "smoketest successful!\n";
327 #########################
331 #########################
334 my ($startDir, $DirArray_ref, $mask) = @_;
336 opendir(DIR
,"$startDir");
337 while($dir = readdir(DIR
)) {
338 if (($dir =~ /\.$/) or ($dir !~ /$mask/)) {
341 push (@
{$DirArray_ref}, "$dir");
348 my ($startDir, $DirArray_ref) = @_;
350 opendir(DIR
,"$startDir");
351 while($dir = readdir(DIR
)) {
352 if (($dir !~ /\.$/) and ( -d
"$startDir$dir") ) {
353 push (@
{$DirArray_ref}, "$dir");
360 sub getSubDirsFullPath
{
361 my ($startDir, $DirArray_ref) = @_;
363 opendir(DIR
,"$startDir");
364 while($dir = readdir(DIR
)) {
365 if (($dir !~ /\.$/) and ( -d
"$startDir$dir") ) {
366 push (@
{$DirArray_ref}, "$startDir$dir");
374 my ($DirArray_ref) = @_;
375 my (@sortedArray, $dir, $instdir);
376 @sortedArray = sort langsort @
{$DirArray_ref};
377 print "Langs: @sortedArray\n" if $is_command_infos;
378 foreach $dir (@sortedArray) {
379 if ($dir =~ /log$/) {
389 my ($base, $name) = @_;
391 opendir(DIR
, $base) or die "cannot open dir $base";
392 while ($f = readdir(DIR
)) {
393 push @res, "$base" if $f eq $name;
395 -d
"$base$f" && ! -l
"$base$f" && $f ne '.' && $f ne '..';
399 push @res, findMultiple
("$base$f$PathSeparator", $name);
405 my ($base, $name) = @_;
406 my @res = findMultiple
($base, $name);
407 die "no unique $name in $base" unless @res == 1;
413 $ENV{ignore_patch_check
}="t";
414 $ENV{OOO_FORCE_DESKTOP
} = "none";
419 sub is_Installset_ok
{
420 my ($installpath, $installname) = @_;
421 my ($is_ok, $infile);
423 $infile = $INSTALLSET. "log$PathSeparator";
424 $infile =~ s/_pre_//;
425 $infile =~ s/[\/\\]normal[\/\\]//;
426 $infile =~ s/\.(\d+)$/_$1\.html/;
427 #if ($installname =~ /(?:_pre_){0,1}(.*)\.(\d+)/) {
428 # $infile .= "$1_$2.html";
429 # print "protocol: $infile\n" if $is_debug;
431 open INTABLE
, "<$infile" or return errorFromOpen
($infile);
434 if ( $line =~ />(error)(.*)</ ) {
435 print "ERROR: $1$2\n";
445 print "ERROR: can't open $file\n";
451 my (@Params, $basedir, $basisdir, $branddir);
453 # check installset (error 8)
455 if (($INSTSETNAME ne "") and $is_protocol_test) {
456 if (!is_Installset_ok
("$PORDUCT", $INSTSETNAME)) {
457 print_error
($error_messages[$error_installset], $error_installset);
461 # install office (error 2)
463 $basedir = doInstall
("$INSTALLSET$INSTSETNAME$PathSeparator", $installpath);
464 $basisdir = findUnique
($basedir, 'ure-link');
465 $branddir = findUnique
($basedir, 'basis-link');
466 if ( (defined($ENV{OS
})) && ($ENV{OS
} eq "MACOSX") ) {
467 $programpath = "$branddir". "MacOS$PathSeparator";
470 $programpath = "$branddir". "program$PathSeparator";
472 $userinstallpath_without = $installpath . $userinstalldir;
473 $userinstallpath = $userinstallpath_without . $PathSeparator;
474 $userpath = "$userinstallpath" . "user$PathSeparator";
475 $basicpath = $userpath . "basic$PathSeparator";
476 $standardbasicpath = "$basisdir" . "presets$PathSeparator" . "basic$PathSeparator";
477 $LOGPATH="$userinstallpath" . "user" . $PathSeparator . "temp";
480 $Command = "chmod -R 777 \"$basedir\"*";
481 execute_system
("$Command");
484 # check setup log file (error 7)
486 # $Command = "$PERL check_setup.pl \"$programpath" . "setup.log\"";
487 # execute_Command ($Command, $error_setup_log, $show_Message, $command_normal );
489 # patch config (error 3)
491 $Command = "$PERL config.pl \"$basisdir \" \"$branddir \" \"$userinstallpath \" \"$DATA \" \"$buildid\"";
492 execute_Command
($Command, $error_patchConfig, $show_Message, $command_normal );
494 # copy basicscripts (error 9)
496 $Command = "$COPY_FILE \"$DATA" . "scripts$PathSeparator" . "\"*.x* \"$standardbasicpath" . "Standard$PathSeparator\"";
497 execute_Command
($Command, $error_copyBasic, $show_Message, $command_withoutOutput);
499 createPath
("$basicpath", $error_copyBasic);
500 $Command = "$COPY_DIR \"$standardbasicpath\"* \"$basicpath\"";
501 execute_Command
($Command, $error_copyBasic, $show_Message, $command_withoutOutput);
503 # patching bootstrap (error 11)
505 if (!patch_bootstrap
("$programpath$bootstrapini", "$programpath$bootstrapiniTemp")) {
506 print_error
($error_messages[$error_patchBootstrap], $error_patchBootstrap);
509 # copy extension (error 6)
511 createPath
($LOGPATH, $error_copyExtension);
512 $Command = "$COPY_FILE \"$ExtensionDir" . "TestExtension.oxt\" " . "\"$LOGPATH$PathSeparator\"";
513 execute_Command
($Command, $error_copyExtension, $show_Message, $command_withoutOutput);
516 # start office (error 4)
518 print "starting office ($INSTSETNAME)\n";
520 $Command = "\"$programpath" . "$SOFFICEBIN\" -no-oosplash -norestore -nocrashreport macro:///Standard.Global.StartTestWithDefaultOptions";
521 if ( (defined($ENV{OS
})) && ($ENV{OS
} eq "MACOSX") ) {
522 $Command = "cd \"$programpath\"; " . $Command;
524 execute_Command
($Command, $error_startOffice, $show_Message, $command_normal);
526 # test if smoketest is ok (error 5)
528 $Command = "$PERL testlog.pl \"$LOGPATH\"";
529 execute_Command
($Command, $error_testResult, $show_Message, $command_normal);
531 # deinstall office (error 6)
533 if ($is_remove_at_end) {
534 print "Deinstalling Office\n";
536 # $Command = "$PERL deinstall.pl \"$LOGPATH\" \"$installpath\"";
537 # execute_Command ($Command, $error_deinstall, $show_NoMessage, $command_normal);
541 print_error
($error_messages[$error_setup], $error_setup);
545 my ($installsetpath, $dest_installdir) = @_;
546 my ($DirArray, $mask, $file, $Command, $optdir, $rpmdir, $system, $mach, $basedir, $output_ref, $olddir, $newdir);
547 if (($ENV{PKGFORMAT
} eq "installed") and (!defined($ENV{FORCE2ARCHIVE
}))) {
548 createPath
($dest_installdir, $error_setup);
549 $Command = "$COPY_DIR \"$installsetpath\" \"$dest_installdir\"";
550 execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
552 getSubDirsFullPath
($dest_installdir, \
@DirArray);
553 if ($#DirArray == 0) {
554 $basedir = $DirArray[0] . $PathSeparator;
556 elsif ($#DirArray == -1) {
557 print_error
($error_setup, $show_Message);
560 $basedir = $dest_installdir;
563 elsif (($gui eq "WNT") or ($gui eq $cygwin)) {
564 if (defined($ENV{FORCE2ARCHIVE
})) {
565 print_error
($error_messages[$error_packformat], $error_packformat);
568 getSubFiles
("$installsetpath", \
@DirArray, $mask);
569 if ($#DirArray == -1) {
570 print_error
("Installationset in $installsetpath is incomplete", 2);
572 foreach $file (@DirArray) {
573 if ($is_without_msiexec) {
575 print "Debugmode: no installation from $installsetpath\n";
578 createPath
($dest_installdir, $error_setup);
579 installer
::windows
::admin
::make_admin_install
($installsetpath . $file, $dest_installdir);
580 if ($gui eq $cygwin) {
581 $Command = "find $dest_installdir \\( -name \"installhelper\" -prune -o -name \"*.exe\" -o -name \"*.dll\" -o -name \"*.manifest\" -o -name \"*.bin\" -o -name \"*.jar\" \\) -exec chmod a+x {} \\;";
582 execute_Command
($Command, $error_permission, $show_Message, $command_normal);
588 if ($gui eq $cygwin) {
589 my $convertinstallset = ConvertCygwinToWin_Shell
("$installsetpath$file");
590 my $convertdestdir = ConvertCygwinToWin_Shell
($dest_installdir);
591 $_inst_cmd=$ENV{SMOKETEST_SOINSTCMD
};
592 if ( defined($_inst_cmd) ) {
593 $Command = $_inst_cmd . " $convertinstallset -qn TARGETDIR=$convertdestdir";
596 $Command = "msiexec.exe /a $convertinstallset -qn TARGETDIR=$convertdestdir ALLUSERS=2";
600 $_inst_cmd=$ENV{SMOKETEST_SOINSTCMD
};
601 if ( defined($_inst_cmd) ) {
602 $Command = $_inst_cmd . " $installsetpath$file -qn TARGETDIR=$dest_installdir";
605 $Command = "msiexec.exe /a $installsetpath$file -qn TARGETDIR=$dest_installdir ALLUSERS=2";
608 execute_Command
($Command, $error_msiexec, $show_Message, $command_normal);
611 $basedir = $dest_installdir;
613 elsif ($gui eq "UNX") {
614 $system = `uname -s`;
618 if (defined ($ENV{EPM
}) && ($ENV{EPM
} eq 'NO')) { # do the install ourselves ...
619 # FIXME - this tool should work nicely without such hacks
620 # cut/paste from ooo-build/bin/ooinstall
621 my $instoo_dir = "$ENV{SRC_ROOT}/instsetoo_native";
623 if ( $ENV{'SYSTEM_MOZILLA'} eq 'YES' ) {
624 if (defined $ENV{'LD_LIBRARY_PATH'}) {
625 $ENV{'LD_LIBRARY_PATH'} =
626 "$ENV{'LD_LIBRARY_PATH'}:$ENV{'MOZ_LIB'}";
628 $ENV{'LD_LIBRARY_PATH'} = $ENV{'MOZ_LIB'};
631 $ENV{'PYTHONPATH'} = "$ENV{SRC_ROOT}/instsetoo_native/$ENV{INPATH}/bin:$ENV{SOLARVERSION}/$ENV{INPATH}/lib";
632 $ENV{OUT
} = "../$ENV{INPATH}";
633 $ENV{LOCAL_OUT
} = "../$ENV{INPATH}";
634 $ENV{LOCAL_COMMON_OUT
} = "../$ENV{INPATH}";
635 my $sane_destdir = $dest_installdir;
636 $sane_destdir .= "oootest";
637 createPath
($sane_destdir, $error_setup);
638 $Command = "cd $instoo_dir/util ; perl -w $ENV{SOLARENV}/bin/make_installer.pl " .
639 "-f openoffice.lst -l en-US -p OpenOffice " .
640 "-buildid \"smoketestoo\" -simple $sane_destdir";
641 # FIXME - this tool should work nicely without such evil
642 execute_Command
($Command, $error_setup, $show_Message, $command_normal);
643 return "$sane_destdir/"
645 } elsif ( (defined($system)) && ($system eq "Linux") ) {
646 if (defined ($ENV{FORCE2ARCHIVE
}) and ($ENV{FORCE2ARCHIVE
} eq "TRUE")) {
647 $optdir = $dest_installdir; #needed for getting work dir at the end
648 $mask = "\\.tar\\.gz\$";
649 getSubFiles
("$installsetpath", \
@DirArray, $mask);
650 if ($#DirArray == -1) {
651 print_error
("Installationset in $installsetpath is incomplete", 2);
653 elsif ($#DirArray == 0) {
654 createPath
($dest_installdir, $error_setup);
655 $Command = "cd \"$dest_installdir\" && tar xzvf \"$installsetpath$DirArray[0]\"";
656 execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
659 print_error
($error_setup, $show_Message);
662 elsif ($ENV{PKGFORMAT
} eq "deb") { # default is rpm
663 $installsetpath .= "DEBS$PathSeparator";
664 $optdir = "$dest_installdir" . "opt" . $PathSeparator;
665 createPath
($optdir, $error_setup);
667 getSubFiles
("$installsetpath", \
@DirArray, $mask);
668 if ($#DirArray == -1) {
669 print_error
("Installationset in $installsetpath is incomplete", 2);
671 foreach $file (@DirArray) {
672 if ( ($file =~ /-menus-/) or ($file =~ /^adabas/) or (/^j2re-/) or ($file =~ /-gnome-/) ) {
675 $Command = "dpkg-deb -x $installsetpath$file $dest_installdir";
676 execute_Command
($Command, $error_setup, $show_Message, $command_withoutErrorcheck | $command_withoutOutput);
680 $installsetpath .= "RPMS$PathSeparator";
681 $optdir = "$dest_installdir" . "opt" . $PathSeparator;
682 $rpmdir = "$dest_installdir" . "rpm" . $PathSeparator;
683 createPath
($optdir, $error_setup);
684 createPath
($rpmdir, $error_setup);
685 my $ld_library_backup = $ENV{LD_LIBRARY_PATH
};
686 if ( defined $ENV{SYSBASE
}) {
687 my $sysbase=$ENV{SYSBASE
};
688 if ( "$ld_library_backup" eq "" ) {
689 $ENV{LD_LIBRARY_PATH
} = "$sysbase/usr/lib";
691 $ENV{LD_LIBRARY_PATH
} = "$ld_library_backup:$sysbase/lib";
694 $Command = "rpm --initdb --define \"_dbpath $rpmdir\"";
695 execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
697 getSubFiles
("$installsetpath", \
@DirArray, $mask);
698 if ($#DirArray == -1) {
699 print_error
("Installationset in $installsetpath is incomplete", 2);
701 foreach $file (@DirArray) {
702 if ( ($file =~ /-menus-/) or ($file =~ /^adabas/) or (/^j2re-/) or ($file =~ /-gnome-/) ) {
705 $Command = "rpm --define \"_dbpath $rpmdir\" --install --ignoresize --nodeps -vh --relocate /opt=${dest_installdir}opt $installsetpath$file";
706 execute_Command
($Command, $error_setup, $show_Message, $command_withoutErrorcheck | $command_withoutOutput);
708 $ENV{LD_LIBRARY_PATH
}=$ld_library_backup;
711 elsif ( (defined($system)) && ($system eq "SunOS") ) {
712 if (defined($ENV{FORCE2ARCHIVE
})) {
713 print_error
($error_messages[$error_packformat], $error_packformat);
716 $mask = "^.ai.pkg.zone.lock";
717 getSubFiles
("/tmp", \
@DirArray, $mask);
718 if ($#DirArray >= 0) {
719 foreach $file (@DirArray) {
720 $Command = "$REMOVE_FILE /tmp/$file";
721 execute_Command
($Command, $error_logflag, $show_Message, $command_withoutOutput);
724 if ($mach eq sun4u
) {
725 $solarisdata = $DATA . "solaris$PathSeparator" . "sparc$PathSeparator";
728 $solarisdata = $DATA . "solaris$PathSeparator" . "x86$PathSeparator";
730 $installsetpath .= "packages$PathSeparator";
731 $optdir = "$dest_installdir" . "opt" . $PathSeparator;
732 createPath
($optdir, $error_setup);
733 createPath
($dest_installdir . "usr$PathSeparator" . "bin", $error_setup);
735 getSubDirs
("$installsetpath", \
@DirArray);
736 my $ld_preload = $ENV{LD_PRELOAD
};
737 $ENV{LD_PRELOAD
} = $solarisdata . "getuid.so";
738 if ($#DirArray == -1) {
739 print_error
("Installationset in $installsetpath is incomplete", 2);
741 foreach $file (@DirArray) {
742 if ( ($file =~ /-gnome/) or ($file =~ /-cde/) or ($file =~ /adabas/) or ($file =~ /j3/) or ($file =~ /-desktop-/) ) {
745 $Command = "pkgparam -d $installsetpath $file BASEDIR";
746 $output_ref = execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
747 if (($#{@$output_ref} > -1) and ($$output_ref[0] ne "") ) {
748 createPath
("$dest_installdir$$output_ref[0]", $error_setup);
750 $Command = "pkgadd -a $solarisdata" . "admin -d $installsetpath -R $dest_installdir $file";
751 execute_Command
($Command, $error_setup, $show_Message, $command_withoutErrorcheck | $command_withoutOutput);
753 my $pkgadd_tmpfile = "/tmp/.ai.pkg.zone.lock*";
754 $Command = "$REMOVE_FILE $pkgadd_tmpfile";
755 execute_Command
($Command, $error_setup, $show_NoMessage, $command_withoutErrorcheck | $command_withoutOutput);
756 $ENV{LD_PRELOAD
} = $ld_preload;
758 elsif ( (defined($ENV{OS
})) && ($ENV{OS
} eq "MACOSX") ) {
759 if (defined($ENV{FORCE2ARCHIVE
})) {
760 print_error
($error_messages[$error_packformat], $error_packformat);
764 getSubFiles
("$installsetpath", \
@DirArray, "^[a-zA-Z0-9].*\\.dmg\$");
765 if ($#DirArray == 0) {
766 $install_dmg = "$installsetpath" . $DirArray[0];
768 elsif ($#DirArray > 0) {
769 print_error
("more than one installset found in $installsetpath", 2);
772 print_error
("no installset found in $installsetpath", 2);
774 $Command = "hdiutil attach " . $install_dmg;
776 $output_ref = execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
777 my $volumeinfo = $$output_ref[$#{@{$output_ref}}];
778 if (!$volumeinfo =~ /OpenOffice/) {
779 print_error
("mount of $install_dmg failed", 2);
781 $volumeinfo =~ s/\s{2,}/;/g;
782 my @volumeinfos = split(/;/,$volumeinfo);
783 my $detachpath = $volumeinfos[0];
784 my $newinstallsetpath = $volumeinfos[2] . $PathSeparator;
785 createPath
($dest_installdir, $error_setup);
786 $Command = "$COPY_DIR \"$newinstallsetpath\" \"$dest_installdir\"";
787 execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
788 $Command = "hdiutil detach " . $detachpath;
789 execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
791 getSubFiles
("$dest_installdir", \
@DirArray, "\\.app");
792 if ($#DirArray == 0) {
793 $optdir = "$dest_installdir" . $DirArray[0] . $PathSeparator;
794 my $PListFile = "Info.plist";
795 my $officeDir = "$optdir" . "Contents" . $PathSeparator;
796 my $programmDir = "$officeDir" . "MacOS" . $PathSeparator;
797 $Command = "$COPY_FILE \"$officeDir$PListFile\" \"$programmDir$PListFile\"";
798 execute_Command
($Command, $error_setup, $show_Message, $command_withoutOutput);
801 print_error
("Installation in $dest_installdir is incomplete", 2);
805 print_error
("Plattform is not supported", 2);
808 getSubDirsFullPath
($optdir, \
@DirArray);
809 if ($#DirArray == 0) {
810 $basedir = $DirArray[0] . $PathSeparator;
812 elsif ($#DirArray == -1) {
813 print_error
($error_setup, $show_Message);
823 if ($a eq $prefered_lang) {
826 elsif ($b eq $prefered_lang) {
835 my ($INSTSET, $NEWINSTSET);
836 my (@DirArray, $InstDir, $RootDir, $TestDir1, $TestDir2);
838 if (defined ($ENV{EPM
}) && ($ENV{EPM
} eq 'NO') && ($gui eq "UNX")) { # we do the install ourselves ...
842 print "get Instset\n" if $is_debug;
844 if (defined($smoketest_install)) {
845 my $mask = "\\" . $PathSeparator . "\$";
846 $smoketest_install =~ s/$mask//;
848 ($NEWINSTSET, $INSTSET, $sufix) = fileparse
($smoketest_install);
849 return ($NEWINSTSET, $INSTSET);
851 if (!isLocalEnv
() and !defined($ENV{CWS_WORK_STAMP
}) and (-e
$SHIP)) {
852 ($NEWINSTSET, $INSTSET) = getSetFromServer
();
856 $RootDir=$ENV{DMAKE_WORK_DIR
};
858 foreach $project (@install_list) {
860 $TestDir1 = "$RootDir$project$PathSeparator$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator" . "install$PathSeparator";
861 $TestDir2 = "$StandDir$project$PathSeparator$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator" . "install$PathSeparator";
862 if (-e
"$TestDir1") {
865 elsif (-e
"$TestDir2") {
866 $InstDir="$TestDir2";
868 if ($InstDir eq "") {
871 getSubDirs
("$InstDir", \
@DirArray);
872 $INSTSET = findSubDir
(\
@DirArray);
873 print "Lang-Sel: $INSTSET\n" if $is_command_infos;
875 if ($INSTSET ne "") {
876 $NEWINSTSET = $INSTSET;
878 print "new: $INSTSET\n";
880 if (($INSTSET ne "") and (-e
$INSTSET)) {
881 return ($NEWINSTSET, $INSTSET);
884 print_error
("no installationset found\n",2);
886 return ($NEWINSTSET, $INSTSET);
891 if (defined ($ENV{SOL_TMP
}) && defined ($ENV{SOLARVERSION
})) {
892 my $mask = $ENV{SOL_TMP
};
894 print "Mask: $mask\n" if $is_debug;
895 if ($ENV{SOLARVERSION
}=~ /$mask/) {
902 sub get_productcode
{
903 my ( $installpath ) = @_;
904 my ($path, $productcode);
906 $path = "$installpath" . "setup.ini";
907 print "$path\n" if $is_debug;
908 if ( !open(SETUP
,$path) ) {
909 print "FATAL: can't open $path\n" if ($is_command_infos);
910 return ($productcode);
916 if ( /productcode=(\{[\d\w-]+\})/ ) {
923 return ($productcode);
928 if ($a =~ /$global_instset_mask/) {
931 if ($b =~ /$global_instset_mask/) {
937 sub getSetFromServer
{
938 my ($DirName, $SetupFullPath);
939 my $workspace = $ENV{WORK_STAMP
};
940 my $platform = $ENV{INPATH
};
942 my (@DirArray, $mask);
943 $SetupFullPath = $PORDUCT;
944 if ( ! ( $workspace && $platform ) ) {
945 print_error
( "Error: environment not set correctly.", 1);
947 if (!defined($milestone)) {
948 print_error
("Milestone ist not defined!", 2);
950 if (!defined($buildid)) {
951 print_error
("Build-ID ist not defined!", 2);
954 # if ( $SetupFullPath =~ /^\/s.*\/install\// ) {
955 # if ( $gui eq "UNX" ) {
956 # $SetupFullPath = "/net/jumbo.germany" . $SetupFullPath;
958 # $SetupFullPath = "\\\\jumbo" . $SetupFullPath;
962 # my $ws_lc = lc $workspace;
963 $mask = "^$workspace" . "_" . $milestone . "_native_packed-(\\d+)_en-US\\.$buildid";
964 $global_instset_mask = $mask;
965 getSubFiles
($SetupFullPath, \
@DirArray, $mask);
966 @DirArray = sort InstsetSort
@DirArray;
967 if ($#DirArray > -1) {
968 $latestset = $DirArray [$#DirArray];
969 $DirName = $latestset;
972 print_error
("Cannot find install set $SetupFullPath for $workspace $milestone", 2);
974 print "Latest install sets: $latestset\n" if $is_debug;
976 print "$DirName\t $SetupFullPath\n" if $is_debug;
978 # compare with file system
979 # at the moment just the existence is checked. For security reasons it might be
980 # better to additionally check whether there are newer sets (this must not happen,
982 if ( -d
$SetupFullPath ) {
983 return ($DirName, $SetupFullPath);
985 print_error
("Cannot find install set $SetupFullPath for $workspace $milestone", 2);
989 sub patch_bootstrap
{
990 my ($sourcefile, $destfile) = @_;
991 my (@convert_split, $line);
996 print "patching bootstrap $sourcefile ...\n";
1000 $Error &= move
("$sourcefile", "$destfile");
1002 open OUTFILE
, ">$sourcefile" or return errorFromOpen
($sourcefile);
1003 open INFILE
, "<$destfile" or return errorFromOpen
($destfile);
1009 if ( $line =~ /UserInstallation/ ) {
1010 if ($line =~ /(\r\n)/) {
1013 elsif ($line =~ /(\n)/) {
1019 @convert_split = split "=", $line;
1020 $line = $convert_split[0];
1022 if ($gui eq $cygwin) {
1023 $line .= ConvertToFileURL
(ConvertCygwinToWin
($userinstallpath_without));
1026 $line .= ConvertToFileURL
($userinstallpath_without);
1030 print OUTFILE
"$line";
1036 $Error &= unlink ($destfile);
1040 sub SetWinLineends
() {
1044 sub SetCygwinLineends
() {
1045 $/ = $CygwinLineends;
1048 sub ConvertToFileURL
{
1049 my ($filename) = @_;
1052 $FileURL = $FileURLPrefix . $filename;
1053 $FileURL =~ s/\\/\//g
;
1054 $FileURL =~ s/\/\/\
/\//\/\
/\//; # 4 slashes to 3 slashes
1058 sub ConvertCygwinToWin_Shell
{
1059 my ($cygwinpath) = @_;
1061 $winpath = ConvertCygwinToWin
($cygwinpath);
1062 $winpath =~ s/\\/\\\\/g;
1066 sub ConvertCygwinToWin
{
1067 my ($cygwinpath) = @_;
1069 my ($last_lineends) = $/;
1070 SetCygwinLineends
();
1071 $winpath=`cygpath --windows $cygwinpath`;
1073 $/ = $last_lineends;
1078 my ($path, $Error) = @_;
1081 eval {mkpath
("$path", 0, 0777)};
1083 print_error
($error_messages[$Error], $Error);
1087 print "mkpath($path, 0, 0777)\n";
1093 my ($sversion) = @_;
1094 my ($sversion_bak) = $sversion . "_";
1096 if (-e
$sversion_bak) {
1097 execute_system
("$REMOVE_FILE \"$sversion_bak\"");
1099 execute_system
("$COPY_FILE \"$sversion\" \"$sversion_bak\"");
1100 execute_system
("$REMOVE_FILE \"$sversion\"");
1101 $sversion_saved = 1;
1105 sub restore_sversion
{
1106 my ($sversion) = @_;
1107 my ($sversion_bak) = $sversion . "_";
1108 if ($sversion_saved) {
1110 execute_system
("$REMOVE_FILE \"$sversion\"");
1112 execute_system
("$COPY_FILE \"$sversion_bak\" \"$sversion\"");
1113 execute_system
("$REMOVE_FILE \"$sversion_bak\"");
1114 $sversion_saved = 0;
1118 sub removeOldInstallation
{
1119 my ($installpath) = @_;
1121 if (-e
$installpath) {
1122 execute_system
("$REMOVE_DIR \"$installpath\"");
1124 if (-e
$installpath) {
1125 print_error
("can not clear old installation in $installpath\n", 3);
1130 sub removeInstallation
{
1131 my ($installpath) = @_;
1133 if (-e
$installpath) {
1134 execute_system
("$REMOVE_DIR \"$installpath\"");
1139 sub deinstallInstallation
{
1140 my ($installpath) = @_;
1142 if ($gui eq "UNX") { return; }
1144 if (-e
$installpath) {
1145 $productcode = get_productcode
($installpath);
1146 print "Productcode: $productcode\n" if ($is_command_infos);
1147 if ($productcode ne "") {
1148 print "deinstalling $productcode ...\n";
1149 $Command = "msiexec.exe -x $productcode -qn";
1150 execute_Command
($Command, $error_deinst, $show_Message, $command_withoutErrorcheck | $command_withoutOutput);
1156 sub setInstallpath
{
1157 my ($infile, $outfile, $installpath) = @_;
1159 execute_system
("$REMOVE_FILE \"$outfile\"");
1162 open OUTTABLE
, ">$outfile" or die "Error: can\'t open solarfile $outfile";
1163 open INTABLE
, "<$infile" or die "Error: can\'t open solarfile $infile";
1166 if ( $line =~ /^DESTINATIONPATH=officeinstallpath/ ) {
1167 $line =~ s/officeinstallpath/$installpath/;
1169 print OUTTABLE
"$line";
1175 sub execute_Command
{
1176 my ($Command, $Errorcode, $showMessage, $command_action) = @_;
1177 my ($Returncode, $output_ref);
1179 if ( ($command_action & $command_withoutOutput) == $command_withoutOutput) {
1180 ($Returncode, $output_ref) = execute_system
("$Command");
1183 print "$Command\n" if $is_command_infos;
1184 $Returncode = system ("$Command");
1188 if (($command_action & $command_withoutErrorcheck) == $command_withoutErrorcheck) {
1189 print_warning
($error_messages[$Errorcode], $Errorcode);
1192 print_error
($error_messages[$Errorcode], $Errorcode);
1196 if (($command_action & $command_withoutErrorcheck) != $command_withoutErrorcheck) {
1197 do_exit
($Errorcode);
1208 sub execute_system
{
1209 my ($command) = shift;
1210 my (@output_array, $line);
1211 if ( $is_command_infos ) {
1212 print STDERR
"TRACE_SYSTEM: $command\n";
1214 open( COMMAND
, "$command 2>&1 |");
1215 while ($line = <COMMAND
>) {
1217 push (@output_array, $line);
1220 return $?
, \
@output_array;
1225 my $message = shift;
1227 print STDERR
"$script_name: ";
1228 print STDERR
"WARNING $message\n";
1234 my $message = shift;
1235 my $error_code = shift;
1237 print STDERR
"$script_name: ";
1238 print STDERR
"ERROR: $message\n";
1240 do_exit
($error_code);
1243 sub print_notRemoved
{
1244 my ($installpath) = @_;
1245 print "no deinstallation from $installpath\n";
1250 my $error_code = shift;
1252 if ($sversion_saved) {
1253 restore_sversion
($SVERSION_INI);
1255 if ($is_remove_on_error) {
1256 if ($is_do_deinstall) {
1257 deinstallInstallation
($installpath);
1259 removeInstallation
($installpath);
1262 print_notRemoved
($installpath);
1264 if ( $error_code ) {
1265 print STDERR
"\nFAILURE: $script_name aborted.\n";