deploy_chrome: Reboot if D-Bus files changed.
D-Bus service files are read and configured at boot, and can be updated
when deploy_chrome is run. To prevent users from having to deal with
mysterious bugs, we reboot the system after copying files on any changes
to /opt/google/chrome/dbus.
BUG=chromium:701617
TEST=Manually tested with and without modifying D-Bus files.
Change-Id: I2fd95f6cea4838c2335ef5e56830fb2466f02009
Reviewed-on: https://chromium-review.googlesource.com/477151
Commit-Ready: Justin TerAvest <teravest@chromium.org>
Tested-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/deploy_chrome.py b/scripts/deploy_chrome.py
index e5fef47..9833254 100644
--- a/scripts/deploy_chrome.py
+++ b/scripts/deploy_chrome.py
@@ -129,6 +129,12 @@
error_code_ok=True, capture_output=True)
return result.returncode == 0
+ def _Reboot(self):
+ # A reboot in developer mode takes a while (and has delays), so the user
+ # will have time to read and act on the USB boot instructions below.
+ logging.info('Please remember to press Ctrl-U if you are booting from USB.')
+ self.device.Reboot()
+
def _DisableRootfsVerification(self):
if not self.options.force:
logging.error('Detected that the device has rootfs verification enabled.')
@@ -152,10 +158,7 @@
for partition in (KERNEL_A_PARTITION, KERNEL_B_PARTITION):
self.device.RunCommand(cmd % partition, error_code_ok=True)
- # A reboot in developer mode takes a while (and has delays), so the user
- # will have time to read and act on the USB boot instructions below.
- logging.info('Please remember to press Ctrl-U if you are booting from USB.')
- self.device.Reboot()
+ self._Reboot()
# Now that the machine has been rebooted, we need to kill Chrome again.
self._KillProcsIfNeeded()
@@ -242,6 +245,8 @@
'hang during the transfer.')
def _Deploy(self):
+ old_dbus_checksums = self._GetDBusChecksums()
+
logging.info('Copying Chrome to %s on device...', self.options.target_dir)
# Show the output (status) for this command.
dest_path = _CHROME_DIR
@@ -263,6 +268,12 @@
self.device.RunCommand('chmod %o %s/%s' % (
p.mode, dest_path, p.src if not p.dest else p.dest))
+ new_dbus_checksums = self._GetDBusChecksums()
+ if old_dbus_checksums != new_dbus_checksums:
+ logging.info('Detected change to D-Bus service files, rebooting.')
+ self._Reboot()
+ return
+
if self.options.startui:
logging.info('Starting UI...')
self.device.RunCommand('start ui')
@@ -308,6 +319,15 @@
# Chrome needs partition to have exec and suid flags set
self.device.RunCommand(_SET_MOUNT_FLAGS_CMD % (self.options.mount_dir,))
+ def _GetDBusChecksums(self):
+ """Returns Checksums for D-Bus files deployed with Chrome.
+
+ This is used to determine if a reboot is required after deploying Chrome.
+ """
+ result = self.device.RunCommand('md5sum /opt/google/chrome/dbus/*',
+ error_code_ok=True)
+ return result.output
+
def Cleanup(self):
"""Clean up RemoteDevice."""
if not self.options.staging_only: