MacOS: zsh Terminal and other misc restore/configuration portability...



Summary:
I bought a new macbook pro and typical behavior is to use time machine to restore.  This method is perfectly acceptable 99% of the time.  Those that mess w/ kext, sudoers, and other jazz... not so much.  I originally did a time machine restore, but that brought over a mess of things that I quite frankly had forgotten about (I like to tinker) and that was unfair to my new macbook.  Needless to say, but I bricked my new macbook which led me to Konmari my setup.

Details:
Then there is the portability aspect of my terminal environment that I've been so lacking.  In combination w/ Dropbox, I'm able to move this stuff around and keep things in sync much easier now.

Basically restoring bash/zsh alias is a pain.  Modifying any of these things is also a hassle.  So I developed a shell script that will basically take files that exist in my Dropbox directory and symlink the original files back to Dropbox.

This way I can simply run this shell script on any new system and it'll restore my terminal environment as I like it.  I get the added benefit of making changes to these Dropbox configuration files and it'll automatically get synced w/ my other systems.  This way I don't have to maintain a sync of my environment configurations through some other method.

This same scheme could also be done through git as well, albeit, publicly.  Utilizing iCloud to sync Desktop and Documents "might" work as well.

Script:
The script is made for MacOS, but could be adapted for Linux.
It does the following as of this posting:
  • Symlinks SSH config files in your .ssh directory to dropbox.
  • Symlinks zsh plugins to your oh-my-zsh/plugins to dropbox.
  • Symlinks zsh themes to your oh-my-zsh/themes to dropbox.
  • Symlinks Cisco Anyconnect VPN profiles to dropbox.
  • Symlinks customsudo files to your /etc/sudoers.d to dropbox.
    • This one will do a visudo check to confirm your syntax is correct ONLY.
    • It is still possible to break sudo w/ a syntactically correct sudo file.
    • Remove this if you don't need it.  I simply use it to remove sshuttle's need for sudo.
  • Installs brew if not detected.
  • Installs oh-my-zsh if not detected.
I'll probably be fiddling w/ this for awhile, so you'll likely see modifications/updates on gist.



Comments

Popular Posts