diff --git a/mkoglive.py b/mkoglive.py index cda4cec..16b03a9 100755 --- a/mkoglive.py +++ b/mkoglive.py @@ -70,13 +70,15 @@ def _debootstrap (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp): sys.exit (1) utils.umount (btrootfsmnt) -def _initramfs_version (f, osrelease): +def _initramfs_version (f, oglive_version, osrelease): + today = datetime.datetime.now(datetime.timezone.utc).strftime ('%Y%m%d') fd = open (f'{curdir}/gitrelease', 'r') ## per the Dockerfile gitrelease = fd.readline().strip() fd.close() - today = datetime.datetime.now(datetime.timezone.utc).strftime ('%Y%m%d') - utils.run (['sed', '-i', f'1 s/$/ {gitrelease}_{today} ({osrelease})/', f]) + fd = open (f, 'w') + fd.write (f'OpenGnsys Client {oglive_version} {gitrelease}_{today} ({osrelease})\n') + fd.close() def _copy_og_files (btrootfsimg, btrootfsmnt, osdistrib, oscodename): _mount_rootfs (btrootfsimg, btrootfsmnt) @@ -121,6 +123,10 @@ def _main (cfgfile, config, type_client): logger.info ('OpenGnsys CLIENT installation begins') + fd = open (version_file, 'r') + oglive_version = fd.readline().strip() + fd.close() + osdistrib, oscodename, osrelease, osarch, oshttp = btog.GetOsInfo (type_client) if osdistrib is None: logger.error ('GetOsInfo() failed') @@ -137,7 +143,7 @@ def _main (cfgfile, config, type_client): _debootstrap (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp) logger.info ('STAGE 2 - copy files to the rootfs') - _initramfs_version (version_file, osrelease) + _initramfs_version (version_file, oglive_version, osrelease) _copy_og_files (btrootfsimg, btrootfsmnt, osdistrib, oscodename) logger.info ('STAGE 3 - perform tasks within the chroot') @@ -147,9 +153,6 @@ def _main (cfgfile, config, type_client): logger.info ('STAGE 4 - generate distribution files') pxepkg = _get_pxepkg() - fd = open (version_file, 'r') - oglive_version = fd.readline().strip() - fd.close() nameisoclient = '-'.join (['ogLive', oscodename, osrelease, osarch, oglive_version]) _mkinitrd_squashfs_isofs (bttargetdir, osrelease, btrootfsimg, btrootfsmnt, pxepkg, isolinux_tpl, nameisoclient) diff --git a/schroot.conf b/schroot.conf index bc0cd3c..e073bbe 100644 --- a/schroot.conf +++ b/schroot.conf @@ -9,4 +9,6 @@ groups=root root-groups=root root-users=root +## man 5 schroot.conf +## "In addition to the configuration keys listed above, it is possible to add custom keys. These keys will be used to add additional environment variables to the setup script environment when setup scripts are run" setup.copyfiles=