From 0fb388c733e163e9e271f3f8f8abd386e0d63db1 Mon Sep 17 00:00:00 2001 From: Wesley Turner Date: Mon, 16 May 2011 18:15:32 -0400 Subject: Ensure executable files have executable permissions. Fix the OSX X11 CPack generator to make sure the installer that it generates contains executable files. --- Source/CPack/cmCPackOSXX11Generator.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 0e8cbc0..75ad640 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -21,6 +21,7 @@ #include #include +#include //---------------------------------------------------------------------- cmCPackOSXX11Generator::cmCPackOSXX11Generator() @@ -135,6 +136,32 @@ int cmCPackOSXX11Generator::PackageFiles() return 0; } + // Two of the files need to have execute permission, so ensure they do: + std::string runTimeScript = dir; + runTimeScript += "/"; + runTimeScript += "RuntimeScript"; + + std::string appScriptName = appdir; + appScriptName += "/"; + appScriptName += this->GetOption("CPACK_PACKAGE_FILE_NAME"); + + mode_t mode; + if (cmsys::SystemTools::GetPermissions(runTimeScript.c_str(), mode)) + { + mode |= (S_IXUSR | S_IXGRP | S_IXOTH); + cmsys::SystemTools::SetPermissions(runTimeScript.c_str(), mode); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Setting: " << runTimeScript + << " to permission: " << mode << std::endl); + } + + if (cmsys::SystemTools::GetPermissions(appScriptName.c_str(), mode)) + { + mode |= (S_IXUSR | S_IXGRP | S_IXOTH); + cmsys::SystemTools::SetPermissions(appScriptName.c_str(), mode); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Setting: " << appScriptName + << " to permission: " << mode << std::endl); + } + std::string output; std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/hdiutilOutput.log"; -- cgit v0.12