Fix self-update permissions

This PR fixes some wrong assertions and allow user to run "self update" command when he has write permission on the file and not the directory.
Fixes:
- Does not attempt to write backup if the directory is not writable
- Does not asserts that the backup's directory is writable when you run a rollback (because nobody write in this directory when you rollback)
- Restore the original permissions after updating

Improve:
- Check if the localFilename **or** it directory is writable
  - Use rename strategy when the directory is writable
  - Use content replace when the file is writable
- Restore the localFilename permissions instead of using the user's defaults
This looks wrong to me. The localFilename always needs to be writable, even when the folder is writable AFAIK