419 lines
20 KiB
Python
419 lines
20 KiB
Python
import platform
|
|
import os
|
|
import time
|
|
import logging
|
|
import subprocess
|
|
import shutil
|
|
import glob
|
|
import datetime
|
|
|
|
from . import utils
|
|
|
|
logger = logging.getLogger ('boottools')
|
|
|
|
def GetVar (osarch):
|
|
bttargetdir = '/var/lib/tftpboot/ogclient/'
|
|
btrootfsimg = os.path.join (bttargetdir, 'ogclient.img')
|
|
btrootfsmnt = os.path.join (bttargetdir, 'ogclientmount')
|
|
if 'i386' == osarch:
|
|
btvirtualdisksize = '2000' # tamaño maximo limitado por schroot 2GB para 32 bits
|
|
else:
|
|
btvirtualdisksize = '5G'
|
|
return bttargetdir, btrootfsimg, btrootfsmnt, btvirtualdisksize
|
|
|
|
def GetOsInfo (type_client='host'):
|
|
if 'precise' == type_client: # ogLive 1.0.4-rc2 basado en Ubuntu 12.04 LTS.
|
|
osdistrib='ubuntu'
|
|
oscodename='precise'
|
|
osrelease='3.2.0-23-generic'
|
|
osarch='i386'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'wheezy' == type_client: # ogLive basado en Debian 7.3.
|
|
osdistrib='debian'
|
|
oscodename='wheezy'
|
|
osrelease='3.2.0-4-i386'
|
|
osarch='i386'
|
|
oshttp='http://ftp.es.debian.org/debian/'
|
|
elif 'quantal' == type_client: # ogLive 1.0.5-rc2 basado en Ubuntu 12.10 con Kernel descargado.
|
|
osdistrib='ubuntu'
|
|
oscodename='quantal'
|
|
osrelease='3.7.6-030706-generic'
|
|
osarch='i386'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'raring' == type_client: # ogLive 1.0.5-rc3 basado en Ubuntu 13.04.
|
|
osdistrib='ubuntu'
|
|
oscodename='raring'
|
|
osrelease='3.8.0-22-generic'
|
|
osarch='i386'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'trusty' == type_client: # ogLive 1.0.5-rc4 basado en Ubuntu 14.04.
|
|
osdistrib='ubuntu'
|
|
oscodename='trusty'
|
|
osrelease='3.13.0-24-generic'
|
|
osarch='i386'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'vivid' == type_client: # ogLive 1.1.0-rc2 basado en Ubuntu 15.04.
|
|
osdistrib='ubuntu'
|
|
oscodename='vivid'
|
|
osrelease='3.19.0-49-generic'
|
|
osarch='i386'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'wily' == type_client: # ogLive 1.1.0-rc1 basado en Ubuntu 15.10.
|
|
osdistrib='ubuntu'
|
|
oscodename='wily'
|
|
osrelease='4.2.0-35-generic'
|
|
osarch='i386'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'xenial' == type_client or 'xenial-4.4' == type_client: # ogLive 1.1.0-rc4 basado en Ubuntu 16.04 y Kernel 4.4.
|
|
osdistrib='ubuntu'
|
|
oscodename='xenial'
|
|
osrelease='4.4.0-34-generic'
|
|
osarch='i386'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'xenial-4.8' == type_client: # ogLive 1.1.0-rc5 basado en Ubuntu 16.04 y Kernel 4.8.
|
|
osdistrib='ubuntu'
|
|
oscodename='xenial'
|
|
osrelease='4.8.0-39-generic'
|
|
osarch='amd64'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'xenial-4.13' == type_client: # ogLive 1.1.0-rc6 basado en Ubuntu 16.04 y Kernel 4.13.
|
|
osdistrib='ubuntu'
|
|
oscodename='xenial'
|
|
osrelease='4.13.0-17-generic'
|
|
osarch='amd64'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'bionic' == type_client or 'bionic-4.15' == type_client: # ogLive 1.1.1-rc1 basado en Ubuntu 18.04 y Kernel 4.15.
|
|
osdistrib='ubuntu'
|
|
oscodename='bionic'
|
|
osrelease='4.15.0-32-generic'
|
|
osarch='amd64'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'bionic-4.18' == type_client: # ogLive 1.1.1-rc3 basado en Ubuntu 18.04 y Kernel 4.18.
|
|
osdistrib='ubuntu'
|
|
oscodename='bionic'
|
|
osrelease='4.18.0-20-generic'
|
|
osarch='amd64'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'bionic-5.0' == type_client: # ogLive 1.1.1-rc5 basado en Ubuntu 18.04 y Kernel 5.0.
|
|
osdistrib='ubuntu'
|
|
oscodename='bionic'
|
|
osrelease='5.0.0-27-generic'
|
|
osarch='amd64'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'focal' == type_client: # ogLive 1.2.0-rc1 basado en Ubuntu 20.04 y Kernel 5.4.
|
|
osdistrib='ubuntu'
|
|
oscodename='focal'
|
|
osrelease='5.4.0-42-generic'
|
|
osarch='amd64'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'noble' == type_client: # ogLive 3.1.1 basado en Ubuntu 24.04 y Kernel 6.8.
|
|
osdistrib='ubuntu'
|
|
oscodename='noble'
|
|
osrelease='6.8.0-31-generic'
|
|
osarch='amd64'
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
elif 'host' == type_client: # ogLive basado en la distribución del servidor.
|
|
osdistrib=platform.freedesktop_os_release()['NAME']
|
|
oscodename=platform.freedesktop_os_release()['VERSION_CODENAME']
|
|
osrelease=platform.uname()[2]
|
|
osarch, _=utils.run (['dpkg', '--print-architecture'])
|
|
oshttp='http://es.archive.ubuntu.com/ubuntu/'
|
|
else: # Parámetro desconocido
|
|
logger.error ('Parámetro no válido.')
|
|
osdistrib=None
|
|
oscodename=None
|
|
osrelease=None
|
|
osarch=None
|
|
oshttp=None
|
|
return osdistrib, oscodename, osrelease, osarch, oshttp
|
|
|
|
def mkrootfs (btrootfsimg, btrootfsimglabel, btrootfsmnt, btvirtualdisksize, bttargetdir, osarch):
|
|
logger.info (f'Creación y formateo del disco virtual "{btrootfsimg}" "{btvirtualdisksize}" MB')
|
|
|
|
try: utils.umount (btrootfsmnt)
|
|
except: pass
|
|
|
|
if (utils.is_mounted (btrootfsmnt)):
|
|
raise Exception (f'failed to umount "{btrootfsmnt}"')
|
|
|
|
try: os.makedirs (btrootfsmnt, exist_ok=True)
|
|
except:
|
|
raise Exception (f'Creando directorio "{btrootfsmnt}" : ERROR')
|
|
|
|
try: utils.run (['chown', '-R', 'root:opengnsys', bttargetdir])
|
|
except Exception as e:
|
|
raise Exception (f'Failed to chown root:opengnsys "{btrootfsmnt}": {str(e)}')
|
|
|
|
logger.info (f'Creating disk image "{btrootfsimg}"')
|
|
if 'i386' == osarch:
|
|
try: utils.run (['dd', 'if=/dev/zero', f'of={btrootfsimg}', 'bs=1048576', f'count={btvirtualdisksize}'])
|
|
except Exception as e:
|
|
raise Exception (f'Creando el disco virtual "{btrootfsimg}" con tamaño maxima "{btvirtualdisksize}" MB : ERROR: {str(e)}')
|
|
else:
|
|
try: utils.run (['qemu-img', 'create', btrootfsimg, btvirtualdisksize])
|
|
except Exception as e:
|
|
raise Exception (f'Creando el disco virtual "{btrootfsimg}" con tamaño maxima "{btvirtualdisksize}" MB : ERROR: {str(e)}')
|
|
|
|
logger.debug ('losetup --find')
|
|
diskloop, _ = utils.run (['losetup', '--find'])
|
|
if not diskloop:
|
|
raise Exception ('no diskloop')
|
|
|
|
logger.debug ('losetup attach')
|
|
try: utils.run (['losetup', '--partscan', diskloop, btrootfsimg])
|
|
except: raise Exception ('losetup failed')
|
|
|
|
logger.info ('Partitioning disk image')
|
|
stdout, _ = utils.run (['bash', '-c', f"echo $'n\np\n1\n\n\nt\n83\nw' |fdisk {diskloop}"])
|
|
|
|
time.sleep (3)
|
|
logger.debug ('losetup --detach')
|
|
try: utils.run (['losetup', '--detach', diskloop])
|
|
except:
|
|
raise Exception ('Liberando disco virtual despues del particionado: ERROR')
|
|
|
|
logger.debug ('losetup --find')
|
|
partloop, _ = utils.run (['losetup', '--find'])
|
|
if not partloop:
|
|
raise Exception ('no partloop')
|
|
|
|
logger.debug ('losetup --offset attach')
|
|
utils.run (['losetup', '--offset', '32256', partloop, btrootfsimg])
|
|
|
|
logger.info ('Creating ext4 filesystem')
|
|
try: utils.run (['mkfs.ext4', '-b', '4096', '-L', btrootfsimglabel, partloop])
|
|
except:
|
|
raise Exception ('Formateando la particion principal del disco virtual: ERROR')
|
|
|
|
time.sleep (3)
|
|
logger.debug ('losetup --detach')
|
|
try: utils.run (['losetup', '--detach', partloop])
|
|
except:
|
|
raise Exception ('Liberando la particion virtual despues del formateo: ERROR')
|
|
|
|
logger.info (f'"{btrootfsimg}" "{btvirtualdisksize}" MB : OK')
|
|
|
|
# works on an already mounted rootfs
|
|
def debootstrap (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp):
|
|
logger.info ('Iniciando la generación del sistema de archivos')
|
|
|
|
logger.info ('debootstrapping system')
|
|
logger.debug (f'debootstrap --arch="{osarch}" --components=main,universe "{oscodename}" "{btrootfsmnt}" "{oshttp}"')
|
|
try: utils.run (['debootstrap', f'--arch={osarch}', '--components=main,universe', oscodename, btrootfsmnt, oshttp])
|
|
except: raise Exception (f'debootstrap --arch="{osarch}" --components=main,universe "{oscodename}" "{btrootfsmnt}" "{oshttp}" : ha fallado!')
|
|
|
|
logger.info (f'debootstrap --arch="{osarch}" --components=main,universe "{oscodename}" "{btrootfsmnt}" "{oshttp}" : ok')
|
|
return 0
|
|
|
|
def copy_og_files (builder, og_shared, ogclientmount, osdistrib, oscodename):
|
|
logger.info ('Iniciando la personalización con datos del repositorio')
|
|
|
|
sources_list_in = f'{builder}/includes/etc/apt/sources.list.{osdistrib.lower()}'
|
|
sources_list_out = f'{builder}/includes/etc/apt/sources.list'
|
|
fdin = open (sources_list_in, 'r')
|
|
fdout = open (sources_list_out, 'w')
|
|
while True:
|
|
l = fdin.readline()
|
|
if not l: break
|
|
fdout.write (l.replace ('OSCODENAME', oscodename))
|
|
fdin.close()
|
|
fdout.close()
|
|
|
|
subprocess.run (f'chmod -R 775 {builder}/includes/usr/bin/*', shell=True)
|
|
|
|
os.makedirs (f'{ogclientmount}/opt/opengnsys/lib/engine/bin/', exist_ok=True)
|
|
os.makedirs (f'{ogclientmount}/usr/local/etc', exist_ok=True)
|
|
os.makedirs (f'{ogclientmount}/usr/local/lib', exist_ok=True)
|
|
os.makedirs (f'{ogclientmount}/usr/local/plugins', exist_ok=True)
|
|
|
|
subprocess.run (f'rsync -aH {builder}/includes/* {ogclientmount}/' , shell=True)
|
|
subprocess.run (f'rsync -aH {og_shared}/* {ogclientmount}/opt/opengnsys/', shell=True)
|
|
|
|
if not os.path.exists (f'{ogclientmount}/etc/pci.ids'):
|
|
shutil.copy (f'{og_shared}/lib/pci.ids', f'{ogclientmount}/etc/')
|
|
|
|
# Dependencias Qt para el Browser.
|
|
subprocess.run (f'rsync -aH {og_shared}/etc/*.qmap {ogclientmount}/usr/local/etc', shell=True)
|
|
subprocess.run (f'rsync -aH {og_shared}/lib/qtlib/* {ogclientmount}/usr/local/lib', shell=True)
|
|
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
|
|
if os.path.exists (f'{og_shared}/bin/browser'): shutil.copy (f'{og_shared}/bin/browser', f'{ogclientmount}/bin/')
|
|
|
|
def sysctl (btrootfsmnt):
|
|
logger.debug ('copiando sysctl.conf')
|
|
with open (f'{btrootfsmnt}/etc/sysctl.conf', 'w') as fd:
|
|
fd.write ('net.ipv6.conf.all.disable_ipv6 = 1\n')
|
|
fd.write ('net.ipv6.conf.default.disable_ipv6 = 1\n')
|
|
fd.write ('net.ipv6.conf.lo.disable_ipv6 = 1\n')
|
|
|
|
def ssh_server (btrootfsmnt):
|
|
if not os.path.exists ('/root/.ssh/id_rsa'): ## creates a key pair in the VM (or docker container), not in the chroot
|
|
utils.run (['ssh-keygen', '-q', '-f', '/root/.ssh/id_rsa', '-N', ''])
|
|
|
|
logger.debug ('comprobando directorio .ssh del root')
|
|
if not os.path.exists (f'{btrootfsmnt}/root/.ssh'): ## creates directory within the chroot
|
|
logger.debug ('creando directorio .ssh 600')
|
|
os.mkdir (f'{btrootfsmnt}/root/.ssh')
|
|
os.chmod (f'{btrootfsmnt}/root/.ssh', 0o700)
|
|
|
|
logger.debug ('creando el fichero authorized_keys') ## creates file within the chroot
|
|
if not os.path.exists (f'{btrootfsmnt}/root/.ssh/authorized_keys'):
|
|
open (f'{btrootfsmnt}/root/.ssh/authorized_keys', 'w').close()
|
|
os.chmod (f'{btrootfsmnt}/root/.ssh/authorized_keys', 0o600)
|
|
|
|
logger.debug ('importando la clave publica del servidor OG')
|
|
if os.path.exists ('/root/.ssh/id_rsa.pub'): ## takes the pubkey from the VM (or docker container) and puts it in the authorized_keys within the chroot
|
|
fdin = open ('/root/.ssh/id_rsa.pub', 'r')
|
|
fdout = open (f'{btrootfsmnt}/root/.ssh/authorized_keys', 'a')
|
|
while True:
|
|
l = fdin.readline()
|
|
if not l: break
|
|
fdout.write (l)
|
|
fdin.close()
|
|
fdout.close()
|
|
|
|
else:
|
|
logger.error ('no key publica og')
|
|
|
|
def ssh_client (btrootfsmnt):
|
|
if not os.path.exists (f'{btrootfsmnt}/root/.ssh/id_rsa'):
|
|
utils.run (['ssh-keygen', '-q', '-f', f'{btrootfsmnt}/root/.ssh/id_rsa', '-N', '']) ## creates a key pair in the chroot
|
|
|
|
#cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys ## takes the pubkey and authorises it to itself
|
|
fdin = open (f'{btrootfsmnt}//root/.ssh/id_rsa.pub', 'r')
|
|
fdout = open (f'{btrootfsmnt}/root/.ssh/authorized_keys', 'a')
|
|
while True:
|
|
l = fdin.readline()
|
|
if not l: break
|
|
fdout.write (l)
|
|
fdin.close()
|
|
fdout.close()
|
|
|
|
## TODO: exportamos la publica a los repos
|
|
#cp /root/.ssh/id_rsa.pub /tmp/rsa.ogclient.pub
|
|
|
|
def move_initrd (bttargetdir, osrelease):
|
|
## backup de oginitrd.img, oginitrd.img.sum, ogvmlinuz y ogvmlinuz.sum
|
|
now = datetime.datetime.now(datetime.timezone.utc).strftime ('%Y%m%d-%H%M%S%z')
|
|
if os.path.exists (f'{bttargetdir}/oginitrd.img'):
|
|
os.rename (f'{bttargetdir}/oginitrd.img' , f'{bttargetdir}/oginitrd.img.{now}')
|
|
os.rename (f'{bttargetdir}/oginitrd.img.sum', f'{bttargetdir}/oginitrd.img.sum.{now}')
|
|
if os.path.exists (f'{bttargetdir}/ogvmlinuz'):
|
|
os.rename (f'{bttargetdir}/ogvmlinuz' , f'{bttargetdir}/ogvmlinuz.{now}')
|
|
os.rename (f'{bttargetdir}/ogvmlinuz.sum', f'{bttargetdir}/ogvmlinuz.sum.{now}')
|
|
|
|
shutil.copy (f'/tmp/initrd.img-{osrelease}', f'{bttargetdir}/oginitrd.img')
|
|
shutil.copy (f'/tmp/vmlinuz-{osrelease}', f'{bttargetdir}/ogvmlinuz')
|
|
|
|
utils.write_md5 (f'{bttargetdir}/oginitrd.img')
|
|
utils.write_md5 (f'{bttargetdir}/ogvmlinuz')
|
|
|
|
#chmod -R 755 $BTTARGETDIR
|
|
for f in glob.glob (f'{bttargetdir}/oginitrd*') + glob.glob (f'{bttargetdir}/vmlinuz*'):
|
|
os.chmod (f, 0o755)
|
|
|
|
def mksquashfs (bttargetdir, btrootfsmnt):
|
|
logger.info ('Iniciando la creación del sistema de archivos en sqfs')
|
|
|
|
if os.path.exists (f'{bttargetdir}/ogclient.sqfs'):
|
|
now = datetime.datetime.now(datetime.timezone.utc).strftime ('%Y%m%d-%H%M%S%z')
|
|
os.rename (f'{bttargetdir}/ogclient.sqfs', f'{bttargetdir}/ogclient.sqfs.{now}')
|
|
|
|
## uses all CPU cores available, even within docker
|
|
utils.run (['mksquashfs', btrootfsmnt, f'{bttargetdir}/ogclient.sqfs', '-e', 'var/lib/apt/lists', '-e', 'usr/share/doc'])
|
|
os.chmod (f'{bttargetdir}/ogclient.sqfs', 0o744)
|
|
|
|
utils.write_md5 (f'{bttargetdir}/ogclient.sqfs')
|
|
|
|
def mkisofs (pxepkg, isolinux_tpl, bttargetdir, nameisoclient):
|
|
#Preparamos los gestores de arranque
|
|
try: os.makedirs ('/tmp/iso/isolinux', exist_ok=True)
|
|
except: raise
|
|
|
|
subprocess.run (['cp -a /usr/lib/syslinux/* /tmp/iso/isolinux/'], shell=True)
|
|
|
|
if 'gpxe' == pxepkg:
|
|
subprocess.run (['cp -a /usr/share/gpxe/* /tmp/iso/isolinux'], shell=True)
|
|
elif 'ipxe' == pxepkg:
|
|
subprocess.run (['cp -a /usr/lib/ipxe/* /tmp/iso/isolinux'], shell=True)
|
|
else:
|
|
raise Exception (f'unknown pxepkg value "{pxepkg}"')
|
|
|
|
# Si existe el fichero ISO, montarlo para extraer isolinux.bin.
|
|
if os.path.exists (f'/tmp/iso/isolinux/{pxepkg}.iso'):
|
|
os.mkdir ('/tmp/iso/isolinux/mount')
|
|
utils.run (['mount', '-o', 'loop', f'/tmp/iso/isolinux/{pxepkg}.iso', '/tmp/iso/isolinux/mount'])
|
|
subprocess.run (['cp -a /tmp/iso/isolinux/mount/* /tmp/iso/isolinux'], shell=True)
|
|
utils.umount ('/tmp/iso/isolinux/mount')
|
|
os.rmdir ('/tmp/iso/isolinux/mount')
|
|
os.unlink (f'/tmp/iso/isolinux/{pxepkg}.iso')
|
|
|
|
with open ('/tmp/iso/isolinux/isolinux.cfg', 'w') as fd:
|
|
fd.write (isolinux_tpl.strip().replace('__NAMEISOCLIENT__', nameisoclient).replace('__PXEPKG__', pxepkg))
|
|
|
|
# preparamos el directorio boot-tools.
|
|
if not os.path.exists ('/tmp/iso/ogclient'):
|
|
os.mkdir ('/tmp/iso/ogclient')
|
|
shutil.copy (f'{bttargetdir}/ogclient.sqfs', '/tmp/iso/ogclient/')
|
|
shutil.copy (f'{bttargetdir}/ogclient.sqfs.sum', '/tmp/iso/ogclient/')
|
|
shutil.copy (f'{bttargetdir}/ogvmlinuz', '/tmp/iso/ogclient/')
|
|
shutil.copy (f'{bttargetdir}/ogvmlinuz.sum', '/tmp/iso/ogclient/')
|
|
shutil.copy (f'{bttargetdir}/ogvmlinuz', '/tmp/iso/ogclient/linuxISO')
|
|
shutil.copy (f'{bttargetdir}/ogvmlinuz.sum', '/tmp/iso/ogclient/linuxISO.sum')
|
|
shutil.copy (f'{bttargetdir}/oginitrd.img', '/tmp/iso/ogclient/')
|
|
shutil.copy (f'{bttargetdir}/oginitrd.img.sum', '/tmp/iso/ogclient/')
|
|
#el ogclienteToISO debe tener una copia del ogvmlinuz como linuxISO
|
|
#cp -prv /var/lib/tftpboot/ogclientToIso/* /tmp/iso/ogclient
|
|
|
|
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'])
|
|
|
|
utils.write_md5 (f'{nameisoclient}.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')
|
|
|
|
#def __unused_boottoolsBootGraphics():
|
|
# find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null;
|
|
# apt-get -y install plymouth plymouth-theme-script
|
|
# update-alternatives --install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/opengnsys/opengnsys.plymouth 100
|
|
# update-alternatives --set default.plymouth /lib/plymouth/themes/opengnsys/opengnsys.plymouth
|
|
# mkdir -p /etc/initramfs-tools/conf.d
|
|
# echo "FRAMEBUFFER=y" > /etc/initramfs-tools/conf.d/splash
|
|
|
|
|
|
############### No usados en el instalador, solo en actualizaciones.
|
|
|
|
# ogClientMount [str_program]
|
|
#@brief Acceso al 2nd FS del cliente desde el Servidor Opengnsys
|
|
#@param 1 Opciona: scripts o programa a ejecutar para automatizaciones
|
|
#@return Si no hay parametros: login de acceso.
|
|
#@return con un parametro: La salida del programa ejecutado
|
|
#def ogClientMount():
|
|
# TODO comprobar que OGFILE y OGFILEMOUNT existe.
|
|
# mount | grep $OGCLIENTFILE > /dev/null || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
|
|
# mount | grep $OGCLIENTMOUNT/proc > /dev/null || mount --bind /proc $OGCLIENTMOUNT/proc
|
|
# mount | grep $OGCLIENTMOUNT/sys > /dev/null || mount --bind /sys $OGCLIENTMOUNT/sys
|
|
# mount | grep $OGCLIENTMOUNT/tmp > /dev/null || mount --bind /tmp $OGCLIENTMOUNT/tmp
|
|
# mount | grep $OGCLIENTMOUNT/dev > /dev/null || mount --bind /dev $OGCLIENTMOUNT/dev
|
|
# mount | grep $OGCLIENTMOUNT/dev/pts > /dev/null || mount --bind /dev/pts $OGCLIENTMOUNT/dev/pts
|
|
# [ $# = 0 ] && $(chroot $OGCLIENTMOUNT /sbin/getty 38400 `tty`)
|
|
# [ $# = 1 ] && chroot $OGCLIENTMOUNT $1
|
|
|
|
#@brief Desmonta el 2nd FS del cliente desde el Servidor Opengnsys
|
|
#def ogClientUnmount():
|
|
# cd /tmp
|
|
# echo "desmontando cliente espere"
|
|
# sleep 5
|
|
# mount | grep $OGCLIENTMOUNT/dev > /dev/null && umount $OGCLIENTMOUNT/dev || ogClientUnmount
|
|
# mount | grep $OGCLIENTMOUNT/dev/pts > /dev/null && umount $OGCLIENTMOUNT/dev/pts || ogClientUnmount
|
|
# mount | grep $OGCLIENTMOUNT/proc > /dev/null && umount $OGCLIENTMOUNT/proc || ogClientUnmount
|
|
# mount | grep $OGCLIENTMOUNT/sys > /dev/null && umount $OGCLIENTMOUNT/sys || ogClientUnmount
|
|
# mount | grep $OGCLIENTMOUNT/tmp > /dev/null && umount $OGCLIENTMOUNT/tmp || ogClientUnmount
|
|
# mount | grep $OGCLIENTMOUNT > /dev/null && umount $OGCLIENTMOUNT || ogClientUnmount
|