Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple commands to a single call to choco.exe #2056

Open
michaelmhoffman opened this issue May 24, 2020 · 4 comments
Open

Multiple commands to a single call to choco.exe #2056

michaelmhoffman opened this issue May 24, 2020 · 4 comments

Comments

@michaelmhoffman
Copy link

A script that I use to configure my system has to make multiple calls to choco.exe.

choco feature enable --name=allowGlobalConfirmation
choco feature enable --name=useEnhancedExitCodes
choco source add --name=user --source=$ChocoUserSource
choco install --accept-license dropbox googlechrome spotify
choco pin add --name=dropbox
choco pin add --name=googlechrome
choco pin add --name=spotify
choco upgrade --accept-license firefox emacs
choco upgrade microsoft-office-deployment --params="'/64bit /Product:O365ProPlusRetail /Exclude:Publisher,Groove,Access'"

The repeated calls to choco.exe are slow even if things are fast after it starts up. It would be nice if there were a way to provide a script to choco that would do lots of these things at once. For example, desired would be to write a script like myinstallscript.choco:

feature enable --name=allowGlobalConfirmation
feature enable --name=useEnhancedExitCodes
source add --name=user --source=<source details here>
install --accept-license dropbox googlechrome spotify
pin add --name=dropbox
pin add --name=googlechrome
pin add --name=spotify
upgrade --accept-license <list of packages here>
upgrade microsoft-office-deployment --params="'/64bit /Product:O365ProPlusRetail /Exclude:Publisher,Groove,Access'"

and run with choco script myinstallscript.choco. It would also be useful to be able to combine some of the above lines. For example, one could enable multiple features at once, pin multiple packages at once, or specify pins at the same time as installation. The top script could then become

choco feature enable --name=allowGlobalConfirmation --name=useEnhancedExitCodes
choco source add --name=user --source=$ChocoUserSource
choco upgrade --accept-license dropbox[pin] googlechrome[pin] spotify[pin] firefox emacs microsoft-office-deployment[params="'/64bit /Product:O365ProPlusRetail /Exclude:Publisher,Groove,Access'"]
@michaelmhoffman
Copy link
Author

The packages.config file can only be used to install, not upgrade, and I don't see a way to get it to specify things like pins either.

@ferventcoder
Copy link
Member

This seems like a really cool thing! Like a script given to choco with only choco commands in it.

@vexx32
Copy link
Member

vexx32 commented Jun 3, 2020

.chocoscript files when? 😁

@ferventcoder
Copy link
Member

ferventcoder commented Jun 3, 2020

I like the .choco format idea. I don't see it as a replacement for full PowerShell scripts, but this could be really beneficial for starting a choco shell and then running everything in order. Should also note how things should exit when there are errors, continue, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants