2

I am currently working on a project that would automate the installation of various environments we have within the company. I have several packages created using Chocolatey.

The problem that I am having is creating a dynamic custom installation file. The current internal website allows for users to checkmark the software they wish to install. The idea would be to then allow them to click an install button which would generate an .exe file. The .exe would run the command line scripts to install the Chocolatey packages.

An example of the command line after marking the Google Chrome and Notepad++ boxes would be:

> choco install googlechrome
> choco install notepadplusplus.install 

I am wondering what would be the best way to go about creating an .exe file dynamically.

Two examples I am getting inspiration from would be:

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
  • 1
    Why would you crest an Exe? Just creat a powershell script .ps1 – Wayne Ellery Feb 18 '15 at 21:12
  • Can you go into a little more detail? What would I use to create a dynamic .ps1 script? Currently my website is only Bootstrap, HTML, and CSS and only hosted locally. Thank you. – BearForceOne Feb 18 '15 at 21:29
  • You can't. You would need to use some server side technology such as php, nodejs, asp.net to create the ps1 file. The angularjs app would use $http to make a call to the server, the server would generate the file and return it and then the client can download the file. The use can then run it. – Wayne Ellery Feb 18 '15 at 21:34
  • Thanks for the help Wayne. Sorry I am new to this. Do you happen to know where I could look at an example? Or something similar to what you are referring to? – BearForceOne Feb 18 '15 at 21:51
  • It would depend on what server side technology that you are using. If you were using Nodejs you would use Stream to return a file like this:http://stackoverflow.com/questions/18467620/dynamically-creating-a-file-with-node-js-and-make-it-available-for-download – Wayne Ellery Feb 18 '15 at 22:47
  • What about with PHP? I looked into doing it with PHP but I think I have to use a database to retrieve the information. It seems kind of resource intensive to create a database with one column that stores "choco install googlechrome" and "choco install notepadplusplus.isntall" each row. Are there other options with PHP? – BearForceOne Feb 18 '15 at 23:25
  • You don't need to use a db. You could just hard code the applications in your angularjs application and then the name would be sent to your php such as an array of applications ['googlechrome', notepadplusplus.install'] and then the php script would return the file like this: http://community.sitepoint.com/t/generate-dynamic-text-file-for-download/1197/5#post_6 and then in angularjs you would download the file as so: http://stackoverflow.com/a/16514741/2326610 – Wayne Ellery Feb 19 '15 at 00:17
  • @WayneEllery: you have enough comments to compose an answer! Do it and I'll send an upvote :) – Anthony Mastrean Feb 23 '15 at 21:33

1 Answers1

0

There is a chrome extension that does something similar. You may want to explore what it is doing and change it for your needs. It's called Chocolate Factory.

ferventcoder
  • 11,952
  • 3
  • 57
  • 90