1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28package installer::copyproject;
29
30use installer::control;
31use installer::converter;
32use installer::files;
33use installer::globals;
34use installer::logger;
35use installer::mail;
36use installer::systemactions;
37use installer::worker;
38
39####################################################
40# Including header files into the logfile
41####################################################
42
43sub copy_project
44{
45	my ( $filesref, $scpactionsref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref ) = @_;
46
47	# Creating directories
48
49	installer::logger::include_header_into_logfile("Creating installation directory");
50
51	my $current_install_number = "";
52
53	my $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
54
55	my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
56
57	# Copy files and ScpActions
58
59	installer::logger::include_header_into_logfile("Copying files:");
60
61	# copy Files
62
63	for ( my $i = 0; $i <= $#{$filesref}; $i++ )
64	{
65		my $onefile = ${$filesref}[$i];
66
67		my $source = $onefile->{'sourcepath'};
68		my $destination = $installdir . $installer::globals::separator . $onefile->{'Name'};
69
70		installer::systemactions::copy_one_file($source, $destination);
71
72		if ( $destination =~ /install\s*$/ )
73		{
74			my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1";
75			system($localcall);
76		}
77
78        	if ( $onefile->{'UnixRights'} )
79		{
80			my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1";
81			system($localcall);
82        	}
83	}
84
85	# copy ScpActions
86
87	for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ )
88	{
89		my $onefile = ${$scpactionsref}[$i];
90
91		my $source = $onefile->{'sourcepath'};
92		my $destination = $installdir . $installer::globals::separator . $onefile->{'DestinationName'};
93
94		installer::systemactions::copy_one_file($source, $destination);
95
96		if ( $destination =~ /install\s*$/ )
97		{
98			my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1";
99			system($localcall);
100		}
101
102		if ( $onefile->{'UnixRights'} )
103		{
104			my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1";
105			system($localcall);
106		}
107	}
108
109	# Analyzing the log file
110
111	installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
112
113	# That's all
114
115	exit(0);
116}
117
1181;
119