From e00d487f3a7dbc66bedf9e97a7c8577a89ecbbde Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 12 Jul 2007 10:16:33 +0000 Subject: INTEGRATION: CWS native97 (1.31.86); FILE MERGED 2007/07/06 14:05:47 is 1.31.86.1: #148088# return value of new msitran.exe --- solenv/bin/modules/installer/systemactions.pm | 61 ++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm index 1d66cccf8f4e..ef4a3358784e 100644 --- a/solenv/bin/modules/installer/systemactions.pm +++ b/solenv/bin/modules/installer/systemactions.pm @@ -4,9 +4,9 @@ # # $RCSfile: systemactions.pm,v $ # -# $Revision: 1.31 $ +# $Revision: 1.32 $ # -# last change: $Author: kz $ $Date: 2007-05-10 13:56:46 $ +# last change: $Author: ihi $ $Date: 2007-07-12 11:16:33 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -93,6 +93,63 @@ sub create_directory } } +###################################################### +# Creating a new direcotory with defined privileges +###################################################### + +sub create_directory_with_privileges +{ + my ($directory, $privileges) = @_; + + my $returnvalue = 1; + my $infoline = ""; + + if (!(-d $directory)) + { + my $localprivileges = "0" . $privileges; + $returnvalue = mkdir($directory, $localprivileges); + + if ($returnvalue) + { + $infoline = "\nCreated directory: $directory\n"; + push(@installer::globals::logfileinfo, $infoline); + + if ($installer::globals::isunix) + { + my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } + } + else + { + # New solution in parallel packing: It is possible, that the directory now exists, although it + # was not created in this process. There is only an important error, if the directory does not + # exist now. + + if (!(-d $directory)) + { + installer::exiter::exit_program("ERROR: Could not create directory: $directory", "create_directory"); + } + else + { + $infoline = "\nAnother process created this directory in exactly this moment :-) : $directory\n"; + push(@installer::globals::logfileinfo, $infoline); + } + } + } + else + { + $infoline = "\nAlready existing directory, did not create: $directory\n"; + push(@installer::globals::logfileinfo, $infoline); + + if ($installer::globals::isunix) + { + my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } + } +} + ###################################################### # Removing a new direcotory ###################################################### -- cgit