repack_bootimg: Update cpio command arguments am: 186e549e76 am: c00759d02f am: e1d8f61536 am: 9fc414c8d7
Original change: https://android-review.googlesource.com/c/platform/system/tools/mkbootimg/+/1693669
Change-Id: I9d1a878c5a178ac94de6933c10188732c1dde03b
diff --git a/repack_bootimg.py b/repack_bootimg.py
index 3e07707..cad6058 100755
--- a/repack_bootimg.py
+++ b/repack_bootimg.py
@@ -115,18 +115,10 @@
# toybox cpio arguments:
# -i: extract files from stdin
# -d: create directories if needed
- cpio_result = subprocess.run(
- ['toybox', 'cpio', '-id'], check=False,
- input=decompressed_result.stdout, capture_output=True,
- cwd=self._ramdisk_dir)
-
- # toybox cpio command might return a non-zero code, e.g., found
- # duplicated files in the ramdisk. Treat it as non-fatal with
- # check=False and only print the error message here.
- if cpio_result.returncode != 0:
- print('\n'
- 'WARNNING: cpio command error:\n' +
- cpio_result.stderr.decode('utf-8').strip() + '\n')
+ # -u: override existing files
+ subprocess.run(
+ ['toybox', 'cpio', '-idu'], check=True,
+ input=decompressed_result.stdout, cwd=self._ramdisk_dir)
print("=== Unpacked ramdisk: '{}' ===".format(
self._ramdisk_img))