def fix_aroma(directory, bootimg = None, device_check = True,
              partition_config = None):
  updater_script = 'META-INF/com/google/android/updater-script'
  lines = fileio.all_lines(updater_script, directory = directory)

  i = 0
  while i < len(lines):
    if re.search('getprop.*/system/build.prop', lines[i]):
      i += autopatcher.insert_mount_system(i, lines)
      i += autopatcher.insert_mount_cache(i, lines)
      i += autopatcher.insert_mount_data(i, lines)
      lines[i] = re.sub('/system', partition_config.target_system, lines[i])

    i += 1

  fileio.write_lines(updater_script, lines, directory = directory)
def handle_bundled_mount(directory, bootimg = None, device_check = True,
                         partition_config = None):
  updater_script = 'META-INF/com/google/android/updater-script'
  lines = fileio.all_lines(updater_script, directory = directory)

  i = 0
  while i < len(lines):
    if re.search('/tmp/mount.*/system', lines[i]):
      del lines[i]
      i += autopatcher.insert_mount_system(i, lines)

    elif re.search('/tmp/mount.*/cache', lines[i]):
      del lines[i]
      i += autopatcher.insert_mount_cache(i, lines)

    elif re.search('/tmp/mount.*/data', lines[i]):
      del lines[i]
      i += autopatcher.insert_mount_data(i, lines)

    else:
      i += 1

  fileio.write_lines(updater_script, lines, directory = directory)