From 5422f904f95ce2fbfd873fa114bd207f12529ea8 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 3 Sep 2021 12:11:10 -0400 Subject: [PATCH] Add a breadcrumb for scripts to detect exec context --- imgutil/imgutil | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imgutil/imgutil b/imgutil/imgutil index 619a2307..46d19e4d 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -680,6 +680,7 @@ def exec_root_backend(args): os.chroot(installroot) os.chdir('/') os.environ['PS1'] = '[\x1b[1m\x1b[4mIMGUTIL EXEC {0}\x1b[0m \W]$ '.format(imgname) + os.environ['CONFLUENT_IMGUTIL_MODE'] = 'exec' if args.cmd: if not args.cmd[0].startswith('/'): args.cmd[0] = shutil.which(args.cmd[0]) @@ -708,7 +709,7 @@ def build_root_backend(optargs): _mount_constrained_fs(args, installroot) oshandler.prep_root(optargs) mkdirp(os.path.join(installroot, 'etc/')) - with open(os.path.join(installroot, 'etc/img.buildinfo'), 'w') as imginfo: + with open(os.path.join(installroot, 'etc/confluentimg.buildinfo'), 'w') as imginfo: imginfo.write('BUILDDATE={}\n'.format(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M'))) if args.source: imginfo.write('BUILDSRC={}\n'.format(args.source)) @@ -963,7 +964,7 @@ def pack_image(args): raise Exception('Full path not supported, supply only the profile name') privdir = os.path.join('/var/lib/confluent/private/os/', outdir) outdir = os.path.join('/var/lib/confluent/public/os/', outdir) - imginfofile = os.path.join(args.scratchdir, 'etc/img.buildinfo') + imginfofile = os.path.join(args.scratchdir, 'etc/confluentimg.buildinfo') distpath = None try: with open(imginfofile) as imginfoin: