From fa45ea8ad39416eb68c6aa19971402e91f4c923a Mon Sep 17 00:00:00 2001
From: Jarrod Johnson <jjohnson2@lenovo.com>
Date: Wed, 21 Jul 2021 11:56:15 -0400
Subject: [PATCH] Finalize a captured image

---
 imgutil/imgutil | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/imgutil/imgutil b/imgutil/imgutil
index 645e84cb..9dc4a971 100644
--- a/imgutil/imgutil
+++ b/imgutil/imgutil
@@ -170,8 +170,12 @@ def capture_remote(opts, args):
     if os.path.exists('{}/profiles/default'.format(confdir)):
             copy_tree('{}/profiles/default'.format(confdir), outdir)
     label = '{0} {1} ({2})'.format(finfo['name'], finfo['version'], profname)
+    with open(os.path.join(outdir, 'profile.yaml'), 'w') as profileout:
+        profileout.write('label: {}\n'.format(label))
+        profileout.write('kernelargs: quiet installtodisk # remove installtodisk to boot stateless')
     subprocess.check_call(['chmod', 'o+r,go-w', '-R', outdir])
     subprocess.check_call(['chown', '-R', 'confluent', outdir])
+    subprocess.check_call(['osdeploy', 'updateboot', profname])
 
 
 def capture_system():