bluetooth: upgrade the apt-clone system update process

To better handle the exception caused by apt-clone, the following
changes have been implemented to the apt-clone restore process:

1. Before archive the apt-clone folder, the trusted.gpg permission is
   updated to ensure its accessibility by apt-key during the restore
   process.
2. Stop the apt-related processes after the update fails to avoid
   potential lock of the frontend.
3. Set the dpkg always to use the old configuration file when the
   updated package comes with a newer configuration file to prevent
   user interaction requests.
4. apt-clone now run with DEBIAN_FRONTEND=noninteractive to prevent
   prompt window asking user interaction.
5. No longer suppress the stdout for the process to help debug.
6. Try to fix the setups and configures installed/updated packages if
   uprev failed.
7. Overwrite bundle commit hash to empty to trigger a re-update when
   fails.
8. Reboot the device when uprev succeeds to have all changes take
   effect.

BUG=b:184751686
TEST=make remote-install CHAMELEON_HOST=0.0.0.0

Change-Id: I8ed6a3a9e7c76e8ab1c000972e37f024f0c94014
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/chameleon/+/2803980
Tested-by: Michael Sun <michaelfsun@google.com>
Reviewed-by: Shijin Abraham <shijinabraham@google.com>
Commit-Queue: Michael Sun <michaelfsun@google.com>
1 file changed