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

Export a packages.config file #357

Open
SeanKilleen opened this Issue Jul 22, 2015 · 20 comments

Comments

Projects
None yet
@SeanKilleen
Copy link
Contributor

SeanKilleen commented Jul 22, 2015

Leaving this here as a suggested enhancement because I couldn't find it anywhere. If there's support for it, I'll look into whether I could contribute the change myself.

Use case / story

Sometimes, my whole system will become bricked (such as it did yesterday -- ouch). However, this is a lot less painful because I export my package list and restore using that.

Have I mentioned that Chocolatey is amazing? :)

However, there is still some pain here -- I have to manually concatenate the package names, remove the explicit version numbers, etc.

Proposed change

  • Add a command, such as choco export or cexp
  • Allow switches for format -- I suggest the below:
    • list: a list of the package names and their versions
    • conf: a packages.conf file
  • Required argument for the path of export file

Example usage

In a scheduled task, I can see running something along the lines of the following:

choco export -conf C:\MyBackupLocation\packages_yyyy-mm-dd.conf

Then, the next time my system gets bricked, it should be as easy as:

choco install -y C:\MyBackupLocation\packages_yyyy-mm-dd.conf

Thoughts?

@SeanKilleen

This comment has been minimized.

Copy link
Contributor Author

SeanKilleen commented Jul 22, 2015

Upon further consideration, I'd probably remove the flags for formatting. Exporting as a list would be the same as running clist -lo, so really the main purpose of export would be to get it into a packages.conf format.

@ferventcoder ferventcoder changed the title Suggested Enhancement: export a packages.conf file Export a packages.config file Jul 22, 2015

@ferventcoder

This comment has been minimized.

Copy link
Member

ferventcoder commented Jul 22, 2015

This is the same as https://github.com/chocolatey/chocolatey/issues/67, which needed migrated over. So thank you.

@ferventcoder ferventcoder added this to the 1.x milestone Jul 22, 2015

@SeanKilleen

This comment has been minimized.

Copy link
Contributor Author

SeanKilleen commented Jul 22, 2015

Great!

In terms of design, it sounds like there are multiple goals:

  • ability to export packages.config at any given time
  • exporting a packages.config to the chocolates dir upon changes, to maintain an always-current list.
  • potentially using packages.config as a way to install sets of packages.

Is this correct?

@ferventcoder

This comment has been minimized.

Copy link
Member

ferventcoder commented Jul 22, 2015

Sounds about right, but I don't think I would keep around a packages config file all the time to manage state. I would rather capture what args were used to install a package in the package information. This would be especially helpful for building the packages.config, but also for other purposes like knowing what to pass to build upgrade commands.

@RichiCoder1

This comment has been minimized.

Copy link
Member

RichiCoder1 commented Jul 22, 2015

I know we talked about this a lot over @ chocogui. First class support would be great, def including things like source and args information if necessary.

@SeanKilleen

This comment has been minimized.

Copy link
Contributor Author

SeanKilleen commented Jul 22, 2015

@RichiCoder1 yeah, I agree it'd be awesome to have this ability at the root.

So, to clarify since I'm newish and dropping in here -- 😄 -- we want to:

  • Make a change to capture the install arguments for a package at the time of install (see #358)
    • E.g. so that they could theoretically be returned when running clist -lo
  • Perhaps update clist -lo to return a table of package / version / Install Args (see #359)
  • Update the packages.conf spec to allow for IA="/blah" or something along those lines
  • Create a choco export command or something along those lines, as mentioned above (this issue)
  • Discuss further whether it makes sense to keep the "current state" in a packages.config file at the chocolatey level. (see #361)
    • I can see why we'd want to avoid this, but I can also see it being a nice touch for non-technical users to add it to their backup processes.

If we agree with the breakdown, I'm assuming we should create separate issues / tasks to support these individual items and reference them as appropriate?

@ferventcoder

This comment has been minimized.

Copy link
Member

ferventcoder commented Jul 22, 2015

That's what we tend to do. Break things down to manageable units and somehow mark things as blocking.

@SeanKilleen

This comment has been minimized.

Copy link
Contributor Author

SeanKilleen commented Jul 22, 2015

Alright, I'll go ahead and organize them as I've outlined above.

@gep13

This comment has been minimized.

Copy link
Member

gep13 commented Jul 22, 2015

As mentioned by @RichiCoder1, the basic export functionality is already included in ChocolateyGUI, as per this screenshot:

https://raw.githubusercontent.com/chocolatey/ChocolateyGUI/develop/docs/Screenshots/Application_Loaded.png

But it would be good to fall back on the functionality which could be included in Chocolatey, rather than re-invent the wheel.

@Cyber1000

This comment has been minimized.

Copy link

Cyber1000 commented Oct 31, 2016

Any progress/timeline on this feature?
Thanks!

@ferventcoder

This comment has been minimized.

Copy link
Member

ferventcoder commented Oct 31, 2016

@Cyber1000 note the milestone to the right and the labels. That should give you an idea where this is at. HTH

@admsteck

This comment has been minimized.

Copy link

admsteck commented May 31, 2017

A couple other options:
Instead of a new command, add an option to "choco list" to format the output in the packages.config xml format so the output can be piped into a file
Update "choco install" to accept a plain text file in the format of the current output from "choco list"

Personally, I'm not really interested in any arguments since I have never used any arguments when installing chocolatey packages.

@farmerbean

This comment has been minimized.

Copy link

farmerbean commented Jul 17, 2017

I'd enjoy a choco config export that you could roll into a scheduled task which saves the file to OneDrive/GDrive/wherever. Please and thank you.

Though kinda solved a bit lumpy - https://gist.github.com/alimbada/449ddf65b4ef9752eff3

@Cronus89

This comment has been minimized.

Copy link

Cronus89 commented Jul 25, 2017

I had a computer die on me after 6 years, I too wish I had an export function so I can save a copy of whats installed onto my Dropbox!

@dragon788

This comment has been minimized.

Copy link
Contributor

dragon788 commented Jul 25, 2017

@Cronus89

This comment has been minimized.

Copy link

Cronus89 commented Jul 25, 2017

Yes but I am looking for something automated. i could not find any command line arguments for the GUI that allow an auto export

@bcurran3

This comment has been minimized.

Copy link

bcurran3 commented Jul 25, 2017

I'm thinking it wouldn't be to hard to create PS script that would get the directory names (thus packages) from \programdata\chocolatey\lib, save it to a file, parse the package names to one line, add a cup in front of it (or cup in front of each line would probably be easier), then check for the existence of DropBox, OneDrive, Gdrive, and save the file in one or all of them.

The script could then just be distributed as a package; backup-choco-package-list or some such.

I might take this on. It would be a small challenge for me but I could learn from forcing my way through it, as I'm bad at parsing arrays. :) I'm willing to take it on in package form as a kludge until it's function is build into choco.

I'm guessing a sequel, restore-choco-package-list would then be in order.

@farmerbean

This comment has been minimized.

@bcurran3

This comment has been minimized.

Copy link

bcurran3 commented Aug 9, 2017

@itopiacloud

Thanks for the info. I checked it out and it didn't really do what I wanted, but it did give me some clues how to do what I wanted.

So until there is an official way to do this with Chocolatey... I did it my way! :)

Done! Off personal TDL:
https://chocolatey.org/packages/choco-package-list-backup

@youssefabidi

This comment has been minimized.

Copy link

youssefabidi commented Feb 11, 2018

I think that this issue is no longer blocked by #360 (if it ever was: I'm not sure I completely understand the discussion on that issue) because the packages.config file now accepts everything that can be passed during the installation of a package.

gep13 added a commit to gep13/choco that referenced this issue Jan 15, 2019

(chocolateyGH-357) Initial working version of Export Command
- This will need some refactoring, but at least functional
- This was the output from the live-stream that was done here:
https://www.youtube.com/watch?v=jFozwL8qizU

gep13 added a commit to gep13/choco that referenced this issue Jan 21, 2019

(chocolateyGH-357) Further refactoring of Export Command
- Still some work to be done here, but getting there
- This was the output from the live-stream that was done here:

gep13 added a commit to gep13/choco that referenced this issue Jan 21, 2019

(chocolateyGH-357) Initial working version of Export Command
- This will need some refactoring, but at least functional
- This was the output from the live-stream that was done here:
https://www.youtube.com/watch?v=jFozwL8qizU

gep13 added a commit to gep13/choco that referenced this issue Jan 21, 2019

(chocolateyGH-357) Further refactoring of Export Command
- Still some work to be done here, but getting there
- This was the output from the live-stream that was done here:
https://www.youtube.com/watch?v=ppc3eZtILVM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment