Jrbl/new auto upgrade

@caesar2164 this is your previous set of changes, rebased and squashed, with my newer changes added on top; this version doesn't require the passphrase dialog.

Please look it over and press the green button.
Yeah, I think this will be a decent base to build from later.