lindegroup / autopkgr

AutoPkgr is a free Mac app that makes it easy to install and configure AutoPkg.
http://www.lindegroup.com/autopkgr
Apache License 2.0
532 stars 51 forks source link

WHERE does AutoPkgr store the list of checked repos it shows on launch? It is NOT loading them from com.github.autopkg.plist #707

Closed fseesink closed 5 months ago

fseesink commented 5 months ago

I recently moved my AutoPkgr setup to a new Mac. Using similar techniques to what I've done before (it's been awhile), I copied over the ~/Library/AutoPkg/ directory, along with various other things as noted in threads like this: https://groups.google.com/g/autopkg-discuss/c/euxx3IxdzJg

And looking specifically at the original file in /Users/<account>/Library/Preferences/com.github.autopkg.plist, I can see this list contains the checked repos that I see in the AutoPkgr GUI. At least on the original setup.

However, no matter what I do in copying over that file to the new system, no matter what, AutoPkgr doesn't load that. Instead it starts up with none of the repos checked. So to test, I checked one repo, then quit AutoPkgr. Sure enough, that file is then updated to reflect that single repo.

However, if I now again copy over this file from the original (where it had many repos checked), and I fire up AutoPkgr, it only shows the single repo I checked previously. And as long as I don't touch it, that file doesn't change. But if in AutoPkgr I now select a 2nd repo, THEN it will write that out to that file.

So clearly the AutoPkgr program itself is NOT using that .plist file when it loads the app. Yet AutoPkgr remembers whatever repos (the 1 or 2 in this case) that I checked. So it MUST be storing this somewhere. I simply cannot figure out where!

Could someone enlighten me please? This is infuriating as I would like to simply transfer an existing setup to a new system intact. And as AutoPkgr doesn't offer any simple import/export of its config, my only option is copying over the relevant bits. But there's a disconnect here and I can't determine where AutoPkgr is storing what it shows. It's clear if I change anything, then it writes out those changes to that file. But it is NOT using that file on launch to populate which repos to check.

shawnhonsberger commented 5 months ago

Hi @fseesink! You could try the Cache folder, but I don't believe that would work. However, please note on step 10 of the guide you referenced that it is recommended to manually re-add the repos:

  1. On your new Mac, launch AutoPkgr. In the Repos & Recipes tab, check the boxes for each repository you need. (This would include any repository that contains a parent recipe for the overrides in your recipe list. Also any parents of parents, if they live in separate repos.) Note: The reason I recommend re-adding the repos manually instead of trying to copy over the RecipeRepos folder is because Git is picky about permissions, and re-cloning will ensure you aren't held back by permissions issues later.

Also for reference, the recipe list is stored here: ~/Library/Application\ Support/AutoPkgr/recipe_list.txt. You can copy it over too, if necessary. Hopefully this helps!

fseesink commented 5 months ago

As for step 10, I understand that. But that's mentioned due to Git and permissions issues. And yes, I'm aware of the recipe_list.txt file as well. But neither of those address this.

My question stands. Where does the AutoPkgr app itself store what we see as checked repos? Because it is absolutely NOT in any of the usual places (~/Library/Preferences/, ~/Library/Application Support, etc.). It is clear that somehow it is storing the repos that you check in it Preferences... GUI panel. And it is also clear that any time you make a change to one of the checkboxes, it then writes out its config to /Users/<account>/Library/Preferences/com.github.autopkg.plist. But it remains a mystery to me where exactly AutoPkgr itself is storing its config as seen in the UI.

fseesink commented 5 months ago

To be clear, the link I provided and the steps given, including under the "power user" bit, will NOT give you a functioning AutoPkgr setup on a new system. You will still have to manually check the boxes of the repos yourself in the AutoPkgr GUI, one at a time. And this means first knowing which repos you had checked in the old setup. So you either have to have the systems in front of you (physically or virtually) and do a "stare and compare", or you have to open that .plist file in an editor, then go through that list, checking the respective repos in the GUI.

It's just odd that the app doesn't simply use that .plist file when it launches to load up and show the state. Which means it's a unidirectional tool. It only "pushes" config to the file. But as the state of AutoPkgr is stored elsewhere, you can't transfer that to a new system.

shawnhonsberger commented 5 months ago

Hi @fseesink have you actually completed all the migration steps? It's not clear from your original message that you did.

As far as I understand, I do not believe that the checkboxes are transferrable in any functional way. The checkboxes are stored in an encoded form in ~/Library/Preferences/com.lindegroup.AutoPkgr.plist. The repos are stored in ~/Library/Preferences/com.github.autopkg.plist, but as has been mentioned there are permissions issues with repos. Since the checkboxes are intrinsically tied to the repos, once checked to be added, it follows that the checkboxes cannot be successfully copied, if the underlying repos cannot be transferred.

For a task like this in the past, I've usually made a modified version of a setup script such as TBridge's Munki-in-a-Box, or RTrouton's AutoPkg Setup for Jamf Pro, (though this example uses JSSImporter and not the current JamfUploader) as both have example functions to add a declarative set of repos automatically on any new system to automatically replicate your setups. A script like one of these can make your fresh setups much smoother, and then you can leverage AutoPkgr for schedule and notifications. Thanks.

fseesink commented 5 months ago

I did actually complete the migration steps yes. And yes, that includes copying over the files

and all the rest.

But as mentioned, it does not give you a full copy, as AutoPkgr on the new system still acts as if it's never been run before, as opposed to showing the list of repos from the latter file and the checkmarks you say are stored in encoded form in the former file.

In the end I resolved the issue by simply doing a "stare & compare", manually checking each repo. And as I did so, it slowly populated the list of checked apps (taken from the file ~/Library/AutoPkg/recipes.txt), so at least I didn't have to do that (once I had the right repos checked of course). However, if I hadn't had the old setup to look at, I wouldn't know which repos I needed to check.

But point is that it means a true/proper backup of an AutoPkgr setup isn't really possible as it stands right now. It was just a bit more frustrating than expected is all. Would be nice if when you copy over the various files that, in fact, the new AutoPkgr setup is configured/works just like the old. That's just not the case. I also had to redo various other settings including notifications and where the Munki repo was, as those settings did not transfer either.

Don't get me wrong. Overall I think AutoPkgr is a great tool. I've used it for years and really appreciate the effort that went into it. So I'm not looking a gift horse in the mouth. To anyone who manages Macs I have pointed them at Munki and AutPkgr, as it's quite a killer combo. So thanks to all who were involved with it.

But if feature requests are still being taken, having a simple mechanism by which someone can backup an entire AutoPkgr setup (the way you can in many apps), then restore that to another system so it's fully ready to go would be a nice feature. :-)

shawnhonsberger commented 5 months ago

Thanks @fseesink. I use a setup script to do it all, so I can automate everything. But's it's unfortunately not practical or scalable to incorporate it into AutoPkgr.

The common thing I used to do before that is just copy over the recipe list, update trust info for all recipe overrides via some variant of autopkg update-trust-info, and then manually run the whole list from autopkg e.g. /usr/local/bin/autopkg run --recipe-list ~/Library/Application\ Support/AutoPkgr/recipe_list.txt, then autopkg tells you what repos are dependent and I need to add. Once I could run that without issue, I would launch AutoPkgr and get things scheduled and notified.

Thanks again! :)