Port Shelnutt's loki patch from CWM to TWRP

An option is added to the settings page where a user can choose to
enable loki on-the-fly support (enabled by default).
If enabled, TWRP will verify and patch recovery and boot partitions
after flashing via a flash file or adb_install.