Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / solenv / bin / modules / installer / copyproject.pm
blob309636657a0b5809e5caaad28c8a6f49105b68c2
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer::copyproject;
21 use strict;
22 use warnings;
24 use installer::control;
25 use installer::converter;
26 use installer::files;
27 use installer::globals;
28 use installer::logger;
29 use installer::systemactions;
30 use installer::worker;
32 ####################################################
33 # Including header files into the logfile
34 ####################################################
36 sub copy_project
38 my ( $filesref, $scpactionsref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref ) = @_;
40 # Creating directories
42 installer::logger::include_header_into_logfile("Creating installation directory");
44 my $current_install_number = "";
46 my $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number);
48 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log");
50 # Copy files and ScpActions
52 installer::logger::include_header_into_logfile("Copying files:");
54 # copy Files
56 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
58 my $onefile = ${$filesref}[$i];
60 my $source = $onefile->{'sourcepath'};
61 my $destination = $installdir . $installer::globals::separator . $onefile->{'Name'};
63 installer::systemactions::copy_one_file($source, $destination);
65 if ( $onefile->{'UnixRights'} )
67 chmod oct($onefile->{'UnixRights'}), $destination;
69 elsif ( $destination =~ /install\s*$/ )
71 chmod 0775, $destination;
75 # copy ScpActions
77 for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ )
79 my $onefile = ${$scpactionsref}[$i];
81 my $source = $onefile->{'sourcepath'};
82 my $destination = $installdir . $installer::globals::separator . $onefile->{'DestinationName'};
84 installer::systemactions::copy_one_file($source, $destination);
86 if ( $onefile->{'UnixRights'} )
88 chmod oct($onefile->{'UnixRights'}), $destination;
90 elsif ( $destination =~ /install\s*$/ )
92 chmod 0775, $destination;
96 # Analyzing the log file
98 installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number);
100 # That's all
102 exit(0);