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

Scripts to backup and restore settings modified by .osx #58

Closed
wants to merge 9 commits into from
Closed

Scripts to backup and restore settings modified by .osx #58

wants to merge 9 commits into from

Conversation

mozmorris
Copy link

I noticed quite a few people were worried about permanently losing the OS defaults, so I created a couple of scripts to backup and then restore the settings.

The backup script osx_backup.sh needs to be run before .osx. This could potentially be called from .osx automatically.

The settings are backed up to a text file .osx_settings_backup in the format <setting> : <value>. This file I've added to the ignores.

The restore script osx_restore.sh uses the backup file to restore all the settings.

I've been using both scripts with success on a couple of machines. Not a problem if you think it's overkill, but it might come in handy for a few people. Let me know what you think.

@franciscolourenco
Copy link
Contributor

If new settings are added to .osx, it won't be possible to run the script again without deleting the backup and then it would be restoring already modified settings. It needs to compare the settings which were already backed up, with the ones present in .osx. Even then, there is a change that you are backing up previously modified values.

Although the backup script has a lot of value, another useful solution would be to have a .osx.reset which is similar to .osx , but configured with the OS X default values. For each new setting added to .osx, a equivalent setting with the defautl value would have to be added to .osx.reset.

@mozmorris
Copy link
Author

Okay, so I get what you're saying but I think there is already a way around the problem.

To clarify, the problem is essentially this: "New settings being added to .osx, woud not be present in the backup."

To get around this:

  1. Run the restore script, so that all settings have been returned to their default values. (Now safe to move/delete backup)
  2. Run the backup script, which automatically inspects the .osx script for the settings being modified and results in an up to date backup of default values.
  3. Finally, you run the .osx to modify the system settings.

You could even incorporate this into a single script.

BTW, excuse the large number of commits in the pull request.

* 'master' of github.com:MozMorris/dotfiles:
  Friendly output messages and regex on '-array-add' as a setting type
  Handle many of the backup settings automatically using some grep and sed power
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants