One quick workaround is to install Cygwin and run Packer in that. Or just wrap the Packer build in a script that run ovftool after packer.
On 11 July 2017 at 11:56, James Elmes <[email protected]> wrote: > Thanks for responding Alex, i have tried the above as well but cannot get > even the simplest of commands to run, even the below as mentioned in > https://github.com/hashicorp/packer/issues/4140 > > I really need to get this working, is there anyone else i can reach out to? > >> "post-processors": [ >> { >> "type": "shell-local", >> "execute_command": "Powershell.exe Move-Item {{.Script}} >> {{.Script}}.ps1; Powershell.exe -File {{.Script}}.ps1", >> "inline": ["write-output HIIIIIIIII"] >> } > > > On Tuesday, 11 July 2017 01:53:53 UTC+10, Alexander Lehmann wrote: >> >> I tried a few things with inline, but I couldn't get that to work. >> >> When using a local .cmd file, calling the script works with the following >> entry: >> >> { >> "type":"shell-local", >> "execute_command": "cmd.exe /c {{.Script}}", >> "script": "createovf.cmd" >> } >> >> and the script is in the packer dir .\createovf.cmd >> >> "\Program Files (x86)\VMware\VMware Workstation\OVFTool\ovftool.exe" >> source/vmware-iso/packer-centos-7-x86_64.vmx export-vmware-ovf >> >> >> On Monday, July 10, 2017 at 1:35:33 PM UTC+2, James Elmes wrote: >>> >>> I have tried this but it doesn't work, just "error running script" >>> >>> the ovftool command needs to be run in CMD.EXE i believe, the below is >>> what it looks like >>> >>> C:\PACKER\packer_config>ovftool -tt=ova >>> vi://root:[email protected]/Windows2012R2v1-2017-07 ovaexport1.ova >>> Opening VI source: vi://[email protected]:443/Windows2012R2v1-2017-07 >>> Opening OVA target: ovaexport1.ova >>> Writing OVA package: ovaexport1.ova >>> Disk progress: 2% >>> >>> I have tried the below >>> >>> "type":"shell-local", >>> "execute_command": "cmd.exe {{.Script}}.cmd", >>> "inline": ["ovftool.exe -tt=ova >>> vi://root:root:[email protected]/Windows2012R2v1-2017-07 ovaexport12.ova"] >>> >>> AND >>> >>> "type":"shell-local", >>> "execute_command": "Powershell.exe Move-Item {{.Script}} >>> {{.Script}}.ps1; cmd.exe {{.Script}}.cmd", >>> "inline": ["ovftool.exe -tt=ova >>> vi://root:root:[email protected]/Windows2012R2v1-2017-07 ovaexport12.ova"] >>> >>> AND >>> >>> "type":"shell-local", >>> "execute_command": "cmd.exe /c {{.Script}}", >>> "script": "ovftool/ovftool_command.cmd" >>> >>> I get the below result, furthermore i never actually see this file get >>> created.. which me be part of the puzzle.. >>> >>> ==> null: Running post-processor: shell-local >>> ==> null (shell-local): Post processing with local shell script: >>> C:\Users\ADMINI~1.ISS\AppData\Local\Temp\packer-shell35 >>> 9109543 >>> Build 'null' errored: 1 error(s) occurred: >>> >>> OR >>> >>> ==> null: Running post-processor: shell-local >>> ==> null (shell-local): Post processing with local shell script: >>> scripts/ovftool_command.cmd >>> Build 'null' errored: 1 error(s) occurred: >>> >>> * Post-processor failed: Error executing script: >>> scripts/ovftool_command.cmd >>> any idea how to run a .CMD guys? >>> >>> > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in violation > of those guidelines may result in your removal from this mailing list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/packer-tool/e81d5874-df76-4666-9aa8-9b77b4e70b23%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt_S8b3NtejWsPiH0A%2BWh4EK9_01yphvcrEG_yt%3D2KSwPg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
