refs #975 postprocess the generated initrd

browser
Natalia Serrano 2024-10-17 17:49:13 +02:00 committed by Vadim Troshchinskiy
parent 01bdb2287b
commit 58dfcf5ca3
2 changed files with 15 additions and 2 deletions

View File

@ -33,7 +33,7 @@ RUN git clone -c http.sslVerify=false --branch ${OPENGNSYS_BRANCH} https://ognpr
git --git-dir /tmp/ogrepo/.git log --date format:r%Y%m%d --format=%ad -1 >/tmp/opengnsys/oglive_builder/gitrelease && \
rm -rf /tmp/ogrepo/
#RUN echo 0 ## development: invalidate docker cache at this point, so that the 'COPY' below actually copies files
## if we place the ogagent.deb and the ogbrowser.deb in the cwd, then this 'COPY .' copies them to the image
COPY . /tmp/opengnsys/oglive_builder/
RUN cp /tmp/opengnsys/oglive_builder/schroot.conf /tmp/opengnsys/oglive_builder/mount-defaults /etc/schroot/ && echo '' >/etc/schroot/default/nssdatabases && rm -f /etc/schroot/setup.d/*chrootname

View File

@ -108,10 +108,23 @@ def boottoolsInitrdGenerate (osrelease):
os.unlink (f)
shutil.copy ('/bin/busybox', '/usr/lib/initramfs-tools/bin')
initrd_img = f'/tmp/initrd.img-{osrelease}'
os.chdir ('/tmp')
utils.run (['mkinitramfs', '-o', f'/tmp/initrd.img-{osrelease}', osrelease])
utils.run (['mkinitramfs', '-o', initrd_img, osrelease])
shutil.copy (f'/boot/vmlinuz-{osrelease}', '/tmp/')
## turn cpio-with-prepended-stuff into a regular cpio, see #975
utils.run (['unmkinitramfs', initrd_img, 'undone'])
os.mkdir ('undone/merged')
subprocess.run (['rsync -aH undone/early/* undone/main/* undone/merged/'], shell=True)
shutil.rmtree ('undone/early')
shutil.rmtree ('undone/main')
os.chdir ('undone/merged/')
subprocess.run ([f'find . |cpio -H newc -oa >{initrd_img}'], shell=True)
os.chdir ('/tmp')
shutil.rmtree ('undone')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument ('--osarch', help='OS architecture', action='store', required=True)