Update ooo320-m1
[ooovba.git] / solenv / bin / modules / installer / copyproject.pm
blobb85af7913b0c00487acf112157464a171fcd0d0f
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: copyproject.pm,v $
11 # $Revision: 1.9 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 package installer::copyproject;
34 use installer::control;
35 use installer::converter;
36 use installer::files;
37 use installer::globals;
38 use installer::logger;
39 use installer::mail;
40 use installer::systemactions;
41 use installer::worker;
43 ####################################################
44 # Including header files into the logfile
45 ####################################################
47 sub copy_project
49 my ( $filesref, $scpactionsref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref ) = @_;
51 # Creating directories
53 installer::logger::include_header_into_logfile("Creating installation directory");
55 my $current_install_number = "";
57 my $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
59 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
61 # Copy files and ScpActions
63 installer::logger::include_header_into_logfile("Copying files:");
65 # copy Files
67 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
69 my $onefile = ${$filesref}[$i];
71 my $source = $onefile->{'sourcepath'};
72 my $destination = $installdir . $installer::globals::separator . $onefile->{'Name'};
74 installer::systemactions::copy_one_file($source, $destination);
76 if ( $destination =~ /install\s*$/ )
78 my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1";
79 system($localcall);
82 if ( $onefile->{'UnixRights'} )
84 my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1";
85 system($localcall);
89 # copy ScpActions
91 for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ )
93 my $onefile = ${$scpactionsref}[$i];
95 my $source = $onefile->{'sourcepath'};
96 my $destination = $installdir . $installer::globals::separator . $onefile->{'DestinationName'};
98 installer::systemactions::copy_one_file($source, $destination);
100 if ( $destination =~ /install\s*$/ )
102 my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1";
103 system($localcall);
106 if ( $onefile->{'UnixRights'} )
108 my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1";
109 system($localcall);
113 # Analyzing the log file
115 installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
117 # That's all
119 exit(0);