build-browser #4

Merged
nserrano merged 5 commits from build-browser into main 2024-10-17 19:10:45 +02:00
4 changed files with 22 additions and 21 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

@ -41,15 +41,6 @@ Y también podemos indicar otro archivo de configuración usando --config.
Las imágenes se crean en ./ogclient. Es conveniente crear este directorio con antelación, antes de ejecutar docker, porque de este modo el directorio queda con permisos de usuario. De lo contrario, docker lo crearía como root y necesitaríamos sudo para hacer cualquier cosa dentro de él.
Puede que durante la ejecución del contenedor salga un error como este una o más veces:
Exception ignored in: <function _acquireLock at 0x7fdac10f1f80>
Traceback (most recent call last):
File "/usr/lib/python3.12/logging/__init__.py", line 241, in _acquireLock
_lock.acquire()
Es un bug conocido en la biblioteca "logging" de python, para el cual ya existe solución y solo es cuestión de tiempo que la versión de python incluida en ubuntu incluya el fix.
Descripción de la estrucutra de boot-tools
------------------------------------------

View File

@ -239,10 +239,6 @@ def copy_og_files (builder, og_shared, og_engine, ogclientmount, osdistrib, osco
subprocess.run (f'rsync -aH {og_shared}/lib/fonts {ogclientmount}/usr/local/lib', shell=True)
subprocess.run (f'rsync -aH {og_shared}/lib/qtplugins/* {ogclientmount}/usr/local/plugins', shell=True)
# Browser y ogAdmClient.
if os.path.exists (f'{og_shared}/bin/browser'): shutil.copy (f'{og_shared}/bin/browser', f'{ogclientmount}/bin/')
if os.path.exists (f'{og_shared}/bin/ogAdmClient'): shutil.copy (f'{og_shared}/bin/ogAdmClient', f'{ogclientmount}/bin/')
def sysctl (btrootfsmnt):
logger.debug ('copiando sysctl.conf')
with open (f'{btrootfsmnt}/etc/sysctl.conf', 'w') as fd:
@ -369,16 +365,17 @@ def mkisofs (pxepkg, isolinux_tpl, bttargetdir, nameisoclient):
#el ogclienteToISO debe tener una copia del ogvmlinuz como linuxISO
#cp -prv /var/lib/tftpboot/ogclientToIso/* /tmp/iso/ogclient
today = datetime.datetime.now(datetime.timezone.utc).strftime ('%Y%m%d')
oldpwd = os.getcwd()
os.chdir ('/tmp')
logger.debug (f'mkisofs -quiet -V ogClient -o {nameisoclient}.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -J -no-emul-boot -boot-load-size 4 -boot-info-table /tmp/iso')
utils.run (['mkisofs', '-quiet', '-V', 'ogClient', '-o', f'{nameisoclient}.iso', '-b', 'isolinux/isolinux.bin', '-c', 'isolinux/boot.cat', '-J', '-no-emul-boot', '-boot-load-size', '4', '-boot-info-table', '/tmp/iso'])
logger.debug (f'mkisofs -quiet -V ogClient -o {nameisoclient}-{today}.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -J -no-emul-boot -boot-load-size 4 -boot-info-table /tmp/iso')
utils.run (['mkisofs', '-quiet', '-V', 'ogClient', '-o', f'{nameisoclient}-{today}.iso', '-b', 'isolinux/isolinux.bin', '-c', 'isolinux/boot.cat', '-J', '-no-emul-boot', '-boot-load-size', '4', '-boot-info-table', '/tmp/iso'])
utils.write_md5 (f'{nameisoclient}.iso')
utils.write_md5 (f'{nameisoclient}-{today}.iso')
os.chdir (oldpwd)
shutil.move (f'/tmp/{nameisoclient}.iso' , f'/var/lib/tftpboot/ogclient/{nameisoclient}.iso')
shutil.move (f'/tmp/{nameisoclient}.iso.sum', f'/var/lib/tftpboot/ogclient/{nameisoclient}.iso.sum')
shutil.move (f'/tmp/{nameisoclient}-{today}.iso' , f'/var/lib/tftpboot/ogclient/{nameisoclient}-{today}.iso')
shutil.move (f'/tmp/{nameisoclient}-{today}.iso.sum', f'/var/lib/tftpboot/ogclient/{nameisoclient}-{today}.iso.sum')
#def __unused_boottoolsBootGraphics():
# find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null;

View File

@ -40,7 +40,7 @@ def boottoolsSoftwareInstall (osarch, osrelease):
subprocess.run (['debconf-set-selections'], input=debconf_settings, text=True)
utils.run (['dpkg-reconfigure', '--frontend', 'noninteractive', 'console-setup', 'locales']) ## XXX: despues de esto, debconf-get-selections devuelve los valores antiguos, no se por que...
pkgs = []
pkgs = glob.glob ('/tmp/opengnsys/oglive_builder/ogagent_*.deb') + glob.glob ('/tmp/opengnsys/oglive_builder/OGBrowser*.deb')
for section in config.options('Packages'):
pkgs += re.split (r'[ \n]', config['Packages'].get(section).strip())
@ -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)