From 7ab2a51ae422eaffbb626623d23bbf3eb49a2c63 Mon Sep 17 00:00:00 2001 From: Sergei Vorobev Date: Mon, 16 May 2016 14:53:40 -0700 Subject: [PATCH] Add workaroud for OS X packaging utime bug --- PowerShellGitHubDev.psm1 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 458bcd9a58..a8b00c5a0b 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -454,6 +454,22 @@ Built upon .NET Core, it is also a C# REPL. } New-Item -Force -ItemType SymbolicLink -Path /tmp/powershell -Target $Destination/powershell >$null + + # there is a weired bug in fpm + # if the target of the powershell symlink exists, `fpm` aborts + # with a `utime` error on OS X. + # so we move it to make symlink broken + $symlink_dest = "$Destination/powershell" + $hack_dest = "./_fpm_symlink_hack_powershell" + if ($IsOSX) + { + if (Test-Path $symlink_dest) + { + Write-Warning "Move $symlink_dest to $hack_dest (fpm utime bug)" + Move-Item $symlink_dest $hack_dest + } + } + # Change permissions for packaging chmod -R go=u $Source /tmp/powershell @@ -499,6 +515,16 @@ Built upon .NET Core, it is also a C# REPL. # Build package fpm $Arguments + + if ($IsOSX) + { + # this is continuation of a fpm hack for a weired bug + if (Test-Path $hack_dest) + { + Write-Warning "Move $hack_dest to $symlink_dest (fpm utime bug)" + Move-Item $hack_dest $symlink_dest + } + } }