| 1 |
# |
| 2 |
# This file is part of the LibreOffice project. |
| 3 |
# |
| 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/. |
| 7 |
# |
| 8 |
# This file incorporates work covered by the following license notice: |
| 9 |
# |
| 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 . |
| 17 |
# |
| 18 |
|
| 19 |
package installer::copyproject; |
| 20 |
|
| 21 |
use strict; |
| 22 |
use warnings; |
| 23 |
|
| 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; |
| 31 |
|
| 32 |
#################################################### |
| 33 |
# Including header files into the logfile |
| 34 |
#################################################### |
| 35 |
|
| 36 |
sub copy_project |
| 37 |
{ |
| 38 |
my ( $filesref, $scpactionsref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref ) = @_; |
| 39 |
|
| 40 |
# Creating directories |
| 41 |
|
| 42 |
installer::logger::include_header_into_logfile("Creating installation directory"); |
| 43 |
|
| 44 |
my $current_install_number = ""; |
| 45 |
|
| 46 |
my $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number); |
| 47 |
|
| 48 |
my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log"); |
| 49 |
|
| 50 |
# Copy files and ScpActions |
| 51 |
|
| 52 |
installer::logger::include_header_into_logfile("Copying files:"); |
| 53 |
|
| 54 |
# copy Files |
| 55 |
|
| 56 |
for ( my $i = 0; $i <= $#{$filesref}; $i++ ) |
| 57 |
{ |
| 58 |
my $onefile = ${$filesref}[$i]; |
| 59 |
|
| 60 |
my $source = $onefile->{'sourcepath'}; |
| 61 |
my $destination = $installdir . $installer::globals::separator . $onefile->{'Name'}; |
| 62 |
|
| 63 |
installer::systemactions::copy_one_file($source, $destination); |
| 64 |
|
| 65 |
if ( $onefile->{'UnixRights'} ) |
| 66 |
{ |
| 67 |
chmod oct($onefile->{'UnixRights'}), $destination; |
| 68 |
} |
| 69 |
elsif ( $destination =~ /install\s*$/ ) |
| 70 |
{ |
| 71 |
chmod 0775, $destination; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
# copy ScpActions |
| 76 |
|
| 77 |
for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ ) |
| 78 |
{ |
| 79 |
my $onefile = ${$scpactionsref}[$i]; |
| 80 |
|
| 81 |
my $source = $onefile->{'sourcepath'}; |
| 82 |
my $destination = $installdir . $installer::globals::separator . $onefile->{'DestinationName'}; |
| 83 |
|
| 84 |
installer::systemactions::copy_one_file($source, $destination); |
| 85 |
|
| 86 |
if ( $onefile->{'UnixRights'} ) |
| 87 |
{ |
| 88 |
chmod oct($onefile->{'UnixRights'}), $destination; |
| 89 |
} |
| 90 |
elsif ( $destination =~ /install\s*$/ ) |
| 91 |
{ |
| 92 |
chmod 0775, $destination; |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
# Analyzing the log file |
| 97 |
|
| 98 |
installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number); |
| 99 |
|
| 100 |
# That's all |
| 101 |
|
| 102 |
exit(0); |
| 103 |
} |
| 104 |
|
| 105 |
1; |