diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:58:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:58:37 +0000 |
commit | 1a8735eba80a492bd0247993983757787e27fa1a (patch) | |
tree | 27bdc0897bca0a74a3148f03216e91a19bdbdb5e /bin/sbuild-qemu-update | |
parent | Releasing progress-linux version 0.85.10-0.0~progress7.99u1. (diff) | |
download | sbuild-1a8735eba80a492bd0247993983757787e27fa1a.tar.xz sbuild-1a8735eba80a492bd0247993983757787e27fa1a.zip |
Merging upstream version 0.85.11.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | bin/sbuild-qemu-update | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/sbuild-qemu-update b/bin/sbuild-qemu-update index 6e08274..2de7ab5 100755 --- a/bin/sbuild-qemu-update +++ b/bin/sbuild-qemu-update @@ -180,6 +180,12 @@ def update_interaction(child, quiet): child.expect('root@host:~# ') child.sendline('sync') child.expect('root@host:~# ') + child.sendline('mount -o remount,discard /') + child.expect('root@host:~# ') + child.sendline('fstrim /') + child.expect('root@host:~# ') + child.sendline('sync') + child.expect('root@host:~# ') # Don't recall what issue this solves, but it solves it child.sendline('sleep 1') child.expect('root@host:~# ') @@ -257,7 +263,7 @@ def main(): '-m', '1024', '-smp', '1', '-nographic', - image, + '-drive', f'file={image},discard=unmap,if=virtio', ]) if parsed_args.extra_args: args.extend(parsed_args.extra_args) @@ -278,6 +284,14 @@ def main(): except pexpect.TIMEOUT: print("Update timed out. Consider using --timeout.", file=sys.stderr) child.terminate() + child.wait() + + try: + subprocess.check_call(["qemu-img", "convert", "-O", "qcow2", image, f"{image}.tmp"]) + except subprocess.CalledProcessError as err: + print(f"Error converting image: {err}", file=sys.stderr) + return + os.replace(f"{image}.tmp", image) if __name__ == '__main__': |