=== modified file 'linaro-android-media-create'
@@ -44,7 +44,9 @@
additional_android_option_checks,
andorid_hwpack_in_boot_tarball,
ensure_command,
- get_logger
+ get_logger,
+ disable_automount,
+ enable_automount,
)
@@ -117,6 +119,10 @@
ensure_required_commands(args)
+ # Do this by default, disable automount options and re-enable them at exit.
+ disable_automount()
+ atexit.register(enable_automount)
+
media = Media(args.device)
if media.is_block_device:
if not confirm_device_selection_and_ensure_it_is_ready(args.device):
=== modified file 'linaro-media-create'
@@ -57,6 +57,9 @@
path_in_tarfile_exists,
prep_media_path,
get_logger,
+ UnableToFindPackageProvidingCommand,
+ disable_automount,
+ enable_automount,
)
# Just define the global variables
@@ -136,6 +139,10 @@
logger.error(e.value)
sys.exit(1)
+ # Do this by default, disable automount options and re-enable them at exit.
+ disable_automount()
+ atexit.register(enable_automount)
+
board_config = get_board_config(args.dev)
board_config.set_metadata(args.hwpacks, args.bootloader, args.dev)
board_config.add_boot_args(args.extra_boot_args)
=== modified file 'linaro_image_tools/utils.py'
@@ -35,6 +35,10 @@
# The name of the hwpack file found in the boot tarball.
HWPACK_NAME = "config"
+# dconf keys to disable automount options.
+AUTOMOUNT_DCONF_KEY = '/org/gnome/desktop/media-handling/automount'
+AUTOMOUNT_OPEN_DCONF_KEYU = '/org/gnome/desktop/media-handling/automount-open'
+
# try_import was copied from python-testtools 0.9.12 and was originally
# licensed under a MIT-style license but relicensed under the GPL in Linaro
@@ -406,3 +410,42 @@
logger.addHandler(ch)
return logger
+
+
+def disable_automount():
+ """Disables the desktop environment automount option.
+
+ This will work only under GNOME with dconf installed.
+ """
+ logger = logging.getLogger(DEFAULT_LOGGER_NAME)
+
+ if has_command('dconf'):
+ logger.info("Disabling desktop environment automount option.")
+ try:
+ cmd_runner.run(
+ ['dconf', 'write', AUTOMOUNT_DCONF_KEY, 'false'],
+ stdout=open('/dev/null', 'w')).wait()
+ cmd_runner.run(
+ ['dconf', 'write', AUTOMOUNT_OPEN_DCONF_KEYU, 'false'],
+ stdout=open('/dev/null', 'w')).wait()
+ except cmd_runner.SubcommandNonZeroReturnValue:
+ logger.error("Error disabling desktop environemnt automount.")
+
+
+def enable_automount():
+ """Re-enables back the desktop environment automount option.
+
+ This will work only under GNOME with dconf installed. It should be run
+ as an atexit function.
+ """
+ logger = logging.getLogger(DEFAULT_LOGGER_NAME)
+ if has_command('dconf'):
+ try:
+ cmd_runner.run(
+ ['dconf', 'write', AUTOMOUNT_DCONF_KEY, 'true'],
+ stdout=open('/dev/null', 'w')).wait()
+ cmd_runner.run(
+ ['dconf', 'write', AUTOMOUNT_OPEN_DCONF_KEYU, 'true'],
+ stdout=open('/dev/null', 'w')).wait()
+ except cmd_runner.SubcommandNonZeroReturnValue:
+ logger.error("Error enabling back desktop environemnt automount.")