1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22 23 24package installer::copyproject; 25 26use installer::control; 27use installer::converter; 28use installer::files; 29use installer::globals; 30use installer::logger; 31use installer::mail; 32use installer::systemactions; 33use installer::worker; 34 35#################################################### 36# Including header files into the logfile 37#################################################### 38 39sub copy_project 40{ 41 my ( $filesref, $scpactionsref, $loggingdir, $languagestringref, $shipinstalldir, $allsettingsarrayref ) = @_; 42 43 # Creating directories 44 45 installer::logger::include_header_into_logfile("Creating installation directory"); 46 47 my $current_install_number = ""; 48 49 my $installdir = installer::worker::create_installation_directory($shipinstalldir, $languagestringref, \$current_install_number); 50 51 my $installlogdir = installer::systemactions::create_directory_next_to_directory($installdir, "log"); 52 53 # Copy files and ScpActions 54 55 installer::logger::include_header_into_logfile("Copying files:"); 56 57 # copy Files 58 59 for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 60 { 61 my $onefile = ${$filesref}[$i]; 62 63 my $source = $onefile->{'sourcepath'}; 64 my $destination = $installdir . $installer::globals::separator . $onefile->{'Name'}; 65 66 installer::systemactions::copy_one_file($source, $destination); 67 68 if ( $destination =~ /install\s*$/ ) 69 { 70 my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1"; 71 system($localcall); 72 } 73 74 if ( $onefile->{'UnixRights'} ) 75 { 76 my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1"; 77 system($localcall); 78 } 79 } 80 81 # copy ScpActions 82 83 for ( my $i = 0; $i <= $#{$scpactionsref}; $i++ ) 84 { 85 my $onefile = ${$scpactionsref}[$i]; 86 87 my $source = $onefile->{'sourcepath'}; 88 my $destination = $installdir . $installer::globals::separator . $onefile->{'DestinationName'}; 89 90 installer::systemactions::copy_one_file($source, $destination); 91 92 if ( $destination =~ /install\s*$/ ) 93 { 94 my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1"; 95 system($localcall); 96 } 97 98 if ( $onefile->{'UnixRights'} ) 99 { 100 my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1"; 101 system($localcall); 102 } 103 } 104 105 # Analyzing the log file 106 107 installer::worker::analyze_and_save_logfile($loggingdir, $installdir, $installlogdir, $allsettingsarrayref, $languagestringref, $current_install_number); 108 109 # That's all 110 111 exit(0); 112} 113 1141; 115