refs #596 some cleanup, move code around

pull/1/head
Natalia Serrano 2024-08-14 13:21:18 +02:00
parent 727cd1a666
commit f04ace2b3c
5 changed files with 114 additions and 179 deletions

View File

@ -6,20 +6,14 @@ import subprocess
import shutil
import argparse
#VERSIONBOOTTOOLS="ogLive"
#nameisoclientfile = '/tmp/opengnsys_info_rootfs'
#namehostclientfile = '/tmp/opengnsys_chroot'
svnclientdir = '/tmp/opengnsys/oglive_builder'
svnclientstructure = '/tmp/opengnsys/shared'
svnclientengine = '/tmp/opengnsys/engine'
def boottoolsFsOpengnsys (ogclientmount, osdistrib, oscodename, osrelease, osarch, oshttp):
print (':'.join ([osdistrib, oscodename, osrelease, osarch, oshttp]))
print ('Iniciando la personalización con datos del repositorio')
#sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/includes/etc/apt/sources.list.${OSDISTRIB,,} > ${SVNCLIENTDIR}/includes/etc/apt/sources.list
sources_list_in = f'{svnclientdir}/includes/etc/apt/sources.list.{osdistrib.lower()}'
sources_list_out = f'{svnclientdir}/includes/etc/apt/sources.list'
fdin = open (sources_list_in, 'r')
@ -42,7 +36,6 @@ def boottoolsFsOpengnsys (ogclientmount, osdistrib, oscodename, osrelease, osarc
subprocess.run (f'rsync -aH {svnclientstructure}/* {ogclientmount}/opt/opengnsys/' , shell=True)
subprocess.run (f'rsync -aH {svnclientengine}/* {ogclientmount}/opt/opengnsys/lib/engine/bin/', shell=True)
# Si no existe, copiar pci.ids.
if not os.path.exists (f'{ogclientmount}/etc/pci.ids'):
shutil.copy (f'{svnclientstructure}/lib/pci.ids', f'{ogclientmount}/etc/')
@ -56,10 +49,6 @@ def boottoolsFsOpengnsys (ogclientmount, osdistrib, oscodename, osrelease, osarc
if os.path.exists (f'{svnclientstructure}/bin/browser'): shutil.copy (f'{svnclientstructure}/bin/browser', f'{ogclientmount}/bin/')
if os.path.exists (f'{svnclientstructure}/bin/ogAdmClient'): shutil.copy (f'{svnclientstructure}/bin/ogAdmClient', f'{ogclientmount}/bin/')
# El fichero de configuración debe sustituir a los 2 ficheros (borrar las 2 líneas).
#echo "${VERSIONBOOTTOOLS}-${OSCODENAME}-${OSRELEASE}-${GITRELEASE}" > $nameisoclientfile
#echo "${VERSIONBOOTTOOLS}-${OSCODENAME}-${GITRELEASE}" > $namehostclientfile
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument ('--mntpt', help='rootfs mount point', action='store', required=True)

View File

@ -37,15 +37,15 @@ def _oghook_activate():
#Activamos el hook del oginitrd.img
os.rename ('/etc/initramfs-tools/oghooks', '/etc/initramfs-tools/hooks/oghooks')
def _mock_mtab():
# Preparamos el mtab necesario para la instalacion correcta de paquetes.
#echo "/dev/sda1 / ext4 rw,errors=remount-ro 0 0" > /etc/mtab ## nati: falla porque es un symlink a ../proc/self/mounts
pass
#def _mock_mtab():
# # Preparamos el mtab necesario para la instalacion correcta de paquetes.
# #echo "/dev/sda1 / ext4 rw,errors=remount-ro 0 0" > /etc/mtab ## nati: falla porque es un symlink a ../proc/self/mounts
# pass
def _restore_mtab():
# Dejamos el mtab como al principio
#echo " " > /etc/mtab
pass
#def _restore_mtab():
# # Dejamos el mtab como al principio
# #echo " " > /etc/mtab
# pass
def boottoolsSoftwareInstall (osarch, osrelease):
os.environ['LANGUAGE'] = 'C'
@ -58,9 +58,6 @@ def boottoolsSoftwareInstall (osarch, osrelease):
_run (['dpkg-divert', '--local', '--rename', '--add', '/sbin/initctl'])
os.symlink ('/bin/true', '/sbin/initctl')
#TEST desactivamos upstart
#apt-get update; apt-get install --no-install-recommends dbus; dbus-uuidgen > /var/lib/dbus/machine-id; dpkg-divert --local --rename --add /sbin/initctl; ln -s /bin/true /sbin/initctl
_aptget_clean()
pkgs32 = []
if 'i386' != osarch:
@ -70,20 +67,19 @@ def boottoolsSoftwareInstall (osarch, osrelease):
_aptget_update() ## esto ya esta hecho...
_oghook_deactivate()
_aptget_upgrade()
_mock_mtab()
#_mock_mtab()
# Instalamos el kernel.
_aptget_install ([f'linux-image-{osrelease}', f'linux-headers-{osrelease}', f'linux-modules-{osrelease}', f'linux-modules-extra-{osrelease}', 'dkms', 'shim-signed', 'openssl'])
subprocess.run (['debconf-set-selections'], input=debconf_settings, text=True)
## nati: hace falta --force-confdef para evitar un tema interactivo del /etc/ssh/ssh_config
_aptget_install (['sshfs', 'kexec-tools'] + pkgs32, opts=['-o', 'DPkg::Options::=--force-confdef'])
_aptget_install (['sshfs', 'kexec-tools'] + pkgs32, opts=['-o', 'DPkg::Options::=--force-confdef']) ## hace falta --force-confdef para evitar un tema interactivo del /etc/ssh/ssh_config
pkgs = []
for section in config.options('Packages'):
pkgs += re.split (r'[ \n]', config['Packages'].get(section).strip())
print ('about to install these packages: "{}"'.format (' '.join (pkgs)))
## TODO don't fail when there are unknown/uninstallable packages
_aptget_install (pkgs)
# Instalar módulos que algunos paquetes puedan tener pendientes de compilar.
@ -97,7 +93,7 @@ def boottoolsSoftwareInstall (osarch, osrelease):
_run (['dkms', 'install', '-m', mod.strip(), '-v', vers.strip()])
_oghook_activate()
_restore_mtab()
#_restore_mtab()
_aptget_clean()
_aptget_autoclean()
_aptget_autoremove()

View File

@ -5,13 +5,8 @@ import subprocess
from boottoolsfunctions import _run
os.environ['LANGUAGE'] = os.environ['LC_ALL'] = os.environ['LANG'] = 'C'
#source /opt/opengnsys/lib/engine/bin/ToolsGNU.c &>/dev/null
os.chdir ('/tmp')
## apt-get install wget gettext unzip git
print ('ms-sys')
try: _run (['which', 'ms-sys'])
except:

View File

@ -11,6 +11,34 @@ import configparser
logger = logging.getLogger ('boottools')
schroot_conf_tpl = """
[IMGogclient]
type=loopback
file=/var/lib/tftpboot/ogclient/ogclient.img
description=ogclient Ubuntu image
#priority=1
users=root
groups=root
root-groups=root
mount-options=-o offset=32256
root-users=root
""".strip()
mount_defaults_tpl = """
# mount.defaults: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
#procbususb /proc/bus/usb usbfs defaults 0 0
#/dev /dev none rw,bind 0 0
/dev/pts /dev/pts none rw,bind 0 0
/dev/shm /dev/shm none rw,bind 0 0
#/home /home none rw,bind 0 0
/tmp /tmp none rw,bind 0 0
""".strip()
def _run (args):
cp = subprocess.run (args, text=True, capture_output=True)
if cp.returncode:
@ -181,8 +209,6 @@ def btogGetOsInfo2 (ogrepo_dir, versionboottools, oscodename, osrelease, osarch)
return gitrelease, nameisoclient, namehostclient
def btogSetFsVirtual (btrootfsimg, btrootfsimglabel, btrootfsmnt, btvirtualdisksize, bttargetdir, osarch):
#if not btrootfsimg: btogGetVar()
logger.info (f'Creación y formateo del disco virtual "{btrootfsimg}" "{btvirtualdisksize}" MB')
try: _umount (btrootfsmnt)
@ -250,57 +276,24 @@ def btogSetFsVirtual (btrootfsimg, btrootfsimglabel, btrootfsmnt, btvirtualdisks
logger.info (f'"{btrootfsimg}" "{btvirtualdisksize}" MB : OK')
schroot_conf_tpl = """
[IMGogclient]
type=loopback
file=/var/lib/tftpboot/ogclient/ogclient.img
description=ogclient Ubuntu image
#priority=1
users=root
groups=root
root-groups=root
mount-options=-o offset=32256
root-users=root
""".strip()
mount_defaults_tpl = """
# mount.defaults: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
#procbususb /proc/bus/usb usbfs defaults 0 0
#/dev /dev none rw,bind 0 0
/dev/pts /dev/pts none rw,bind 0 0
/dev/shm /dev/shm none rw,bind 0 0
#/home /home none rw,bind 0 0
/tmp /tmp none rw,bind 0 0
""".strip()
#btogSetFsAcces: habilita el acceso al sistema root del cliente con schroot
def btogSetFsAccess (btrootfsimg):
if (_grep (btrootfsimg, '/etc/schroot/schroot.conf')):
return
logger.info ('Iniciando la configuración del schroot')
#cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`
if (os.path.exists ('/etc/schroot/schroot.conf')):
shutil.copy ('/etc/schroot/schroot.conf', '/etc/schroot/schroot.conf.bak')
with open ('/etc/schroot/schroot.conf', 'w') as f:
f.write (schroot_conf_tpl + '\n')
#cp /etc/schroot/mount-defaults /etc/schroot/mount-defaults.`getDateTime`
if (os.path.exists ('/etc/schroot/mount-defaults')):
shutil.copy ('/etc/schroot/mount-defaults', '/etc/schroot/mount-defaults.bak')
with open ('/etc/schroot/mount-defaults', 'w') as f:
f.write (mount_defaults_tpl + '\n')
map (os.unlink, glob.glob('/etc/schroot/setup.d/*chrootname'))
#for i in glob.glob ('/etc/schroot/setup.d/*chrootname'):
# os.unlink (i)
for i in glob.glob ('/etc/schroot/setup.d/*chrootname'):
os.unlink (i)
logger.info ('Finalizado: OK')
return 0
@ -321,7 +314,6 @@ def btogSetFsBase (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp):
def boottoolsSshServer (btrootfsmnt):
if not os.path.exists ('/root/.ssh/id_rsa'): ## crea un par de claves en la VM, no en el chroot
_run (['ssh-keygen', '-q', '-f', '/root/.ssh/id_rsa', '-N', ''])
#shutil.copy ('/root/.ssh/id_rsa.pub', '/tmp/')
logger.debug ('comprobando directorio .ssh del root')
if not os.path.exists (f'{btrootfsmnt}/root/.ssh'): ## crea directorio dentro del chroot
@ -337,7 +329,6 @@ def boottoolsSshServer (btrootfsmnt):
logger.debug ('importando la clave publica del servidor OG')
#cat /tmp/id_rsa.pub
if os.path.exists ('/root/.ssh/id_rsa.pub'): ## coge la publica de la VM y la pone en el authorized_keys del chroot
#cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys
fdin = open ('/root/.ssh/id_rsa.pub', 'r')
fdout = open (f'{btrootfsmnt}/root/.ssh/authorized_keys', 'a')
while True:
@ -387,7 +378,6 @@ def btogFsInitrd (bttargetdir, osrelease):
_write_md5 (f'{bttargetdir}/oginitrd.img')
_write_md5 (f'{bttargetdir}/ogvmlinuz')
#cd -
#chmod -R 755 $BTTARGETDIR
for f in glob.glob (f'{bttargetdir}/oginitrd*') + glob.glob (f'{bttargetdir}/vmlinuz*'):
os.chmod (f, 0o755)
@ -430,7 +420,6 @@ def btogIsoGenerator (pxepkg, isolinux_tpl, bttargetdir, nameisoclient):
os.rmdir ('/tmp/iso/isolinux/mount')
os.unlink (f'/tmp/iso/isolinux/{pxepkg}.iso')
## ojo que aquí hay que interpolar $NAMEISOCLIENT y $PXEPKG
with open ('/tmp/iso/isolinux/isolinux.cfg', 'w') as fd:
fd.write (isolinux_tpl.strip().replace('__NAMEISOCLIENT__', nameisoclient).replace('__PXEPKG__', pxepkg))

View File

@ -16,11 +16,13 @@ config = _read_config ('boottoolsgenerator.cfg')
isolinux_tpl = config['General'].get ('isolinux_template')
lvl = config['General'].get ('logging_level')
numeric_level = getattr (logging, lvl.upper(), None)
if numeric_level is None:
numeric_level = getattr (logging, 'INFO')
def _logging():
#logging.root.handlers = []
numeric_level = getattr (logging, lvl.upper(), None)
if numeric_level is None:
numeric_level = getattr (logging, 'INFO')
logging.basicConfig (
format='%(levelname)s %(asctime)s (%(funcName)s) %(message)s',
level=numeric_level,
@ -31,48 +33,15 @@ def _logging():
)
return logging.getLogger ('boottools')
logger = _logging()
def clone_client_dirs (ogrepo_url, ogrepo_branch, ogrepo_dir):
if not os.path.exists ('/tmp/opengnsys/engine'):
_run (['git', 'clone', '-c', 'http.sslVerify=false', '--branch', ogrepo_branch, ogrepo_url, ogrepo_dir])
_run (['rsync', '-aH', f'{ogrepo_dir}/client/engine', f'{ogrepo_dir}/client/shared', '/tmp/opengnsys/'])
type_client = sys.argv[1] if len(sys.argv)>1 else 'host'
#WORKDIR = '/tmp/opengnsys_installer'
#INSTALL_TARGET = '/opt/opengnsys'
#PROGRAMDIR = $(readlink -e $(dirname "$0"))
if os.getuid():
logger.error ('ERROR: this program must run under root privileges!!')
sys.exit (1)
#os.chdir ('/tmp')
logger.info ('OpenGnsys CLIENT installation begins')
ogrepo_url = 'https://ognproject.evlt.uma.es/gitea/opengnsys/opengnsys.git'
ogrepo_branch = 'main'
ogrepo_dir = '/tmp/ogrepo'
clone_client_dirs (ogrepo_url, ogrepo_branch, ogrepo_dir)
####################################################################3
logger.info ('FASE 1 - Asignación de variables')
osdistrib, oscodename, osrelease, osarch, oshttp = btogGetOsInfo1(type_client)
btdir, bttargetdir, btrootfsimg, btrootfsmnt, btrootfsimglabel, log_file, versionboottools, btvirtualdisksize = btogGetVar(osarch)
gitrelease, nameisoclient, namehostclient = btogGetOsInfo2(ogrepo_dir, versionboottools, oscodename, osrelease, osarch)
def _mount_rootfs():
global btrootfsimg, btrootfsmnt
_mount (btrootfsimg, btrootfsmnt, opts=['-o', 'loop,offset=32256'])
## this is convenient in case the previous run failed and we want to run this program again
try: _umount (btrootfsmnt)
except: pass
##########################################################################
logger.info ('FASE 2 - Instalación de software adicional.')
def _get_pxepkg():
#grep "http://free.nchc.org.tw/drbl-core" /etc/apt/sources.list || echo "deb http://free.nchc.org.tw/drbl-core drbl stable" >> /etc/apt/sources.list
_run (['apt-get', 'update']) #>>/tmp/fase2.out
@ -88,11 +57,6 @@ def _get_pxepkg():
logger.info (f'PXE package is "{pxepkg}"')
return pxepkg
pxepkg = _get_pxepkg()
## TODO qemu no existe, hace falta?
_run (['apt-get', '-y', 'install', 'jq', 'syslinux', 'syslinux-efi', 'syslinux-utils', 'debootstrap', 'subversion', 'schroot', 'squashfs-tools', 'syslinux', 'genisoimage', 'qemu-utils', 'lsof', pxepkg]) #>>/tmp/fase2.out
def _mkrootfs():
rc = subprocess.run (f'file "{btrootfsimg}" |grep -q "partition 1 *: ID=0x83"', shell=True).returncode
print (rc)
@ -102,13 +66,6 @@ def _mkrootfs():
logger.error (str (e))
sys.exit (2)
logger.info ('FASE 3 - Creación del Sistema raiz RootFS (Segundo Sistema archivos (img))')
logger.info ('Fase 3.1 Generar y formatear el disco virtual. Generar el dispositivo loop.')
_mkrootfs()
logger.info ('Fase 3.2 - Configurar acceso schroot al Segundo Sistema de archivos (img)')
btogSetFsAccess (btrootfsimg)
## para hacer schroot --cosas, el mntpt tiene que estar desmontado
## si está montado da un pete tal que 'E: 10mount: mount: /run/schroot/mount/IMGogclient-7fbf51a2-e37e-48e5-8e5d-83f8901fc7ed: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error.'
@ -127,29 +84,6 @@ def _debootstrap():
logger.error (str (e))
sys.exit (3)
logger.info ('Fase 3.3 Generar sistema de archivos con debootstrap')
_debootstrap()
logger.info ('FASE 4 - Incorporando ficheros OpenGnsys al sistema raíz rootfs')
## por qué esta copia???
#cp -a ${BTDIR}/includes/usr/bin/* /tmp >>/tmp/fase5.out
#_run (['cp', '-a'] + glob.glob (f'{btdir}/includes/usr/bin/*') + ['/tmp'])
#chmod +x /tmp/boot-tools/*.sh
#for i in glob.glob ('/tmp/boot-tools/*.sh'):
# st = os.stat (i)
# os.chmod (i, st.st_mode|stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
# Incluir revisión.
## FIXME esto la incluye incondicionalmente, y luego terminamos con "OpenGnsys Client 1.2.0-rc1 gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) ..."
#sed -i "1 s/$/ $GITRELEASE ($OSRELEASE)/" ${BTDIR}/includes/etc/initramfs-tools/scripts/VERSION.txt
_run (['sed', '-i', f'1 s/$/ {gitrelease} ({osrelease})/', f'{btdir}/includes/etc/initramfs-tools/scripts/VERSION.txt'])
# En Ubuntu 13.04+ es necesario matar proceso de "udev" antes de desmontar.
#umount $BTROOTFSMNT 2>/dev/null || (kill -9 $(lsof -t $BTROOTFSMNT); umount $BTROOTFSMNT) 2>/dev/null
def _cerodos():
try: _mount_rootfs()
except:
@ -163,22 +97,13 @@ def _cerodos():
_umount (btrootfsmnt)
_cerodos()
## aqui empiezan las cosas de chroot
def _cerotres():
def _chroot_cerotres():
logger.debug (f'running \'schroot --chroot IMGogclient -- {curdir}/03-boottoolsSoftwareInstall.py --osrelease "{osrelease}" --osarch "{osarch}"\'')
stdout, _ = _run (['schroot', '--chroot', 'IMGogclient', '--', f'{curdir}/03-boottoolsSoftwareInstall.py', '--osrelease', osrelease, '--osarch', osarch])
logger.debug (f'03-boottoolsSoftwareInstall stdout follows:')
for i in stdout.strip().split('\n'): logger.debug (' ' + i)
logger.info ('FASE 5 - Instalar software')
logger.info ('Fase 5.1 instalar paquetes deb con apt-get')
_cerotres()
def _cerocuatro():
def _chroot_cerocuatro():
logger.debug ('running \'schroot --chroot IMGogclient -- {}/04-boottoolsSoftwareCompile.py\'')
#cd /
stdout, _ = _run (['schroot', '--chroot', 'IMGogclient', '--', f'{curdir}/04-boottoolsSoftwareCompile.py'])
@ -186,14 +111,6 @@ def _cerocuatro():
logger.debug (f'04-boottoolsSoftwareCompile stdout follows:')
for i in stdout.strip().split('\n'): logger.debug (' ' + i)
logger.info ('Fase 5.2 compilar software.')
_cerocuatro()
## ya no chroot
def _ssh_stuff():
try: _mount_rootfs()
except:
@ -215,25 +132,13 @@ def _ssh_stuff():
## - hay otro nuevo par de claves en el rootfs /var/lib/tftpboot/ogclient/ogclientmount/root/.ssh
## - las dos claves públicas (una de cada par) están autorizadan en el rootfs /var/lib/tftpboot/ogclient/ogclientmount/root/.ssh/authorized_keys
logger.info ('FASE 6 - Personalizar el sistema creado')
logger.info ('Fase 6.1 Incorporar la clave publica del servidor')
logger.info ('Fase 6.2 Incorporar la clave publica del propio cliente')
_ssh_stuff()
## chroot de nuevo
def _cerocinco():
def _chroot_cerocinco():
logger.debug (f'running \'schroot --chroot IMGogclient -- {curdir}/05-boottoolsFsLocales.py\'')
stdout, _ = _run (['schroot', '--chroot', 'IMGogclient', '--', f'{curdir}/05-boottoolsFsLocales.py'])
logger.debug (f'05-boottoolsFsLocales stdout follows:')
for i in stdout.strip().split('\n'): logger.debug (' ' + i)
logger.info ('Fase 6.3 Configurando las locales')
_cerocinco()
def _ceroseis():
def _chroot_ceroseis():
#cd /
#schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsInitrdGenerate.sh
logger.debug (f'running \'schroot --chroot IMGogclient -- {curdir}/06-boottoolsInitrdGenerate.py --osrelease "{osrelease}"\'')
@ -242,12 +147,73 @@ def _ceroseis():
for i in stdout.strip().split('\n'): logger.debug (' ' + i)
## esto deja initrd.img-6.8.0-31-generic y vmlinuz-6.8.0-31-generic en /tmp
_ceroseis()
## ya no chroot
logger = _logging()
type_client = sys.argv[1] if len(sys.argv)>1 else 'host'
if os.getuid():
logger.error ('ERROR: this program must run under root privileges!!')
sys.exit (1)
#os.chdir ('/tmp')
logger.info ('OpenGnsys CLIENT installation begins')
ogrepo_url = 'https://ognproject.evlt.uma.es/gitea/opengnsys/opengnsys.git'
ogrepo_branch = 'main'
ogrepo_dir = '/tmp/ogrepo'
clone_client_dirs (ogrepo_url, ogrepo_branch, ogrepo_dir)
logger.info ('FASE 1 - Asignación de variables')
osdistrib, oscodename, osrelease, osarch, oshttp = btogGetOsInfo1(type_client)
btdir, bttargetdir, btrootfsimg, btrootfsmnt, btrootfsimglabel, log_file, versionboottools, btvirtualdisksize = btogGetVar(osarch)
gitrelease, nameisoclient, namehostclient = btogGetOsInfo2(ogrepo_dir, versionboottools, oscodename, osrelease, osarch)
## this is convenient in case the previous run failed and we want to run this program again
try: _umount (btrootfsmnt)
except: pass
logger.info ('FASE 2 - Instalación de software adicional.')
pxepkg = _get_pxepkg()
_run (['apt-get', '-y', 'install', 'jq', 'syslinux', 'syslinux-efi', 'syslinux-utils', 'debootstrap', 'subversion', 'schroot', 'squashfs-tools', 'syslinux', 'genisoimage', 'qemu-utils', 'lsof', pxepkg]) ## TODO qemu no existe, hace falta?
logger.info ('FASE 3 - Creación del Sistema raiz RootFS (Segundo Sistema archivos (img))')
logger.info ('Fase 3.1 Generar y formatear el disco virtual. Generar el dispositivo loop.')
_mkrootfs()
logger.info ('Fase 3.2 - Configurar acceso schroot al Segundo Sistema de archivos (img)')
btogSetFsAccess (btrootfsimg)
logger.info ('Fase 3.3 Generar sistema de archivos con debootstrap')
_debootstrap()
logger.info ('FASE 4 - Incorporando ficheros OpenGnsys al sistema raíz rootfs')
# Incluir revisión.
## FIXME esto la incluye incondicionalmente, y luego terminamos con "OpenGnsys Client 1.2.0-rc1 gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) gitrelease (osrelease) ..."
#sed -i "1 s/$/ $GITRELEASE ($OSRELEASE)/" ${BTDIR}/includes/etc/initramfs-tools/scripts/VERSION.txt
_run (['sed', '-i', f'1 s/$/ {gitrelease} ({osrelease})/', f'{btdir}/includes/etc/initramfs-tools/scripts/VERSION.txt'])
_cerodos()
logger.info ('FASE 5 - Instalar software')
logger.info ('Fase 5.1 instalar paquetes deb con apt-get')
_chroot_cerotres()
logger.info ('Fase 5.2 compilar software.')
_chroot_cerocuatro()
logger.info ('FASE 6 - Personalizar el sistema creado')
logger.info ('Fase 6.1 Incorporar la clave publica del servidor')
logger.info ('Fase 6.2 Incorporar la clave publica del propio cliente')
_ssh_stuff()
logger.info ('Fase 6.3 Configurando las locales')
_chroot_cerocinco()
_chroot_ceroseis()
logger.info ('FASE 7 - Generar distribucion')
logger.info ('Fase 7.1 Generar el initrd')