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