Compare commits

..

5 Commits

Author SHA1 Message Date
Antonio Guerrero 9195bb0746 Validación de escritura 2023-06-12 09:38:50 -05:00
Luis Gerardo Romero Garcia 4106c43812 Test commit lgromero 2023-06-12 11:48:43 +02:00
Vadim vtroshchinskiy 1b2e7a905c Eliminar test commit 2023-06-12 11:42:15 +02:00
Vadim vtroshchinskiy 21fb143694 Test commit 2023-06-12 11:42:15 +02:00
Natalia Serrano 9c8ec6a4c8 qindel commit test 2023-06-12 10:43:45 +02:00
59 changed files with 1431 additions and 1548 deletions

View File

@ -1,15 +0,0 @@
.git
.gitignore
.dockerignore
__pycache__
Dockerfile
INSTALL.es.txt
Jenkinsfile
kernelParameterOG.es.txt
ogclient/
ogclientImg2Sqfs
ogclientSqfs2Img
**/*.swp
## the following is used in the jenkins job
opengnsys-repo

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
__pycache__/
*.swp

View File

@ -1,64 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.9.1] - 2025-06-18
### Fixed
- Increase "open files" ulimit for the qt6 browser
## [3.9.0] - 2025-06-16
### Added
- Take ogrepository SSH key from its git repo
## [3.8.0] - 2025-06-16
### Added
- Installation of package opengnsys-gitlib
## [3.7.0] - 2025-05-28
### Changed
- Leave resolv.conf as a symlink to /run/resolvconf/resolv.conf
## [3.6.0] - 2025-05-21
### Changed
- Configure stunnel and dbus via includes rather than in python code
### Added
- Add script for changing the URL in the running browser
## [3.5.0] - 2025-05-19
### Changed
- Configure dbus
## [3.4.0] - 2025-05-18
### Changed
- Install and configure stunnel in the image
## [3.3.0] - 2025-05-14
### Changed
- Add changes required for the new browser
## [3.2.1] - 2025-03-31
### Changed
- Include build date in the final VERSION.txt

View File

@ -1,38 +0,0 @@
FROM ubuntu:noble
RUN apt-get update && apt-get -y install \
debootstrap \
fdisk \
file \
genisoimage \
git \
ipxe \
jq \
lsof \
python3 \
python3-apt \
qemu-utils \
rsync \
schroot \
squashfs-tools \
subversion \
syslinux \
syslinux-efi \
syslinux-utils \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd opengnsys
RUN mkdir -p /opt/opengnsys/client /tmp/opengnsys/oglive_builder /var/lib/tftpboot/
RUN ln -fs /var/lib/tftpboot /opt/opengnsys
ARG OPENGNSYS_HEAD
COPY . /tmp/opengnsys/oglive_builder/
RUN ls -la /tmp/opengnsys/oglive_builder/ && \
mv /tmp/opengnsys/oglive_builder/engine /tmp/opengnsys/oglive_builder/shared /tmp/opengnsys/oglive_builder/ogrepo-ssh-key /tmp/opengnsys/ && \
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
ENTRYPOINT ["/tmp/opengnsys/oglive_builder/mkoglive.py"]

View File

@ -4,57 +4,58 @@ OpenGnsys Client boot-tools INSTALL.es.txt
Advertencia previa:
-----------------------------
- No usar este instalador en un sistema OpenGnsys en producción.
- Se puede ejecutar este script desde un sistema Ubuntu 10.04 o superior.
- Mas información https://opengnsys.es/trac/wiki/ClienteInitrdDSGenerarloV1.0.2
Requisitos iniciales
--------------------
- Utilizar el usuario "root" para ejecutar el proceso de generación del cliente.
- Comprobar la conexión a Internet, sobre todo si usas proxy (el hecho de que funcione apt-get no significa que tengas el proxy configurado).
Proceso de creación de imagen docker
------------------------------------
Proceso de instalación
----------------------
Simplemente llamar a docker build sin sorpresas:
#0. Si ya tenemos configurado TFTP, renombrar el directorio /var/lib/tftpboot/ogclient.
mv /opt/opengnsys/tftpboot/ogclient /opt/opengnsys/tftpboot/ogclient-old;
docker build -t opengnsys/mkoglive .
#1. Descargar del Subversion las herramientas del cliente
apt-get install subversion wget
svn checkout https://opengnsys.es/svn/branches/version1.1/client /tmp/opengnsys_installer/opengnsys/client/;
find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null;
Si queremos usar una rama diferente del repo de opengnsys:
#2. Ejecutar el instalador:
/tmp/opengnsys_installer/opengnsys/client/boot-tools/boottoolsgenerator.sh;
docker build --build-arg OPENGNSYS_BRANCH=mybranch -t opengnsys/mkoglive .
Notas para ejecución del instalador en Ubuntu 12.10:
- Configuración openssh-client:
- *** ssh_config (Y/I/N/O/D/Z) [default=N] ? [intro]
- Mapa de caracteres:
- Pantalla "Configuring console-data": elegir "Select keymap from full list"
- Keymap: pc / qwerty / Spanish / Standard / Standard
- Clave publica del servidor
- verwrite (y/n)? [intro]
- Mapa de caracteres (repetición):
- Pantalla "Configuring console-data":
- Select keymap from full list
- pc / qwerty / Spanish / Standard / Standard, UTF-8, Combined - Latin; Slavic Cyrillic; Greek, Fixed, 16
Proceso de creación de imagen oglive
------------------------------------
mkdir ogclient
docker run --rm --name mkoglive --privileged=true --volume $PWD/ogclient:/var/lib/tftpboot/ogclient opengnsys/mkoglive --codename noble
Hace falta --privileged=true para que mkoglive.py pueda ejecutar, entre otras cosas, losetup y mount.
El parámetro --codename permite especificar la versión de ubuntu.
También se puede especificar, por ejemplo, --loglevel debug.
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.
Descripción de la estrucutra de boot-tools
------------------------------------------
- INSTALL.es.txt este mismo archivo.
- mkoglive:
- mkoglive.py script principal para crear la imagen oglive
- mkoglive.cfg configuración de mkoglive.py
- boottools/ libreria complementaria del mkoglive.py
- includes/ directorio con ficheros específicos para incluir en la distribución
- schroot:
- schroot.conf configuración de schroot
- mount-defaults configuración de puntos de montaje para schroot
- chroot-tasks.py helper para configurar el oglive estando en schroot
- docker:
- Dockerfile para crear una imagen docker
- .dockerignore para limitar el contexto de docker-build
- boottollsgenerator.sh proceso de generación del sistema operativo opengnsys.
- boottoolsfunctions.lib libreria complementaria del boottolsgenerator.sh
- includes/ directorio con ficheros específicos para incluir en la distribución.
NOTA:
boottollsfuncions.lib -> btogSetfsBase
bootsoftwareinstall ->
packages ->sw.testing

11
Jenkinsfile vendored
View File

@ -1,11 +0,0 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Jenkinsfile for oglive-builder'
}
}
}
}

View File

@ -1,65 +0,0 @@
#!/usr/bin/python3
import apt
import apt.progress.base
import apt_pkg
import shutil
import os
def clean():
apt_cache = apt.Cache()
apt_pkg.init()
cache_dir = apt_pkg.config.find_dir ('Dir::Cache::archives')
for fn in os.listdir (cache_dir):
file_path = os.path.join (cache_dir, fn)
try:
if os.path.isfile (file_path):
os.unlink (file_path)
elif os.path.isdir (file_path):
shutil.rmtree (file_path)
except Exception as e:
print (f'Failed to delete {file_path}. Reason: {e}')
def autoremove():
apt_cache = apt.Cache()
for pkg in apt_cache:
if pkg.is_installed and pkg.is_auto_removable:
pkg.mark_delete()
try:
apt_cache.commit()
except Exception as e:
print ('installation failed: {}'.format (str (e)))
def remove (pkgs):
apt_cache = apt.Cache()
for p in pkgs:
if p in apt_cache:
apt_cache[p].mark_delete()
try:
apt_cache.commit()
except Exception as e:
print ('removal failed: {}'.format (str (e)))
def update():
apt_cache = apt.Cache()
apt_cache.update()
def upgrade():
apt_cache = apt.Cache()
apt_cache.upgrade()
def cache_search (pkgs):
apt_cache = apt.Cache()
res = {}
for p in pkgs:
res[p] = True if p in apt_cache else False
return res
def install (pkgs, opts={}):
opts_list = []
for k in opts: opts_list += ['-o', f'{k}={opts[k]}']
print ('about to install these packages: "{}"'.format (' '.join (pkgs)))
import subprocess
subprocess.run (['apt-get', '--yes', 'install'] + pkgs + opts_list)

View File

@ -1,424 +0,0 @@
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, ogrepo_ssh_key, 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)
os.makedirs (f'{ogclientmount}/root/.ssh', exist_ok=True)
shutil.copy (f'{ogrepo_ssh_key}/opengnsys', f'{ogclientmount}/root/.ssh/id_ed25519')
shutil.copy (f'{ogrepo_ssh_key}/opengnsys.pub', f'{ogclientmount}/root/.ssh/id_ed25519.pub')
os.chmod (f'{ogclientmount}/root/.ssh/id_ed25519', 0o0600)
os.chmod (f'{ogclientmount}/root/.ssh/id_ed25519.pub', 0o0600)
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

View File

@ -1,80 +0,0 @@
import logging
import subprocess
import re
import os
import configparser
import selectors
logger = logging.getLogger ('boottools')
def run (args):
stdout = stderr = ''
logger.debug ('run 10 args "{}"'.format (' '.join(args)))
sel = selectors.DefaultSelector()
p = subprocess.Popen (args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
sel.register (p.stdout.fileno(), selectors.EVENT_READ)
sel.register (p.stderr.fileno(), selectors.EVENT_READ)
while True:
events = sel.select()
for key, _ in events:
if key.fileobj == p.stdout.fileno():
line = p.stdout.readline()
if not line: break
stdout += line
logger.debug (line.rstrip())
elif key.fileobj == p.stderr.fileno():
line = p.stderr.readline()
if not line: break
stderr += line
logger.warn (line.rstrip())
if p.poll() != None:
break
sel.close()
stdout = stdout.strip()
stderr = stderr.strip()
logger.debug (f'p.returncode {p.returncode}')
if p.returncode:
logger.error ('command "{}" failed with rc "{}"'.format (' '.join(args), p.returncode))
#logger.error ('stdout follows:')
#if stdout:
# for i in stdout.split('\n'): logger.error (' ' + i)
logger.error ('stderr follows:')
if stderr:
for i in stderr.split('\n'): logger.error (' ' + i)
raise Exception ('command "{}" failed with rc "{}"'.format (' '.join(args), p.returncode))
return stdout, stderr
def grep (regex, file):
with open (file, 'r') as f:
for l in f:
if (re.findall (regex, l)): return 1
return 0
def is_mounted (mntpt):
return grep (mntpt, '/proc/mounts')
def mount (dev, mntpt, opts=[]):
if not is_mounted (mntpt):
run (['mount', dev, mntpt] + opts)
def umount (mntpt):
if (is_mounted (mntpt)):
run (['umount', mntpt])
def read_config (fn):
if not os.path.exists (fn):
print (f'configuration file "{fn}" not found')
return
config = configparser.ConfigParser (comment_prefixes='#', inline_comment_prefixes='#')
config.read (fn)
return config
def write_md5 (fn):
md5, _ = run (['md5sum', fn])
md5, rest = md5.split (' ', 1)
with open (f'{fn}.sum', 'w') as fd:
fd.write (md5 + '\n')

View File

@ -0,0 +1,648 @@
#!/bin/bash
#/**
#@file boottoolsfunctions.lib
#@brief Librería o clase Boot-Tools
#@class Boot-Tools
#@brief Funciones para generar un sistema operativo cliente para opengnsys
#@version 1.1.1
#@warning License: GNU GPLv3+
#*/
# btGetVariables: define las constantes a utilizar
# Autor: Antonio J. Doblas Viso. Universidad de Málaga.
function btogGetVar()
{
export BTDIR=/tmp/opengnsys_installer/opengnsys/client/boot-tools
export BTTARGETDIR=/var/lib/tftpboot/ogclient/
export BTROOTFSIMG=${BTTARGETDIR}ogclient.img
export BTROOTFSMNT=${BTTARGETDIR}ogclientmount
if [ "$OSARCH" = "i386" ]; then
# tamaño maximo limitado por schroot 2GB para 32 bits
export BTVIRTUALDISKSIZE=2000
else
export BTVIRTUALDISKSIZE="3G"
fi
export BTROOTFSIMGLABEL=ogClient
export LOG_FILE=/tmp/boot-tools_installation.log
export VERSIONBOOTTOOLS="ogLive"
}
# btGetOsInfo: detecta la version del host, para tenerla de referencia en el boot-tools a generar.
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
#@version 1.0.5 - Fichero general de configuración, Kernel 3.7 para Ubuntu 12.10.
#@author Ramón Gómez, ETSII Univ. Sevilla
#@date 2013/02/06
function btogGetOsInfo ()
{
OGCLIENTCFG=/tmp/ogclient.cfg
case "${1,,}" in
precise) # ogLive 1.0.4-rc2 basado en Ubuntu 12.04 LTS.
OSDISTRIB="ubuntu"
OSCODENAME="precise"
OSRELEASE="3.2.0-23-generic"
#OSRELEASE="3.11.0-26-generic"
OSARCH="i386"
OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
;;
wheezy) # 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/"
;;
quantal) # 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/"
;;
raring) # 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/"
;;
trusty) # 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/"
;;
vivid) # 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/"
;;
wily) # 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/"
;;
xenial|xenial-4.4) # 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/"
;;
xenial-4.8) # 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/"
;;
xenial-4.13) # 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/"
;;
bionic|bionic-4.15) # 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/"
;;
bionic-4.18) # 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/"
;;
bionic-5.0) # 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/"
;;
focal) # 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/"
;;
host) # ogLive basado en la distribución del servidor.
OSDISTRIB=$(lsb_release -is)
OSCODENAME=$(lsb_release -cs)
OSRELEASE=$(uname -r)
OSARCH=$(dpkg --print-architecture)
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
;;
*) # Parámetro desconocido
echo "Parámetro no válido."
exit 1
;;
esac
BRANCH="master"
GITURL="https://api.github.com/repos/opengnsys/OpenGnsys/commits?sha=$BRANCH&path=/client"
GITRELEASE=$(curl -s "$GITURL" | jq -r '"r" + (.[0].commit.committer.date | split("-") | join("")[:8]) + "." + (.[0].sha[:7])')
NAMEISOCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$OSRELEASE-$OSARCH-$GITRELEASE"
NAMEHOSTCLIENT="$VERSIONBOOTTOOLS-$OSCODENAME-$GITRELEASE"
export OSDISTRIB OSCODENAME OSRELEASE OSARCH OSHTTP
export TYPECLIENT GITRELEASE NAMEISOCLIENT NAMEHOSTCLIENT
### El fichero de configuración debe sustituir a estos 3 ficheros (borrar las 3 líneas siguientes).
echo "$NAMEISOCLIENT" > /tmp/opengnsys_info_rootfs
echo "$NAMEHOSTCLIENT" > /tmp/opengnsys_chroot
# Generar fichero de configuración.
cat << EOT > $OGCLIENTCFG
TYPECLIENT="$1"
OSDISTRIB="$OSDISTRIB"
OSCODENAME="$OSCODENAME"
OSRELEASE="$OSRELEASE"
OSARCH="$OSARCH"
OSHTTP="$OSHTTP"
GITRELEASE="$GITRELEASE"
NAMEISOCLIENT="$NAMEISOCLIENT"
NAMEHOSTCLIENT="$NAMEHOSTCLIENT"
EOT
}
# btogSetFsVirtual: Crea y formatea el fichero - disco duro virtual
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
# error code return 2
function btogSetFsVirtual ()
{
local RERROR DISKLOOP PARTLOOP #return code error
#Dependencias.
[ -z "$BTROOTFSIMG" ] && btogGetVar
echoAndLog "$FUNCNAME(): Creación y formateo del disco virtual $BTVIRTUALDISKSIZE MB "
#Desmontamos el dispositivo virtual
mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT
mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT
#echo "$FUNCNAME(): Creando el directorio donde se montará el disco virtual $BTROOTFSMNT"
mkdir -p $BTROOTFSMNT
if [ $? -ne 0 ]
then
errorAndLog "$FUNCNAME(): Creando directorio $BTROOTFSMNT : ERROR"
return 1
fi
# Permisos para el usuario opengnsys.
chown -R root:opengnsys $BTTARGETDIR
#echo "$FUNCNAME(): Creando el disco virtual con tamaño máximo de $BTVIRTUALDISKSIZE MB"
if [ "$OSARCH" = "i386" ]; then
dd if=/dev/zero of=$BTROOTFSIMG bs=1048576 count=$BTVIRTUALDISKSIZE
#dd if=/dev/zero of=$BTROOTFSIMG bs=1k count=$OGCLIENTSIZEKB # necesita 500MB
else
qemu-img create $BTROOTFSIMG $BTVIRTUALDISKSIZE
fi
if [ $? -ne 0 ]
then
errorAndLog "$FUNCNAME(): Creando el disco virtual con tamaño maxima $BTVIRTUALDISKSIZE MB : ERROR"
return 2
fi
# Particionamos el disco virtual con una sola particion primaria.
DISKLOOP=$(losetup -f)
#TODO: si no DISKLOOP error
losetup $DISKLOOP $BTROOTFSIMG
#echo "$FUNCNAME(): particiondo el disco virtual - $DISKLOOP - con una particion primaria"
echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk $DISKLOOP
#echoAndLog "$FUNCNAME(): Liberamos Desmontando $DISKLOOP despues del particionado "
sleep 10
losetup -d $DISKLOOP
if [ $? -ne 0 ]
then
errorAndLog "$FUNCNAME(): Liberando disco virtual despues del particionado: ERROR"
return 2
fi
PARTLOOP=$(losetup -f)
#echo "$FUNCNAME(): Formateando la particion principal $PARTLOOP"
losetup -o 32256 $PARTLOOP $BTROOTFSIMG && mkfs.ext4 -b 4096 -L $BTROOTFSIMGLABEL $PARTLOOP
if [ $? -ne 0 ]
then
errorAndLog "$FUNCNAME(): Formateando la particion principal del disco virtual: ERROR"
return 2
fi
#echoAndLog "$FUNCNAME(): Desmontando $PARTLOOP despues del formateo "
sleep 10
losetup -d $PARTLOOP
if [ $? -ne 0 ]
then
errorAndLog "$FUNCNAME(): Liberando la particion virtual despues del formateo: ERROR"
return 2
else
echoAndLog "$FUNCNAME(): $BTROOTFSIMG $BTVIRTUALDISKSIZE MB : OK"
fi
}
# btogSetfsBase: Genera el sistema root base con debootstrap
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
# error code return 3
function btogSetFsBase ()
{
# Dependencias
[ -z "$OSCODENAME" ] && btogGetOsInfo $TYPECLIENT
echoAndLog "$FUNCNAME: Iniciando la generación del sistema de archivos "
#Montamos el dispositivo virtual en su punto de montaje.
mount | grep $BTROOTFSMNT || mount $BTROOTFSIMG $BTROOTFSMNT -o loop,offset=32256
mount | grep $BTROOTFSMNT && echoAndLog "$FUNCNAME: mount $BTROOTFSIMG $BTROOTFSMNT -o loop,offset=32256 OK " || errorAndLog "$FUNCNAME: mount $BTROOTFSIMG $BTROOTFSMNT -o loop,offset=32256 : FAILURE "
debootstrap --arch=$OSARCH --components=main,universe ${OSCODENAME} ${BTROOTFSMNT} ${OSHTTP}
#debootstrap --arch=$OSARCH ${OSCODENAME} ${BTROOTFSMNT} http://archive.ubuntu.com/ubuntu/
if [ $? -ne 0 ]; then
errorAndLog "$FUNCNAME: debootstrap --arch=$OSARCH --components=main,universe $OSCODENAME $BTROOTFSMNT $OSHTTP : ha fallado!"
mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT
return 3
else
echoAndLog "$FUNCNAME: debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe $OSCODENAME $BTROOTFSMNT $OSHTTP : ok"
mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT
return 0
fi
sleep 5
##preubas revisar OSRELEASE
#debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe ${OSCODENAME} ${OGCLIENTMOUNT} ${OSHTTP}
#debootstrap --include=linux-image-${OSRELEASE} --arch=i386 --variant=minbase $OSVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
#debootstrap --variant=minbase --include=linux-image-${OGRELEASE} --arch=i386 $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
#echo debootstrap --include=linux-image-${OGRELEASE},dbus --arch=i386 --components=main,universe $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
}
#btogSetFsAcces: habilita el acceso al sistema root del cliente con schroot
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
function btogSetFsAccess()
{
echoAndLog "$FUNCNAME: Iniciando la configuración del schroot "
cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`
cat << EOF > /etc/schroot/schroot.conf
[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
EOF
cp /etc/schroot/mount-defaults /etc/schroot/mount-defaults.`getDateTime`
cat << EOF > /etc/schroot/mount-defaults
# 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
EOF
rm /etc/schroot/setup.d/*chrootname
echoAndLog "$FUNCNAME: Finalizado: OK "
return 0
}
#btogFsInitr genera un initrd.
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
function btogFsInitrd ()
{
#DEPENDENCIAS
[ -z "$BTROOTFSIMG" ] && btogGetVar
[ -z "$OSCODENAME" ] && btogGetOsInfo $TYPECLIENT
cd /
schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsInitrdGenerate.sh
echo "cp /tmp/*-${OSRELEASE} ${BTTARGETDIR}"
cp /tmp/*-${OSRELEASE} ${BTTARGETDIR}
#Creando copias de las version oginitr y ogvmlinux previas
TIMEMOD=`date +%Y%m%d-%H%M%S`
[ -f $BTTARGETDIR/oginitrd.img ] && mv $BTTARGETDIR/oginitrd.img $BTTARGETDIR/oginitrd.img.$TIMEMOD; mv $BTTARGETDIR/oginitrd.img.sum $BTTARGETDIR/oginitrd.img.sum.$TIMEMOD
[ -f $BTTARGETDIR/ogvmlinuz ] && mv $BTTARGETDIR/ogvmlinuz $BTTARGETDIR/ogvmlinuz.$TIMEMOD; mv $BTTARGETDIR/ogvmlinuz.sum $BTTARGETDIR/ogvmlinuz.sum.$TIMEMOD
#copiando
cp /tmp/initrd.img-${OSRELEASE} ${BTTARGETDIR}/oginitrd.img
cp /tmp/vmlinuz-${OSRELEASE} ${BTTARGETDIR}/ogvmlinuz
#generamos md5 del kernel y del initrd.
DATASUM=`md5sum "${BTTARGETDIR}/oginitrd.img" | cut -f1 -d" "`
echo $DATASUM > ${BTTARGETDIR}/oginitrd.img.sum
DATASUM=`md5sum "${BTTARGETDIR}/ogvmlinuz" | cut -f1 -d" "`
echo $DATASUM > ${BTTARGETDIR}/ogvmlinuz.sum
#Damos permisos
cd -
chmod -R 755 $BTTARGETDIR
}
#btogFsSqfs convierte el sistema root en sqfs
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
function btogFsSqfs ()
{
#Dependencias.
[ -z "$BTROOTFSIMG" ] && btogGetVar
[ -z "$OSCODENAME" ] && btogGetOsInfo $TYPECLIENT
echoAndLog "$FUNCNAME: Iniciando la creación del sistema de archivos en sqfs "
# si ya existe un sqfs lo renombramos
[ -f $BTTARGETDIR/ogclient.sqfs ] && mv $BTTARGETDIR/ogclient.sqfs $BTTARGETDIR/ogclient.sqfs.`date +%Y%m%d-%H%M%S`
mount | grep $BTROOTFSMNT || mount $BTROOTFSIMG $BTROOTFSMNT -o loop,offset=32256
mksquashfs $BTROOTFSMNT $BTTARGETDIR/ogclient.sqfs
mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT
chmod 744 $BTTARGETDIR/ogclient.sqfs
DATASUM=`md5sum "${BTTARGETDIR}/ogclient.sqfs" | cut -f1 -d" "`
echo $DATASUM > ${BTTARGETDIR}/ogclient.sqfs.sum
}
# btogIsoGenerator genera la iso del cliente
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
function btogIsoGenerator {
#Dependencias.
#[ -z "$BTROOTFSIMG" ] && btogGetVar
btogGetVar
#Preparamos los gestores de arranque
mkdir -p /tmp/iso/isolinux
cp -av /usr/lib/syslinux/* /tmp/iso/isolinux/
if [ -d /usr/share/gpxe ]; then
cp -av /usr/share/gpxe/* /tmp/iso/isolinux
PXE=gpxe
elif [ -d /usr/lib/ipxe ]; then
cp -av /usr/lib/ipxe/* /tmp/iso/isolinux
PXE=ipxe
fi
# Si existe el fichero ISO, montarlo para extraer isolinux.bin.
if [ -f /tmp/iso/isolinux/$PXE.iso ]; then
mkdir -p /tmp/iso/isolinux/mount
mount -o loop /tmp/iso/isolinux/$PXE.iso /tmp/iso/isolinux/mount
cp -va /tmp/iso/isolinux/mount/* /tmp/iso/isolinux
umount /tmp/iso/isolinux/mount
rmdir /tmp/iso/isolinux/mount
rm -f /tmp/iso/isolinux/$PXE.iso
fi
cat << FIN > /tmp/iso/isolinux/isolinux.cfg
DEFAULT menu.c32
PROMPT 0
ALLOWOPTIONS 1
MENU TITLE OpenGnsys ${NAMEISOCLIENT}
LABEL 0
MENU LABEL ogLive vga irqpool acpi ogdebug ip:none
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro vga=788 irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=none
LABEL 1
MENU LABEL ogLive irqpoll acpi ip:none
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=none
LABEL 2
MENU LABEL ogLive acpi debug ip=dhcp
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=dhcp
LABEL 3
MENU LABEL ogLive ip=dhcp
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro acpi=off boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=dhcp
LABEL 4
MENU LABEL local
localboot 0x80
append -
label 5
MENU LABEL Network boot via gPXE lkrn
KERNEL $PXE.lkrn
label 6
MENU LABEL Network boot via gPXE usb
KERNEL $PXE.usb
label 7
MENU LABEL Network boot via gPXE pxe
KERNEL $PXE.pxe
label 8
MENU LABEL Network boot via gPXE iso
KERNEL $PXE.iso
label 9
MENU LABEL pxe
KERNEL /clonezilla/live/vmlinuz1
APPEND initrd=/clonezilla/live/initrd1.img boot=live union=aufs noswap vga=788 ip=frommedia
FIN
# preparamos el directorio boot-tools.
mkdir -p /tmp/iso/ogclient
cp ${BTTARGETDIR}/ogclient.sqfs /tmp/iso/ogclient/
cp ${BTTARGETDIR}/ogclient.sqfs.sum /tmp/iso/ogclient/
cp ${BTTARGETDIR}/ogvmlinuz /tmp/iso/ogclient/
cp ${BTTARGETDIR}/ogvmlinuz.sum /tmp/iso/ogclient/
cp ${BTTARGETDIR}/ogvmlinuz /tmp/iso/ogclient/linuxISO
cp ${BTTARGETDIR}/ogvmlinuz.sum /tmp/iso/ogclient/linuxISO.sum
cp ${BTTARGETDIR}/oginitrd.img /tmp/iso/ogclient/
cp ${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
cd /tmp
#TIMEMOD=`date +%Y%m%d-%H%M%S`
####Generamos la iso
echo "mkisofs -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"
mkisofs -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
##Generamos el md5
DATASUM=`md5sum ${NAMEISOCLIENT}.iso | cut -f1 -d" "`
echo $DATASUM > ${NAMEISOCLIENT}.iso.sum
mv /tmp/${NAMEISOCLIENT}.iso /var/lib/tftpboot/ogclient/
mv /tmp/${NAMEISOCLIENT}.iso.sum /var/lib/tftpboot/ogclient/
### vi /etc/grub.d/40_custom
##
#menuentry "og cache " {
#set root=(hd0,4)
#linux /ogvmlinuz ro vga=788 irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=none
#initrd /oginitrd.img
#}
}
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
function btogIsoTest {
#/tmp/iso
qemu -m 256 -boot d -cdrom ogClient.iso
}
function getDateTime()
{
echo `date +%Y%m%d-%H%M%S`
}
# Escribe a fichero y muestra por pantalla
function echoAndLog()
{
echo $1
FECHAHORA=`getDateTime`
echo "$FECHAHORA;$SSH_CLIENT;$1" >> $LOG_FILE
}
function errorAndLog()
{
echo "ERROR: $1"
FECHAHORA=`getDateTime`
echo "$FECHAHORA;$SSH_CLIENT;ERROR: $1" >> $LOG_FILE
}
############### 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
#@exception
#@note
#@todo
#@version 0.9 - Primera versión para OpenGnSys
#@author Antonio J. Doblas Viso, Universidad de Málaga
#@date 2010/02/15
#*/ ##
function 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
}
#/**
# ogClientUnmount
#@brief Desmonta el 2nd FS del cliente desde el Servidor Opengnsys
#@param
#@return
#@exception
#@note
#@todo
#@version 0.9 - Primera versión para OpenGnSys
#@author Antonio J. Doblas Viso, Universidad de Málaga
#@date 2010/02/15
#*/ ##
function 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
#-d -f -l
}

View File

@ -0,0 +1,121 @@
#!/bin/bash
#@file boottoolsgenerator.sh
#@brief Script generación del sistema opertativo cliente OpenGnsys
#@warning
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03
#*/
BRANCH="branches/master"
svn export --force https://github.com/opengnsys/OpenGnsys/$BRANCH/client /tmp/opengnsys_installer/opengnsys/client || exit 1
#Variables
TYPECLIENT="${1:-host}"
WORKDIR=/tmp/opengnsys_installer
INSTALL_TARGET=/opt/opengnsys
PROGRAMDIR=$(readlink -e $(dirname "$0"))
# Solo ejecutable por usuario root
if [ "$(whoami)" != 'root' ]
then
echo "ERROR: this program must run under root privileges!!"
exit 1
fi
# Cambiar a directorio temporal.
cd /tmp
for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
#funciones especificas del cliente.
source $PROGRAMDIR/boottoolsfunctions.lib
####################################################################3
echo "FASE 1 - Asignación de variables"
#obtenemos las variables necesarias y la información del host.
btogGetVar
echoAndLog "OpenGnsys CLIENT installation begins at $(date)"
btogGetOsInfo $TYPECLIENT
##########################################################################
echo "FASE 2 - Instalación de software adicional."
#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
apt-get update
[ -n "$(apt-cache search gpxe)" ] && PXEPKG="gpxe"
[ -n "$(apt-cache search ipxe)" ] && PXEPKG="ipxe"
apt-get -y install debootstrap subversion schroot squashfs-tools syslinux genisoimage $PXEPKG qemu qemu-utils lsof
###################################################################3
echo "FASE 3 - Creación del Sistema raiz RootFS (Segundo Sistema archivos (img)) "
echo "Fase 3.1 Generar y formatear el disco virtual. Generar el dispositivo loop."
file $BTROOTFSIMG | grep "partition 1: ID=0x83"
if [ $? == 1 ]
then
btogSetFsVirtual || exit 2
fi
echo "Fase 3.2 Generar sistema de archivos con debootstrap"
schroot -p -c IMGogclient -- touch /tmp/ogclientOK
if [ -f /tmp/ogclientOK ]
then
rm /tmp/ogclientOK
else
btogSetFsBase || exit 3
fi
###################################################################3
echo "FASE 4 - Configurar acceso schroot al Segundo Sistema de archivos (img)"
cat /etc/schroot/schroot.conf | grep $BTROOTFSIMG || btogSetFsAccess
###########################################################################
echo "FASE 5 - Incorporando ficheros OpenGnsys al sistema raíz rootfs "
cp -a ${BTDIR}/includes/usr/bin/* /tmp
chmod +x /tmp/boot-tools/*.sh
# Incluir revisión.
sed -i "1 s/$/ $GITRELEASE ($OSRELEASE)/" ${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
schroot -p -c IMGogclient -- /tmp/boot-tools/boottoolsFsOpengnsys.sh
############################################################################################
echo "FASE 6 - Instalar software"
echo "Fase 6.1 instalar paquetes deb con apt-get"
schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareInstall.sh
echo "Fase 6.2 compilar software."
cd /
schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareCompile.sh
cd -
echo "FASE 7 - Personalizar el sistema creado"
echo "Fase 7.1 Incorporar la clave publica del servidor"
cd /
ssh-keygen -q -f /root/.ssh/id_rsa -N ""
cp /root/.ssh/id_rsa.pub /tmp
schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshServer.sh
cd -
echo "Fase 7.2. Incorpoar la clave publica del propio cliente"
schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshClient.sh
echo "Fase 7.3. Configurando las locales"
schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsFsLocales.sh
for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
#########################################################################
echo "FASE 8 - Generar distribucion"
echo "Fase 8.1 Generar el initrd"
btogFsInitrd
echo "Fase 8.2 Generar fichero sqfs a partir del fichero img"
btogFsSqfs
umount $BTROOTFSMNT 2>/dev/null
echo "Fase 8.3 Generar la ISO"
btogIsoGenerator
######################################################################3
########################################################################
echoAndLog "OpenGnsys installation finished at $(date)"

View File

@ -1,175 +0,0 @@
#!/usr/bin/python3
import argparse
import shutil
import os
import glob
import sys
import re
import subprocess
from boottools import utils, apt
def _oghook_deactivate():
#Desactivamos el hook del oginitrd.img para evitar problemas, al final de este escripts se activará
os.rename ('/etc/initramfs-tools/hooks/oghooks', '/etc/initramfs-tools/oghooks')
def _oghook_activate():
#Activamos el hook del oginitrd.img
os.rename ('/etc/initramfs-tools/oghooks', '/etc/initramfs-tools/hooks/oghooks')
def boottoolsSoftwareInstall (osarch, osrelease):
os.environ['LANGUAGE'] = 'C'
os.environ['LC_ALL'] = 'C'
os.environ['LANG'] = 'C'
os.environ['DEBIAN_FRONTEND'] = 'noninteractive'
stdout, _ = utils.run (['dpkg-divert', '--list'])
if not re.findall (r'local diversion of /sbin/initctl to /sbin/initctl.distrib', stdout):
utils.run (['dpkg-divert', '--local', '--rename', '--add', '/sbin/initctl'])
os.symlink ('/bin/true', '/sbin/initctl')
pkgs32 = []
if 'i386' != osarch:
utils.run (['dpkg', '--add-architecture', 'i386'])
pkgs32 = 'lib32gcc-s1 lib32stdc++6 lib32z1 libc6-i386'.split (' ')
_oghook_deactivate()
print ('boottoolsSoftwareInstall: debconf-set-selections', file=sys.stderr)
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 = 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())
apt.update()
apt.upgrade()
pkgs = [f'linux-image-{osrelease}', f'linux-headers-{osrelease}', f'linux-modules-{osrelease}', f'linux-modules-extra-{osrelease}', 'dkms', 'shim-signed', 'openssl', 'sshfs', 'kexec-tools'] + pkgs32 + pkgs
print (f'boottoolsSoftwareInstall: installing packages: {str(pkgs)}', file=sys.stderr)
apt.install (pkgs, opts={'DPkg::Options::': '--force-confdef'}) ## --force-confdef is required to avoid an interactive question regarding /etc/ssh/ssh_config
# Instalar módulos que algunos paquetes puedan tener pendientes de compilar.
print ('boottoolsSoftwareInstall: dkms', file=sys.stderr)
stdout, _ = utils.run (['dkms', 'status'])
for l in stdout.strip().split ('\n'):
if not l: continue
#print (f'l "{l}"')
mod, vers, status = l.split (',')
if 'added' in status:
print (f'dkms installing {mod} {vers}')
utils.run (['dkms', 'install', '-m', mod.strip(), '-v', vers.strip()])
_oghook_activate()
apt.clean()
apt.autoremove()
def boottoolsSoftwareCompile():
env_language = os.environ['LANGUAGE']
env_lc_all = os.environ['LC_ALL']
env_lang = os.environ['LANG']
os.environ['LANGUAGE'] = os.environ['LC_ALL'] = os.environ['LANG'] = 'C'
os.chdir ('/tmp')
print ('boottoolsSoftwareCompile: ms-sys', file=sys.stderr)
try: utils.run (['which', 'ms-sys'])
except:
utils.run (['wget', '--quiet', 'https://sourceforge.net/projects/ms-sys/files/latest/download', '-O', 'ms-sys.tar.gz'])
utils.run (['tar', '-xpzf', 'ms-sys.tar.gz'])
mssys_dir = subprocess.run (['tar tzf ms-sys.tar.gz |head -n 1'], shell=True, capture_output=True, text=True).stdout.strip()
print (f'mssys_dir "{mssys_dir}"')
os.chdir (mssys_dir)
utils.run (['make', 'install'])
os.chdir ('..')
print ('boottoolsSoftwareCompile: spartlnx', file=sys.stderr)
try: utils.run (['which', 'spartl64.run'])
except:
utils.run (['wget', '--tries=5', 'http://damien.guibouret.free.fr/savepart.zip'])
utils.run (['unzip', '-o', 'savepart.zip', '-d', '/sbin/', 'spartl64.run', 'spartlnx.run'])
utils.run (['mkdir', '/usr/share/doc/spartlnx'])
utils.run (['unzip', '-j', '-o', 'savepart.zip', '-d', '/usr/share/doc/spartlnx/', 'doc/en/*'])
if not os.path.exists ('python-libfdisk'):
print ('boottoolsSoftwareCompile: python-libfdisk', file=sys.stderr)
apt.install (['python3-psutil', 'python3-dev', 'libfdisk-dev', 'python3-setuptools'])
utils.run (['git', 'clone', 'https://ognproject.evlt.uma.es/gitea/48k.eu-mirror/python-libfdisk.git'])
os.chdir ('python-libfdisk')
utils.run (['python3', 'setup.py', 'install'])
os.chdir ('..')
os.environ['LANGUAGE'] = env_language
os.environ['LC_ALL'] = env_lc_all
os.environ['LANG'] = env_lang
def updateCaCertificates():
print ('Updating CA trust Store', file=sys.stderr)
utils.run (['update-ca-certificates'])
def boottoolsPythonModules():
utils.run (['pip3', 'install', 'pyblkid', '--break-system-packages'])
def boottoolsRemovePackages():
print ('boottoolsRemovePackages', file=sys.stderr)
apt.remove (['python3-dev', 'python3-setuptools', 'python3-pip'])
## have working DNS during the build
def setup_resolvconf1():
print ('setup_resolvconf1', file=sys.stderr)
os.unlink ('/etc/resolv.conf')
f = open ('/etc/resolv.conf', 'w')
f.write ('nameserver 8.8.8.8')
f.close()
## leave the final configuration for oglive
def setup_resolvconf2():
print ('setup_resolvconf2', file=sys.stderr)
os.unlink ('/etc/resolv.conf')
os.symlink ('/run/resolvconf/resolv.conf', '/etc/resolv.conf')
def boottoolsInitrdGenerate (osrelease):
print ('boottoolsInitrdGenerate', file=sys.stderr)
for f in glob.glob ('/usr/lib/initramfs-tools/bin/*'):
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', 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)
parser.add_argument ('--osrelease', help='OS release', action='store', required=True)
parser.add_argument ('--config', help='Path to configuration file', action='store')
args = parser.parse_args()
config = utils.read_config (args.config or 'mkoglive.cfg')
if config is None:
sys.exit (1)
debconf_settings = config['General'].get ('debconf_settings')
updateCaCertificates()
setup_resolvconf1()
boottoolsSoftwareInstall (args.osarch, args.osrelease)
boottoolsSoftwareCompile()
boottoolsPythonModules()
boottoolsRemovePackages()
setup_resolvconf2()
boottoolsInitrdGenerate (args.osrelease)

View File

@ -55,9 +55,6 @@ deb http://free.nchc.org.tw/ubuntu OSCODENAME-security main restricted universe
#deb http://ppa.launchpad.net/randomaction/ppa/ubuntu OSCODENAME main
#deb-src http://ppa.launchpad.net/randomaction/ppa/ubuntu OSCODENAME main
# Ubuntu-ZFS
#deb http://ppa.launchpad.net/zfs-native/stable/ubuntu OSCODENAME main
#deb-src http://ppa.launchpad.net/zfs-native/stable/ubuntu OSCODENAME main
deb [trusted=yes] https://ognproject.evlt.uma.es/debian-opengnsys/opengnsys OSCODENAME main
deb http://ppa.launchpad.net/zfs-native/stable/ubuntu OSCODENAME main
deb-src http://ppa.launchpad.net/zfs-native/stable/ubuntu OSCODENAME main

View File

@ -1,8 +0,0 @@
<busconfig>
<policy user="root">
<allow own="es.opengnsys.OGBrowser.browser"/>
<allow send_destination="es.opengnsys.OGBrowser.browser"/>
<allow send_interface="es.opengnsys.OGBrowser.browser"/>
<allow send_type="method_call"/>
</policy>
</busconfig>

View File

@ -1,6 +1,4 @@
LC_TYPE=es_ES.UTF-8@euro
LC_ALL=es_ES.UTF-8@euro
LANG=es_ES.UTF-8@euro
LANGUAGE=es_ES.UTF-8@euro
XDG_RUNTIME_DIR=/run/user/0
QTWEBENGINE_CHROMIUM_FLAGS=--no-sandbox
LC_TYPE=es_ES@euro
LC_ALL=es_ES@euro
LANG=es_ES@euro
LANGUAGE=es_ES@euro

View File

@ -38,9 +38,6 @@ mkdir -p ${DESTDIR}/var/log
mkdir -p ${DESTDIR}/opt/opengnsys;
mkdir -p ${DESTDIR}/ogboot;
mkdir -p ${DESTDIR}/boot;
mkdir -p ${DESTDIR}/run/user/0
chmod 700 ${DESTDIR}/run/user/0
# Insert basic binaries
copy_exec /bin/bash-static /bin/bash

View File

@ -15,9 +15,6 @@
#fbcon
# Kernel 3.7+ video.
virtio_gpu
vmwgfx
uvesafb
# Generales

View File

@ -1 +1 @@
OpenGnsys Client 3.9.1
OpenGnsys Client 1.2.0-rc1

View File

@ -110,8 +110,8 @@ fi
#/**
# ogExportVarEnvironment
#@brief Exporta las variables usadas en el proceso de inicio OpenGnsys y las almacena en /tmp
#@param
#@return
#@param
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -119,7 +119,7 @@ fi
#*/ ##
ogExportVarEnvironment ()
{
export CFGINITRD="/tmp/initrd.cfg"
export CFGINITRD="/tmp/initrd.cfg"
OGPROTOCOL="${ogprotocol:-smb}"
[ "$ogunit" != "" ] && OGUNIT="/$ogunit"
# OPTIONS Para samba y local (a nfs no le afecta)
@ -127,16 +127,16 @@ ogExportVarEnvironment ()
DEFOGLIVE="ogclient"
export OGLIVEDIR="${oglivedir:-$DEFOGLIVE}" && echo "OGLIVEDIR=$OGLIVEDIR" >> $CFGINITRD
case "$OGPROTOCOL" in
nfs|NFS)
export SRCOGLIVE="/var/lib/tftpboot" && echo "SRCOGLIVE=$SRCOGLIVE" >> $CFGINITRD
nfs|NFS)
export SRCOGLIVE="/var/lib/tftpboot" && echo "SRCOGLIVE=$SRCOGLIVE" >> $CFGINITRD
export SRCOGSHARE="/opt/opengnsys/client" && echo "SRCOGSHARE=$SRCOGSHARE" >> $CFGINITRD
export SRCOGLOG="/opt/opengnsys/log/clients" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD
export SRCOGIMAGES="/opt/opengnsys/images$OGUNIT" && echo "SRCOGIMAGES=$SRCOGIMAGES" >> $CFGINITRD
export SRCOGLOG="/opt/opengnsys/log/clients" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD
export SRCOGIMAGES="/opt/opengnsys/images$OGUNIT" && echo "SRCOGIMAGES=$SRCOGIMAGES" >> $CFGINITRD
;;
smb|SMB|cifs|CIFS|samba|SAMBA)
export SRCOGLIVE="tftpboot" && echo "SRCOGLIVE=$SRCOGLIVE" >> $CFGINITRD
export SRCOGSHARE="ogclient" && echo "SRCOGSHARE=$SRCOGSHARE" >> $CFGINITRD
export SRCOGLOG="oglog" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD
export SRCOGLOG="oglog" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD
export SRCOGIMAGES="ogimages$OGUNIT" && echo "SRCOGIMAGES=$SRCOGIMAGES" >> $CFGINITRD
;;
local|LOCAL)
@ -149,7 +149,7 @@ ogExportVarEnvironment ()
esac
#punto de acceso al boot-tools live
export DSTOGLIVE="/opt/oglive/tftpboot"
#punto de montaje para unionfs
#punto de montaje para unionfs
export OGLIVERAMFS="/opt/oglive/ramfs" && echo "OGLIVERAMFS=$OGLIVERAMFS" >> $CFGINITRD
#punto de montaje donde se accede al 2nd FS mediante loop
export OGLIVEROOTFS="/opt/oglive/rootfs" && echo "OGLIVEROOTFS=$OGLIVEROOTFS" >> $CFGINITRD
@ -157,13 +157,13 @@ ogExportVarEnvironment ()
export OGLIVEUNIONFS="/opt/oglive/unionfs" && echo "OGLIVEUNIONFS=$OGLIVEUNIONFS" >> $CFGINITRD
#etiquta para los dispositivos offline
export OGLIVELABEL="ogClient"
#echo "puntos de montajes para los demas accesos"
#echo "acceso al client, engine, scritps, interfaz"
export DSTOGSHARE="/opt/opengnsys" && echo "DSTOGSHARE=$DSTOGSHARE" >> $CFGINITRD
export DSTOGSHARE="/opt/opengnsys" && echo "DSTOGSHARE=$DSTOGSHARE" >> $CFGINITRD
export DSTOGLOG="/opt/opengnsys/log" && echo "DSTOGLOG=$DSTOGLOG" >> $CFGINITRD
export DSTOGIMAGES="/opt/opengnsys/images" && echo "DSTOGIMAGES=$DSTOGIMAGES" >> $CFGINITRD
##INFORMACION DE OTRAS VARIABLES OBTENDIAS EN OTRAS FUNCIONES ogConfigureNetwork.
#DEVICE
#IPV4DDR
@ -185,8 +185,8 @@ ogExportVarEnvironment ()
#/**
# ogConfigureRamfs
#@brief Configura el initrd para adaptarlo al sistema raiz.
#@param
#@return
#@param
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -194,10 +194,10 @@ ogExportVarEnvironment ()
#*/ ##
ogConfigureRamfs ()
{
mkdir -p $DSTOGLIVE
mkdir -p $OGLIVERAMFS
mkdir -p $OGLIVEROOTFS
mkdir -p $OGLIVEUNIONFS
mkdir -p $DSTOGLIVE
mkdir -p $OGLIVERAMFS
mkdir -p $OGLIVEROOTFS
mkdir -p $OGLIVEUNIONFS
touch /etc/fstab
}
@ -206,8 +206,8 @@ ogConfigureRamfs ()
#/**
# ogLoadNetModule
#@brief Carga en un demerminado modulo de red, requiere compilación previo del modulo
#@param
#@return
#@param
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -226,8 +226,8 @@ ogLoadNetModule ()
#/**
# ogPostConfigureFS
#@brief Configura el sistema raiz, para independizarlo entre los clientes.
#@param
#@return
#@param
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -237,29 +237,29 @@ ogPostConfigureFS()
{
# configuramos el /etc/hostname.
echo $HOSTNAME > /etc/hostname
#configuramos el /etc/hosts
echo "127.0.0.1 localhost" > /etc/hosts
echo "$IPV4ADDR $HOSTNAME" >> /etc/hosts
#configuramos el host.conf
echo "order hosts,bind" > /etc/host.conf
echo "multi on" >> /etc/host.conf
#configuramos el dns anterior ubuntu 12.04 (parámetro del Kernel "ogdns=IP_DNS")
if [ -n "$ogdns" ]; then
mkdir -p /run/resolvconf
echo "nameserver $ogdns" > /run/resolvconf/resolv.conf
fi
#configuramos el uso del servicio http proxy (parámetro del Kernel "ogproxy=URL_Proxy")
if [ -n "${ogproxy}" ]; then
export http_proxy="$ogproxy"
export https_proxy="$ogproxy"
export ftp_proxy="$ogproxy"
export ftps_proxy="$ogproxy"
fi
export ftps_proxy="$ogproxy"
fi
# configuramos el /etc/networks
#read -e NETIP NETDEFAULT <<<$(route -n | grep eth0 | awk -F" " '{print $1}')
NETIP=$(route -n | grep eth0 | awk -F" " '{print $1}') && NETIP=$(echo $NETIP | cut -f1 -d" ")
@ -310,20 +310,8 @@ ogPostConfigureFS()
#Montamos un directorio temporal para permitir instalacion de softare desde el comando apt-get (parametor kernel "ogtmpfs=50" valor en megas
ogtmpfs="${ogtmpfs:-15}"
#mount tmpfs /var/cache/apt/archives -t tmpfs -o size=${ogtmpfs}M
mount tmpfs /var/cache/apt/archives -t tmpfs -o size=${ogtmpfs}M
mkdir -p /var/cache/apt/archives/partial
mkdir -p /run/user/0
chmod 700 /run/user/0
# esto completa la inicializacion de udev y permite el inicio del escritorio grafico
/bin/udevadm trigger
# Memoria compartida -- necesario para browser
mkdir -p /dev/shm
mount tmpfs -t tmpfs /dev/shm
chmod 1777 /dev/shm
}
@ -336,8 +324,8 @@ ogPostConfigureFS()
# si la red ha sido configurada con el parametro de kernel ip, será el segundo valor.
## ip=iphost:ipnext-server:ipgateway:netmask:hostname:iface:none
## ip=172.17.36.21:62.36.225.150:172.17.36.254:255.255.255.0:prueba1:eth0:none
#@param
#@return
#@param
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -367,13 +355,13 @@ ogGetROOTSERVER ()
fi
export ROOTSERVER
echo "ROOTSERVER=$ROOTSERVER" >> $CFGINITRD
#si oglive no oglive=R
export OGSERVERIMAGES="${ogrepo:-$ROOTSERVER}" && echo "OGSERVERIMAGES=$OGSERVERIMAGES" >> $CFGINITRD
export OGSERVERIMAGES="${ogrepo:-$ROOTSERVER}" && echo "OGSERVERIMAGES=$OGSERVERIMAGES" >> $CFGINITRD
export OGSERVERSHARE="${ogshare:-$ROOTSERVER}" && echo "OGSERVERSHARE=$OGSERVERSHARE" >> $CFGINITRD
export OGSERVERLOG="${oglog:-$ROOTSERVER}" && echo "OGSERVERLOG=$OGSERVERLOG" >> $CFGINITRD
export OGSERVERLIVE="${oglive:-$OGSERVERIMAGES}" && echo "OGSERVERLIVE=$OGSERVERLIVE" >> $CFGINITRD
return 0
}
@ -381,8 +369,8 @@ ogGetROOTSERVER ()
# ogUpdateInitrd
#@brief Actualiza el initrd de la cache desde el servidor. Si el arranque ha sido desde cache, comprueba desde el servidor nueva version del initird.
#@param1
#@return
#@param1
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -406,26 +394,26 @@ ogUpdateInitrd ()
[ -z "$TYPE" ] && return
mount -t $TYPE LABEL=CACHE /tmp/cache || return
mkdir -p /tmp/cache/boot/$OGLIVEDIR
# comparamos los del server
busybox tftp -g -r $OGLIVEDIR/ogvmlinuz.sum $ROOTSERVER
busybox tftp -g -r $OGLIVEDIR/oginitrd.img.sum $ROOTSERVER
SERVERVMLINUZ=`cat ogvmlinuz.sum`
SERVERINITRD=`cat oginitrd.img.sum`
#comparamos los de la cache
CACHEVMLINUZ=`cat /tmp/cache/boot/$OGLIVEDIR/ogvmlinuz.sum`
CACHEINITRD=`cat /tmp/cache/boot/$OGLIVEDIR/oginitrd.img.sum`
echo "MD5 on SERVER: $SERVERVMLINUZ $SERVERINITRD"
echo "MD5 on CACHE: $CACHEVMLINUZ $CACHEINITRD"
cd /tmp/cache/boot/$OGLIVEDIR || mkdir -p /tmp/cache/boot/$OGLIVEDIR
if [ "$CACHEVMLINUZ" != "$SERVERVMLINUZ" ]
then
then
echo "ogvmlinuz updating"
busybox tftp -g -r $OGLIVEDIR/ogvmlinuz $ROOTSERVER
busybox tftp -g -r $OGLIVEDIR/ogvmlinuz.sum $ROOTSERVER
@ -453,13 +441,13 @@ ogUpdateInitrd ()
#@param3 punto de acceso remoto
#@param4 punto de montaje local
#@param5 acceso de lectura tipo ",ro"
#@return
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
#@date 2011/05/24
#*/ ##
ogConnect ()
{
SERVER=$1
@ -467,13 +455,13 @@ ogConnect ()
SRC=$3
DST=$4
READONLY=$5
case "$PROTOCOL" in
nfs)
nfsmount ${SERVER}:${SRC} ${DST} -o nolock${READONLY} 2> /dev/null || mount.nfs ${SERVER}:${SRC} ${DST} -o nolock${READONLY}
;;
smb)
mount.cifs //${SERVER}/${SRC} ${DST} ${OPTIONS}${READONLY}
mount.cifs //${SERVER}/${SRC} ${DST} ${OPTIONS}${READONLY}
;;
local)
# Comprobamos que estatus sea online y que la variable del server no esta vacia.
@ -497,21 +485,21 @@ ogConnect ()
#/**
# ogConnectOgLive
#@brief Conecta con el recurso para usar el sistema raiz externo, remoto o local
#@param1
#@return
#@param1
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
#@date 2011/05/24
#@date 2011/05/24
ogConnectOgLive ()
{
# Si ogprotocol=local, la funcion ogExportVar => SRCOGLIVE=local
if [ "$SRCOGLIVE" == "local" ]
then
then
echo "Montar imagen del sistema root desde dispositivo local"
for i in $(blkid /dev/s* | grep $OGLIVELABEL | awk -F: '{print $2}' | tr -d \"); do export $i; done
# si local usb| cd con partcion es identificada como label $OGLIVELABEL
mount -t $TYPE LABEL=$OGLIVELABEL $DSTOGLIVE
# si local usb| cd con partcion es identificada como label $OGLIVELABEL
mount -t $TYPE LABEL=$OGLIVELABEL $DSTOGLIVE
if [ $? != 0 ]
then
# Si local es particion CACHE es identificada como CACHE
@ -520,8 +508,8 @@ ogConnectOgLive ()
fi
else
# Si ogprotocol es remoto. TODO en smb rw y en nfs ro??
ogConnect $OGSERVERLIVE $OGPROTOCOL $SRCOGLIVE $DSTOGLIVE
fi
ogConnect $OGSERVERLIVE $OGPROTOCOL $SRCOGLIVE $DSTOGLIVE
fi
# Si el montaje ha sido correcto, tanto en local como en remoto. Procedemos con la union
ogMergeLive
}
@ -530,21 +518,21 @@ ogConnectOgLive ()
#/**
# ogMergeLive
#@brief Metafuncion para fusionar el initrd con el sistema raiz.
#@param1
#@return
#@param1
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
#@date 2011/05/24
#@date 2011/05/24
ogMergeLive()
{
#Si existe en el punto de acceso del del oglive el fichero ogclient.sqfs
#Si existe en el punto de acceso del del oglive el fichero ogclient.sqfs
if [ ! -d $DSTOGLIVE/$OGLIVEDIR ]; then
echo "Usando ogLive por defecto."
export OGLIVEDIR=$DEFOGLIVE
fi
if [ -f $DSTOGLIVE/$OGLIVEDIR/ogclient.sqfs ]
then
then
cat /proc/mounts > /tmp/mtab.preunion
if [ "$og2nd" == "img" ]
then
@ -556,7 +544,7 @@ then
## Montamos el ROOTFS tipo squashfs
mount $DSTOGLIVE/$OGLIVEDIR/ogclient.sqfs $OGLIVEROOTFS -t squashfs -o loop
fi
# Realizamos la union entre el ogliveram(initrd) y el ogliverootfs(ogclient.sqfs)
# Realizamos la union entre el ogliveram(initrd) y el ogliverootfs(ogclient.sqfs)
# Nota: el orden es muy importante para evitar errores de montaje.
[ -d $OGLIVEROOTFS/lib32 ] && LIBS=lib32
for i in bin sbin lib $LIBS etc var usr root boot; do
@ -574,8 +562,8 @@ fi
#/**
# ogUnionLiveDir
#@brief fusiona dos directorios con unionfs
#@param1
#@return
#@param1
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -591,7 +579,6 @@ ogUnionLiveDir()
U1STDIR="${OGLIVERAMFS}${TMPDIR}=RW"
U2NDDIR="${OGLIVEROOTFS}${TMPDIR}=RO"
UNIONDIR=${OGLIVEUNIONFS}${TMPDIR}
ulimit -n 4096
mkdir -p $UNIONDIR $TMPDIR
$UBIN $FUSE_OPT $UNION_OPT ${U1STDIR}:${U2NDDIR} $UNIONDIR
mount --bind $UNIONDIR $TMPDIR
@ -602,8 +589,8 @@ ogUnionLiveDir()
#/**
# ogConfigureLoopback
#@brief Configura la interfaz loopback para cliente torrent
#@param
#@return
#@param
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9 Usando funciones generales de ubuntu
#@author Antonio J. Doblas. Universidad de Malaga.
@ -622,8 +609,8 @@ ogConfigureLoopback()
#/**
# ogConfigureNetworking
#@brief Configura la interfaz de red usada en el pxe
#@param
#@return
#@param
#@return
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author Antonio J. Doblas. Universidad de Malaga.
@ -632,7 +619,7 @@ ogConfigureLoopback()
ogConfigureNetworking()
{
#echo "ogConfigureNetworking: Buscando interfaz a configurar DEVICE"
if [ -n "${BOOTIF}" ]
if [ -n "${BOOTIF}" ]
then
#echo " variable BOOTIF exportada con pxelinux.0 con valor $BOOTIF"
IP=$IPOPTS
@ -686,7 +673,7 @@ if [ -z "${DEVICE}" ]; then
fi
[ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ] && return 0
#if [ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ]; then
#if [ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ]; then
# echo "variable DEVICE con valor $DEVICE y fichero /run/net-$DEVICE encontrados"
# return 0
#else
@ -746,7 +733,7 @@ for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do
done
# source ipconfig output
if [ -n "${DEVICE}" ]; then
if [ -n "${DEVICE}" ]; then
export DEVICE
export DEVICECFG="/run/net-${DEVICE}.conf"
# En algunos casos, el fichero de configuración está en /tmp.
@ -768,11 +755,11 @@ fi
# ogYesNo
#@brief Gestion de peticiones de usuario en modo ogdebug=true
#@param1 OPTIONS --timeout N --default ANSWER
#@param1 Questions
#@param1 Questions
#@return 1=yes 0=no
#@exception OG_ERR_FORMAT Formato incorrecto.
#@version 0.9
#@author:
#@author:
#@date 2010/05/24
#*/ ##
ogYesNo()
@ -839,7 +826,7 @@ ogYesNo()
ans=$default
else
ans=$(echo $ans | tr '[:upper:]' '[:lower:]')
fi
fi
fi
if [[ "$ans" == 'y' || "$ans" == 'yes' || "$ans" == 'n' || "$ans" == 'no' ]]; then
@ -849,5 +836,5 @@ ogYesNo()
if [[ $ok -eq 0 ]]; then warning "Valid answers are: yes y no n"; fi
done
[[ "$ans" = "y" || "$ans" == "yes" ]]
}
}

View File

@ -10,6 +10,12 @@ Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation no
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
@ -20,11 +26,14 @@ LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication

View File

@ -1,15 +0,0 @@
setuid = stunnel4
setgid = stunnel4
pid = /var/run/stunnel4/menu.pid
foreground = yes
debug = info
[menu]
client = yes
accept = 127.0.0.1:81
connect = __OGCORE_IP__:__OGCORE_PORT__
cert = /opt/opengnsys/etc/ogagent.crt
key = /opt/opengnsys/etc/ogagent.key
CAfile = /opt/opengnsys/etc/ca.crt
requireCert = yes
verifyChain = yes

View File

Before

Width:  |  Height:  |  Size: 870 B

After

Width:  |  Height:  |  Size: 870 B

View File

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 296 B

View File

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 350 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 285 B

View File

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 285 B

View File

@ -0,0 +1,16 @@
#!/bin/bash
find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null;
#plymouth
apt-get -y install plymouth plymouth-theme-script
#plymoutyh
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
history -c

View File

@ -0,0 +1,10 @@
#!/bin/bash
cat << EOT | debconf-set-selections --
console-setup console-setup/charmap47 select UTF-8
console-setup console-setup/codeset47 select . Combined - Latin; Slavic Cyrillic; Greek
console-setup console-setup/fontface47 select VGA
console-setup console-setup/fontsize-fb47 select 8x16
EOT
dpkg-reconfigure console-setup locales
history -c

View File

@ -0,0 +1,74 @@
#!/bin/bash
VERSIONBOOTTOOLS="ogLive"
NAMEISOCLIENTFILE="/tmp/opengnsys_info_rootfs"
NAMEHOSTCLIENTFILE="/tmp/opengnsys_chroot"
SVNCLIENTDIR=/tmp/opengnsys_installer/opengnsys/client/boot-tools
SVNCLIENTSTRUCTURE=/tmp/opengnsys_installer/opengnsys/client/shared
SVNCLIENTENGINE=/tmp/opengnsys_installer/opengnsys/client/engine
OGCLIENTMOUNT=""
OGCLIENTCFG=${OGCLIENTCFG:-/tmp/ogclient.cfg}
[ -f $OGCLIENTCFG ] && source $OGCLIENTCFG
OSDISTRIB=${OSDISTRIB:-$(lsb_release -is)}
OSCODENAME=${OSCODENAME:-$(lsb_release -cs)}
OSRELEASE=${OSRELEASE:-$(uname -r)}
OSARCH=${OSARCH:-$(dpkg --print-architecture)}
OSHTTP=${OSHTTP:-"http://es.archive.ubuntu.com/ubuntu/"}
echo "$OSDISTRIB:$OSCODENAME:$OSRELEASE:$OSARCH:$OSHTTP"
LERROR=TRUE
echo "$FUNCNAME: Iniciando la personalización con datos del repositorio"
# parseamos el apt.source de la distribución (en minúsculas)
sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/includes/etc/apt/sources.list.${OSDISTRIB,,} > ${SVNCLIENTDIR}/includes/etc/apt/sources.list
if [ $? -ne 0 ]
then
echo "$FUNCNAME(): Parsing apt.sources : ERROR"
exit 1
fi
#damos permiso al directorio de scripts
chmod -R 775 ${SVNCLIENTDIR}/includes/usr/bin/*
# los copiamos
cp -av ${SVNCLIENTDIR}/includes/* ${OGCLIENTMOUNT}/
mkdir -p ${OGCLIENTMOUNT}/opt/opengnsys/
cp -av ${SVNCLIENTSTRUCTURE}/* ${OGCLIENTMOUNT}/opt/opengnsys/
mkdir -p ${OGCLIENTMOUNT}/opt/opengnsys/lib/engine/bin/
cp -av ${SVNCLIENTENGINE}/* ${OGCLIENTMOUNT}/opt/opengnsys/lib/engine/bin/
if [ $? -ne 0 ]
then
echo "$FUNCNAME(): Copying client data : ERROR"
exit 1
fi
# Si no existe, copiar pci.ids.
[ -f $OGCLIENTMOUNT/etc/pci.ids ] || cp -va ${SVNCLIENTSTRUCTURE}/lib/pci.ids $OGCLIENTMOUNT/etc
# Dependencias Qt para el Browser.
mkdir -p $OGCLIENTMOUNT/usr/local/{etc,lib,plugins}
cp -av ${SVNCLIENTSTRUCTURE}/lib/qtlib/* $OGCLIENTMOUNT/usr/local/lib
cp -av ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/lib
cp -av ${SVNCLIENTSTRUCTURE}/lib/qtplugins/* $OGCLIENTMOUNT/usr/local/plugins
cp -av ${SVNCLIENTSTRUCTURE}/etc/*.qmap $OGCLIENTMOUNT/usr/local/etc
# Browser y ogAdmClient.
[ -x ${SVNCLIENTSTRUCTURE}/bin/browser ] && cp -av ${SVNCLIENTSTRUCTURE}/bin/browser $OGCLIENTMOUNT/bin
[ -x ${SVNCLIENTSTRUCTURE}/bin/ogAdmClient ] && cp -av ${SVNCLIENTSTRUCTURE}/bin/ogAdmClient $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
history -c

View File

@ -0,0 +1,5 @@
#!/bin/bash
history -c

View File

@ -0,0 +1,14 @@
#!/bin/bash
OGCLIENTCFG=${OGCLIENTCFG:-/tmp/ogclient.cfg}
[ -f $OGCLIENTCFG ] && source $OGCLIENTCFG
OSRELEASE=${OSRELEASE:-$(uname -r)}
rm -f /usr/lib/initramfs-tools/bin/*
cp /bin/busybox /usr/lib/initramfs-tools/bin
cd /tmp
mkinitramfs -o /tmp/initrd.img-$OSRELEASE -v $OSRELEASE
cp -v /boot/vmlinuz-$OSRELEASE /tmp
history -c

View File

@ -0,0 +1,36 @@
#!/bin/bash
################################################################
##################### SOFTWARE #####################
################################################################
OLDLANGUAGE=$LANGUAGE
OLDLC_ALL=$LC_ALL
OLDLANG=$LANG
export LANGUAGE=C
export LC_ALL=C
export LANG=C
source /opt/opengnsys/lib/engine/bin/ToolsGNU.c &>/dev/null
pushd /tmp
echo "ms-sys"
which ms-sys || (wget https://sourceforge.net/projects/ms-sys/files/latest/download -O ms-sys.tar.gz; tar xpvzf ms-sys.tar.gz; cd $(tar tzf ms-sys.tar.gz|head -1); make install; cd ..)
echo "spartlnx"
which spartlnx.run || $(wget http://damien.guibouret.free.fr/savepart.zip &>/dev/null; unzip -o savepart.zip -d /sbin/)
echo "python-libfdisk"
apt-get -y install python3-psutil python3-dev libfdisk-dev python3-setuptools
git clone git://git.48k.eu/python-libfdisk
pushd python-libfdisk
python3 setup.py install
popd
apt-get -y remove python3-dev python3-setuptools
popd
export LANGUAGE=$OLDLANGUAGE
export LC_ALL=$OLDLC_ALL
export LANG=$OLDLANG
history -c

View File

@ -0,0 +1,104 @@
#!/bin/bash
# Script de instalación de paquetes de software.
export LANGUAGE=C
export LC_ALL=C
export LANG=C
#LOG_FILE=/tmp/boot-tools-software.txt
#ADV
#Desactivamos upstart
dpkg-divert --local --rename --add /sbin/initctl
ln -s /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
#cp /tmp/sources.list /etc/apt/sources.list
#Limpiamos y actualizamos los repositorios apt (incluir siempre paquetes de 32 bits)
apt-get clean
OSARCH=${OSARCH:-$(dpkg --print-architecture)}
if [ "$OSARCH" != "i386" ]; then
dpkg --add-architecture i386
PKGS32="lib32gcc1 lib32stdc++6 lib32z1 libc6-i386"
fi
apt-get update
apt-get upgrade -y
#Desactivamos el hook del oginitrd.img para evitar problemas, al final de este escripts se activará
mv /etc/initramfs-tools/hooks/oghooks /etc/initramfs-tools/
# Preparamos el mtab necesario para la instalacion correcta de paquetes.
echo "/dev/sda1 / ext4 rw,errors=remount-ro 0 0" > /etc/mtab
# Instalamos el kernel.
# Deteccion de la versión y kernel a usar
OGCLIENTCFG=${OGCLIENTCFG:-/tmp/ogclient.cfg}
[ -f $OGCLIENTCFG ] && source $OGCLIENTCFG
OSRELEASE=${OSRELEASE:-$(uname -r)}
# Instalar Kernel firmado del repositorio de paquetes.
apt-get -y install linux-image-${OSRELEASE} linux-headers-${OSRELEASE} dkms shim-signed
apt-get -y install linux-modules-${OSRELEASE} linux-modules-extra-${OSRELEASE} 2>/dev/null
# Valores para paquetes interactivos.
cat << EOT | debconf-set-selections --
kexec-tools kexec-tools/load_kexec boolean true
openssh-server openssh-server/permit-root-login boolean true
refind refind/install_to_esp boolean false
EOT
apt-get -y install sshfs kexec-tools $PKGS32
#comenzamos con la instalación de los paquetes a instalar.
for group in `find /usr/bin/boot-tools/listpackages/ -name sw.*`
do
echo "Instalando el grupo de paquetes almacenados en $group"
for package in ` awk /^install/'{print $2}' $group `
do
echo -n $package
apt-get -y install $package &>/dev/null
RETVAL=$?
if [ $RETVAL == 0 ]
then
echo " : OK - Paquete instalado correctamente (codigo interno de apt-get $RETVAL)"
else
echo " : Error Paquete $package del grupo $group (codigo interno de apt-get $RETVAL) "
echo "Pulse [Intro] para continuar"
read
fi
done
done
# Instalar módulos que algunos paquetes puedan tener pendientes de compilar.
echo "Instalando módulos adicionales con DKMS"
while read -e mod vers; do
echo -n "Intalando módulo $mod v$vers"
dkms install -m $mod -v $vers &>/dev/null
RETVAL=$?
if [ $RETVAL == 0 ]; then
echo " : OK - Módulo instalado correctamente (codigo interno de dkms $RETVAL)"
else
echo " : Error módulo $mod (codigo interno de dkms $RETVAL) "
echo "Pulse [Intro] para continuar"
read
fi
done < <(dkms status 2>/dev/null | awk -F, '$3~/added/ {print $1,$2}')
#Activamos el hook del oginitrd.img
mv /etc/initramfs-tools/oghooks /etc/initramfs-tools/hooks/
# Dejamos el mtab como al principio
echo " " > /etc/mtab
#ADV
#TEST
#apt-get install localepurge
#localepurge
#rm /var/lib/dbus/machine-id; rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl;
#FIN ADV
apt-get clean
apt-get autoclean
apt-get autoremove
history -c

View File

@ -0,0 +1,14 @@
#!/bin/bash
export LANGUAGE=C
export LC_ALL=C
export LANG=C
apt-get clean
apt-get -y update
apt-get -y --force-yes install xorg-dev xorg lxde roxterm
apt-get clean
history -c

View File

@ -0,0 +1,25 @@
#!/bin/bash
echo "comprobando directorio .ssh del root"
if [ ! -d /root/.ssh ]
then
echo "creando directorio .ssh 600"
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
echo "comprobando el fichero authorized_keys .ssh del root"
if [ ! -f /root/.ssh/authorized_keys ]
then
echo "creando el fichero authorized_keys"
touch /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
fi
ssh-keygen -q -f /root/.ssh/id_rsa -N ""
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
## TODO: exportamos la publica a los repos
cp /root/.ssh/id_rsa.pub /tmp/rsa.ogclient.pub
history -c

View File

@ -0,0 +1,18 @@
#!/bin/bash
echo "comprobando directorio .ssh del root"
if [ ! -d /root/.ssh ]
then
echo "creando directorio .ssh 600"
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
echo "creando el fichero authorized_keys"
touch /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
echo "importando la clave publica del servidor OG"
cat /tmp/id_rsa.pub
[ -f /tmp/id_rsa.pub ] && cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys || echo "no key publica og"
history -c

View File

@ -0,0 +1,12 @@
#sw.X
#+300M
#install xorg-dev
#install xorg
#install lxde
#+80M roxterm y gparted
#install roxterm
#install gparted
#xvesa en compilacion
#install openbox
#install midori
install v86d # VESA Kernel 3.7+

View File

@ -0,0 +1,25 @@
#Format install paquete
install dialog
install man-db
install fbset
install gdebi-core
install bash-static
install busybox-static
#install console-data # ogLive anterior a Ubuntu 20.04
install locales
install lshw
install gawk
#install subversion # ogLive anterior a Ubuntu 18.04
install git # ogLive a partir de Ubuntu 18.04
install python-openssl
install python
#install php5-cli # ogLive anterior a Ubuntu 16.04
install php-cli # ogLive a partir de Ubuntu 16.04
install dmidecode
#install realpath # ogLive hasta Ubuntu 16.04
install rpm
#install zypper # PROBAR
install sqlite3
install os-prober
install moreutils
install jq

View File

@ -0,0 +1,17 @@
#sw.cloning
install fsarchiver
install pv
install pxe-kexec
install mbuffer
install parted
install gdisk
install chntpw
install clonezilla
install registry-tools
install reglookup
install libparse-win32registry-perl
install libwin-hivex-perl
install grokevt
install libhivex0
install libhivex-bin
install rsync

View File

@ -0,0 +1,11 @@
install build-essential
#install libattr* # Satura el tamaño del archivo en Ubuntu 15.04
install libattr1
install libattr1-dev
install uuid-dev
install attr
install make
install m4
install gettext
install libmhash-dev

View File

@ -0,0 +1,11 @@
#sw.compressor
install lzma
install zip
install unzip
install gzip
install lzop
install pigz
install pbzip2
install lbzip2
install rzip
install p7zip-full

View File

@ -0,0 +1,32 @@
#sw.filesystem.local
install squashfs-tools
install unionfs-fuse
#install drbl-ntfsprogs # Eliminado
install ntfs-3g
#install ntfs-config # ogLive anterior a Ubuntu 20.04
install dosfstools
install fatresize
install exfat-utils
install dmraid
install dmsetup
install lvm2
install e2fsprogs
#install btrfs-tools # ogLive anterior a Ubuntu 20.04
install btrfs-progs # ogLive a partir de Ubuntu 20.04
install jfsutils
install reiserfsprogs
install reiser4progs
install xfsprogs
install mhddfs
install hfsplus
install hfsprogs
install hfsutils
install nilfs-tools
install vmfs-tools
#install ufsutils # ogLive anterior a Ubuntu 14.04
#install zfsutils # ogLive anterior a Ubuntu 16.04
install zfsutils-linux # ogLive a partir de Ubuntu 16.04
install android-tools-adb # ogLive a partir de Ubuntu 16.04
install android-tools-fastboot # ogLive a partir de Ubuntu 16.04
#install android-tools-fsutils # ogLive entre Ubuntu 16.04 y Ubuntu 20.04
install f2fs-tools

View File

@ -0,0 +1,8 @@
#sw.filesystem.remote
#install nfs-common # Provoca error de instalación en Ubuntu 15.04
install sshfs
install cifs-utils
install smbclient
install open-iscsi
install openssh-server
#install bittornado # ogLive anterior a Ubuntu 20.04

View File

@ -0,0 +1,12 @@
#sw.monitoring
install htop
install ncdu
install bwbar
install bmon
install iftop
install ifstat
install dstat
install hdparm
install sdparm
install blktool
install testdisk

View File

@ -0,0 +1,17 @@
#sw.networking
install netpipes
install curl
install wget
install tftp
install dnsutils
install trickle
install lighttpd
install ethtool
install ssmping
install tcpdump
install nmap
install arping
#install iptraf
install ntpdate
install ctorrent
install udpcast

View File

@ -0,0 +1,71 @@
#sw.other
install screen
install schroot
install xmlstarlet
############# UEFI
install efibootmgr
install efitools
install refind
install grub-efi-amd64-bin
install grub-efi-ia32-bin
install grub-pc-bin
############# OGAgent
#install libxss1
#install python-prctl
#install python-six
#install python-requests
##############
install fusioninventory-agent
install nvme-cli
install disktype
install laptop-detect
#install discover
#install casper
#install lupin-casper
#install xinit
#install obconf
#install xserver-xorg
#install x11-xserver-utils
#install xterm network-manager-gnome
#install plymouth-x11
#install plymouth-label
#install plymouth-theme-ubuntu-logo
#install pcmanfm
#install chromium-browser
#install gtk-theme-switch
#install gtk2-engines
#install murrine-themes
####################################3
#install gnome-icon-theme
#install gnome-brave-icon-theme
#install dmz-cursor-theme
#install python-wnck
#install python-xlib
#install python-pyinotify
#install python-alsaaudio
#install python-vte maximus
#install gpicview
#install leafpad
#install lxappearance
#install lxmenu-data
#install lxrandr
#install lxterminal
#install nitrogen
#install ttf-ubuntu-font-family
#install time
#install synaptic
#install libglib-perl
#install libgtk2-perl
#install libxml-simple-perl
#install smartmontools
#install gnome-disk-utility
#install policykit-1-gnome
#install policykit-desktop-privileges
#install baobab
#install lshw-gtk
#install usb-creator-gtk
#install wodim
#install curlftpfs
#install libnotify-bin
#install cryptsetup
#install system-config-lvm

View File

@ -1,116 +0,0 @@
#!/bin/bash
# Compatibilidad con los argumentos usados con el browser original:
# browser -qws http://google.com
#
while getopts ":qwsDWX" opt ; do
case $opt in
q)
echo "Ignoring option: -q"
;;
w)
echo "Ignoring option: -w"
;;
s)
echo "Ignoring option: -s"
;;
D)
BROWSER_DEBUG=1
;;
W)
DISABLE_WAYLAND=1
;;
X)
DISABLE_X11=1
;;
esac
done
shift $(expr $OPTIND - 1 )
browser_args="$@"
echo "Browser args: $browser_args"
[ -n "$DISABLE_WAYLAND" ] && echo "WAYLAND DISABLED"
[ -n "$DISABLE_X11" ] && echo "X11 DISABLED"
if [ -n "BROWSER_DEBUG" ] ; then
echo "DEBUG MODE ENABLED"
echo "* Terminal available via Win+Enter"
echo "* Session may be killed with Ctrl+Alt+Backspace"
echo ""
fi
[ -x "/usr/bin/kitty" ] && wl_terminal=/usr/bin/kitty
[ -x "/usr/bin/foot" ] && wl_terminal=/usr/bin/foot
[ -x "/usr/bin/xterm" ] && x11_terminal=/usr/bin/kitty
[ -x "/usr/bin/i3-sensible-terminal" ] && x11_terminal=/usr/bin/i3-sensible-terminal
# The admin page is hosted remotely but executes things on localhost
QTWEBENGINE_CHROMIUM_FLAGS="--disable-web-security"
[ "$UID" -eq "0" ] && QTWEBENGINE_CHROMIUM_FLAGS="${QTWEBENGINE_CHROMIUM_FLAGS} --no-sandbox"
export QTWEBENGINE_CHROMIUM_FLAGS
rm -rf "/run/sway.started" "/run/x11.started"
mkdir -p $HOME/.config/sway
echo "exec /usr/bin/OGBrowser --ignore-ssl-errors \"$browser_args\" || /usr/bin/browser -qws \"$browser_args\"" > $HOME/.config/sway/config
if [ -n "BROWSER_DEBUG" ] ; then
echo "bindsym Mod4+Return exec $wl_terminal" >> $HOME/.config/sway/config
echo "bindsym Control+Alt+Backspace exit" >> $HOME/.config/sway/config
fi
echo "exec touch /run/sway.started" >> $HOME/.config/sway/config
mkdir -p $HOME/.config/i3
echo "exec /usr/bin/OGBrowser --ignore-ssl-errors \"$browser_args\" || /usr/bin/browser -qws \"$browser_args\"" > $HOME/.config/i3/config
if [ -n "BROWSER_DEBUG" ] ; then
echo "bindsym Mod4+Return exec i3-sensible-terminal" >> $HOME/.config/i3/config
echo "bindsym Control+Mod1+BackSpace exit" >> $HOME/.config/i3/config
fi
echo "exec touch /run/x11.started" >> $HOME/.config/i3/config
echo "exec /usr/bin/i3" > $HOME/.xinitrc
echo "exec /usr/bin/xterm" >> $HOME/.xinitrc
# Make sure libinput works
/usr/bin/udevadm trigger
if [ -x "/usr/bin/sway" -a -z "$DISABLE_WAYLAND" ] ; then
echo "*** Trying to launch Sway ***"
/usr/bin/sway
else
echo Sway not installed in this image, skipping.
fi
if [ ! -f "/run/sway.started" -a -z "$DISABLE_X11" ] ; then
if [ -x "/usr/bin/startx" ] ; then
echo "*** Trying to launch X11 ***"
/usr/bin/startx
else
echo X11 not installed in this image, skipping.
fi
else
echo "Sway was run before, not starting X11".
fi
if [ ! -f "/run/sway.started" -a ! -f "/run/x11.started" ] ; then
echo "Everything failed, dropping into a shell."
exec /usr/bin/bash
else
echo "All done."
fi

View File

@ -1,20 +0,0 @@
#!/usr/bin/python3
import sys
import dbus
if 2 != len(sys.argv):
sys.exit (1)
dest = 'es.opengnsys.OGBrowser.browser'
path = '/'
interface = None
method = 'setURL'
signature = 's'
url = sys.argv[1]
b = dbus.SystemBus()
try:
b.call_blocking (dest, path, interface, method, 's', [url])
except Exception as e:
sys.exit (1)

View File

@ -1,39 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIG5TCCBM2gAwIBAgIRANpDvROb0li7TdYcrMTz2+AwDQYJKoZIhvcNAQEMBQAw
gYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5MRQwEgYDVQQHEwtK
ZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMS4wLAYD
VQQDEyVVU0VSVHJ1c3QgUlNBIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTIw
MDIxODAwMDAwMFoXDTMzMDUwMTIzNTk1OVowRDELMAkGA1UEBhMCTkwxGTAXBgNV
BAoTEEdFQU5UIFZlcmVuaWdpbmcxGjAYBgNVBAMTEUdFQU5UIE9WIFJTQSBDQSA0
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEApYhi1aEiPsg9ZKRMAw9Q
r8Mthsr6R20VSfFeh7TgwtLQi6RSRLOh4or4EMG/1th8lijv7xnBMVZkTysFiPmT
PiLOfvz+QwO1NwjvgY+Jrs7fSoVA/TQkXzcxu4Tl3WHi+qJmKLJVu/JOuHud6mOp
LWkIbhODSzOxANJ24IGPx9h4OXDyy6/342eE6UPXCtJ8AzeumTG6Dfv5KVx24lCF
TGUzHUB+j+g0lSKg/Sf1OzgCajJV9enmZ/84ydh48wPp6vbWf1H0O3Rd3LhpMSVn
TqFTLKZSbQeLcx/l9DOKZfBCC9ghWxsgTqW9gQ7v3T3aIfSaVC9rnwVxO0VjmDdP
FNbdoxnh0zYwf45nV1QQgpRwZJ93yWedhp4ch1a6Ajwqs+wv4mZzmBSjovtV0mKw
d+CQbSToalEUP4QeJq4Udz5WNmNMI4OYP6cgrnlJ50aa0DZPlJqrKQPGL69KQQz1
2WgxvhCuVU70y6ZWAPopBa1ykbsttpLxADZre5cH573lIuLHdjx7NjpYIXRx2+QJ
URnX2qx37eZIxYXz8ggM+wXH6RDbU3V2o5DP67hXPHSAbA+p0orjAocpk2osxHKo
NSE3LCjNx8WVdxnXvuQ28tKdaK69knfm3bB7xpdfsNNTPH9ElcjscWZxpeZ5Iij8
lyrCG1z0vSWtSBsgSnUyG/sCAwEAAaOCAYswggGHMB8GA1UdIwQYMBaAFFN5v1qq
K0rPVIDh2JvAnfKyA2bLMB0GA1UdDgQWBBRvHTVJEGwy+lmgnryK6B+VvnF6DDAO
BgNVHQ8BAf8EBAMCAYYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHSUEFjAUBggr
BgEFBQcDAQYIKwYBBQUHAwIwOAYDVR0gBDEwLzAtBgRVHSAAMCUwIwYIKwYBBQUH
AgEWF2h0dHBzOi8vc2VjdGlnby5jb20vQ1BTMFAGA1UdHwRJMEcwRaBDoEGGP2h0
dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VU0VSVHJ1c3RSU0FDZXJ0aWZpY2F0aW9u
QXV0aG9yaXR5LmNybDB2BggrBgEFBQcBAQRqMGgwPwYIKwYBBQUHMAKGM2h0dHA6
Ly9jcnQudXNlcnRydXN0LmNvbS9VU0VSVHJ1c3RSU0FBZGRUcnVzdENBLmNydDAl
BggrBgEFBQcwAYYZaHR0cDovL29jc3AudXNlcnRydXN0LmNvbTANBgkqhkiG9w0B
AQwFAAOCAgEAUtlC3e0xj/1BMfPhdQhUXeLjb0xp8UE28kzWE5xDzGKbfGgnrT2R
lw5gLIx+/cNVrad//+MrpTppMlxq59AsXYZW3xRasrvkjGfNR3vt/1RAl8iI31lG
hIg6dfIX5N4esLkrQeN8HiyHKH6khm4966IkVVtnxz5CgUPqEYn4eQ+4eeESrWBh
AqXaiv7HRvpsdwLYekAhnrlGpioZ/CJIT2PTTxf+GHM6cuUnNqdUzfvrQgA8kt1/
ASXx2od/M+c8nlJqrGz29lrJveJOSEMX0c/ts02WhsfMhkYa6XujUZLmvR1Eq08r
48/EZ4l+t5L4wt0DV8VaPbsEBF1EOFpz/YS2H6mSwcFaNJbnYqqJHIvm3PLJHkFm
EoLXRVrQXdCT+3wgBfgU6heCV5CYBz/YkrdWES7tiiT8sVUDqXmVlTsbiRNiyLs2
bmEWWFUl76jViIJog5fongEqN3jLIGTG/mXrJT1UyymIcobnIGrbwwRVz/mpFQo0
vBYIi1k2ThVh0Dx88BbF9YiP84dd8Fkn5wbE6FxXYJ287qfRTgmhePecPc73Yrzt
apdRcsKVGkOpaTIJP/l+lAHRLZxk/dUtyN95G++bOSQqnOCpVPabUGl2E/OEyFrp
Ipwgu2L/WJclvd6g+ZA/iWkLSMcpnFb+uX6QBqvD6+RNxul1FaB5iHY=
-----END CERTIFICATE-----

View File

@ -1,138 +0,0 @@
[General]
logging_level = INFO
rootfs_image_label = ogClient
debconf_settings =
kexec-tools kexec-tools/load_kexec boolean true
openssh-server openssh-server/permit-root-login boolean true
refind refind/install_to_esp boolean false
console-setup console-setup/charmap47 select UTF-8
console-setup console-setup/codeset47 select . Combined - Latin; Slavic Cyrillic; Greek
console-setup console-setup/fontface47 select VGA
console-setup console-setup/fontsize-fb47 select 8x16
isolinux_template =
DEFAULT menu.c32
PROMPT 0
ALLOWOPTIONS 1
MENU TITLE OpenGnsys __NAMEISOCLIENT__
LABEL 0
MENU LABEL ogLive vga irqpool acpi ogdebug ip:none
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro vga=788 irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=none
LABEL 1
MENU LABEL ogLive irqpoll acpi ip:none
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=none
LABEL 2
MENU LABEL ogLive acpi debug ip=dhcp
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=dhcp
LABEL 3
MENU LABEL ogLive ip=dhcp
KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro acpi=off boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=dhcp
LABEL 4
MENU LABEL local
localboot 0x80
append -
label 5
MENU LABEL Network boot via gPXE lkrn
KERNEL __PXEPKG__.lkrn
label 6
MENU LABEL Network boot via gPXE usb
KERNEL __PXEPKG__.usb
label 7
MENU LABEL Network boot via gPXE pxe
KERNEL __PXEPKG__.pxe
label 8
MENU LABEL Network boot via gPXE iso
KERNEL __PXEPKG__.iso
label 9
MENU LABEL pxe
KERNEL /clonezilla/live/vmlinuz1
APPEND initrd=/clonezilla/live/initrd1.img boot=live union=aufs noswap vga=788 ip=frommedia
[Packages]
basic =
dialog man-db fbset gdebi-core bash-static busybox-static locales lshw gawk git python3-openssl python3 php-cli dmidecode rpm sqlite3 os-prober moreutils jq
#console-data # ogLive anterior a Ubuntu 20.04
#subversion # ogLive anterior a Ubuntu 18.04
#php5-cli # ogLive anterior a Ubuntu 16.04
#realpath # ogLive hasta Ubuntu 16.04
#zypper # PROBAR
cloning = fsarchiver pv
#pxe-kexec # ubuntu noble: Unable to locate package
mbuffer parted gdisk chntpw clonezilla registry-tools reglookup libparse-win32registry-perl libwin-hivex-perl grokevt libhivex0 libhivex-bin rsync
compile =
build-essential libattr1 libattr1-dev uuid-dev attr make m4 gettext libmhash-dev
#libattr* # Satura el tamaño del archivo en Ubuntu 15.04
compressor = lzma zip unzip gzip lzop pigz pbzip2 lbzip2 rzip p7zip-full
filesystem_local =
squashfs-tools unionfs-fuse ntfs-3g dosfstools fatresize
#exfat-utils # ubuntu noble: has no installation candidate
dmraid dmsetup lvm2 e2fsprogs
jfsutils reiserfsprogs reiser4progs xfsprogs mhddfs hfsplus hfsprogs hfsutils nilfs-tools vmfs-tools
btrfs-progs # ogLive a partir de Ubuntu 20.04
#zfsutils-linux # ogLive a partir de Ubuntu 16.04 -- desactivado temporalmente
android-tools-adb # ogLive a partir de Ubuntu 16.04
android-tools-fastboot # ogLive a partir de Ubuntu 16.04
f2fs-tools
#drbl-ntfsprogs # Eliminado
#ntfs-config # ogLive anterior a Ubuntu 20.04
#btrfs-tools # ogLive anterior a Ubuntu 20.04
#ufsutils # ogLive anterior a Ubuntu 14.04
#zfsutils # ogLive anterior a Ubuntu 16.04
#android-tools-fsutils # ogLive entre Ubuntu 16.04 y Ubuntu 20.04
filesystem_remote =
sshfs cifs-utils smbclient open-iscsi openssh-server
#nfs-common # Provoca error de instalación en Ubuntu 15.04
#bittornado # ogLive anterior a Ubuntu 20.04
monitoring = htop ncdu bwbar bmon iftop ifstat dstat hdparm sdparm blktool testdisk kitty-terminfo
networking = netpipes curl wget tftp-hpa dnsutils
#trickle # ubuntu noble: has no installation candidate
lighttpd ethtool ssmping tcpdump nmap arping ntpdate ctorrent udpcast #iptraf
testing =
screen schroot xmlstarlet
efibootmgr efitools refind grub-efi-amd64-bin grub-efi-ia32-bin grub-pc-bin ## UEFI
#libxss1 python-prctl python-six python-requests ## OGAgent
##############
fusioninventory-agent nvme-cli disktype laptop-detect
#discover casper lupin-casper xinit obconf xserver-xorg x11-xserver-utils xterm network-manager-gnome plymouth-x11 plymouth-label plymouth-theme-ubuntu-logo pcmanfm chromium-browser gtk-theme-switch gtk2-engines murrine-themes
####################################3
#gnome-icon-theme gnome-brave-icon-theme dmz-cursor-theme python-wnck python-xlib python-pyinotify python-alsaaudio python-vte maximus gpicview leafpad lxappearance lxmenu-data lxrandr lxterminal nitrogen ttf-ubuntu-font-family time synaptic libglib-perl libgtk2-perl libxml-simple-perl smartmontools gnome-disk-utility policykit-1-gnome policykit-desktop-privileges baobab lshw-gtk usb-creator-gtk wodim curlftpfs libnotify-bin cryptsetup system-config-lvm
xwindows =
v86d # VESA Kernel 3.7+
icewm xserver-common xserver-xorg xserver-xorg-core xserver-xorg-input-all xserver-xorg-video-all xinit i3
#xorg-dev xorg lxde #+300M
#roxterm gparted #+80M
#openbox midori #xvesa en compilacion
ogagent = stunnel4
ogbrowser = sway libinput-tools hwdata ogbrowser
oggit = python3 python3-git python3-pyxattr python3-libarchive-c python3-pylibacl python3-pip python3-hivex opengnsys-libarchive-c python3-termcolor bsdextrautils opengnsys-pyblkid opengnsys-gitlib ntfs-3g-system-compression python3-tqdm

View File

@ -1,175 +0,0 @@
#!/usr/bin/python3
import sys
import os
import logging
import subprocess
import glob
import stat
import shutil
import argparse
import datetime
curdir = os.path.dirname (__file__)
sys.path.insert (0, curdir)
from boottools import utils, apt, btog
os.chdir (curdir)
def _logging (lvl='INFO', logfile='/tmp/boot-tools_installation.log'):
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,
handlers = [
logging.FileHandler (logfile),
logging.StreamHandler (sys.stdout),
],
)
return logging.getLogger ('boottools')
def _mount_rootfs (btrootfsimg, btrootfsmnt):
try: utils.mount (btrootfsimg, btrootfsmnt, opts=['-o', 'loop,offset=32256'])
except:
logger.error ('mount failed')
sys.exit (1)
def _get_pxepkg():
pxepkg = None
cache = apt.cache_search (['gpxe', 'ipxe'])
if cache['gpxe']: pxepkg = 'gpxe'
if cache['ipxe']: pxepkg = 'ipxe'
if pxepkg is None:
logger.error ('neither gpxe nor ipxe found in apt cache')
sys.exit (1)
logger.info (f'PXE package is "{pxepkg}"')
return pxepkg
def _mkrootfs (btrootfsimg, btrootfsmnt, btrootfsimglabel, btvirtualdisksize, bttargetdir, osarch):
logger.info ('Stage 1.1 - create, partition and format the rootfs')
rc = subprocess.run (f'file "{btrootfsimg}" |grep -q "partition 1 *: ID=0x83"', shell=True).returncode
if (rc): ## 'file|grep' failed
try: btog.mkrootfs (btrootfsimg, btrootfsimglabel, btrootfsmnt, btvirtualdisksize, bttargetdir, osarch)
except Exception as e:
logger.error (str (e))
sys.exit (1)
def _debootstrap (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp):
logger.info ('Stage 1.2 - debootstrap system')
_mount_rootfs (btrootfsimg, btrootfsmnt)
try: os.stat (os.path.join (btrootfsmnt, 'etc'))
except:
logger.debug (f'stat failed, calling btog.debootstrap()')
try: btog.debootstrap (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp)
except Exception as e:
utils.umount (btrootfsmnt)
logger.error (str (e))
sys.exit (1)
utils.umount (btrootfsmnt)
def _initramfs_version (gitrelease, osrelease, curdir):
utils.run (['sed', '-i', f'1 s/$/ {gitrelease} ({osrelease})/', f'{curdir}/includes/etc/initramfs-tools/scripts/VERSION.txt'])
def _copy_og_files (btrootfsimg, btrootfsmnt, osdistrib, oscodename):
_mount_rootfs (btrootfsimg, btrootfsmnt)
builder = '/tmp/opengnsys/oglive_builder'
og_shared = '/tmp/opengnsys/shared'
ogrepo_ssh_key = '/tmp/opengnsys/ogrepo-ssh-key'
btog.copy_og_files (builder, og_shared, ogrepo_ssh_key, btrootfsmnt, osdistrib, oscodename)
utils.umount (btrootfsmnt)
def _chroot_tasks (cfgfile, curdir, osrelease, osarch):
logger.debug (f'running \'schroot --chroot IMGogclient -- {curdir}/chroot-tasks.py --osrelease "{osrelease}" --osarch "{osarch}"\'')
stdout, _ = utils.run (['schroot', '--chroot', 'IMGogclient', '--', f'{curdir}/chroot-tasks.py', '--osrelease', osrelease, '--osarch', osarch, '--config', cfgfile])
## this leaves initrd.img-6.8.0-31-generic and vmlinuz-6.8.0-31-generic in /tmp
def _ssh_stuff (btrootfsimg, btrootfsmnt):
_mount_rootfs (btrootfsimg, btrootfsmnt)
btog.sysctl (btrootfsmnt)
btog.ssh_server (btrootfsmnt)
btog.ssh_client (btrootfsmnt)
utils.umount (btrootfsmnt)
## the end result is:
## - there's a new key pair in the VM (or docker container), in /root/.ssh
## - there's another new key pair in the rootfs, in /var/lib/tftpboot/ogclient/ogclientmount/root/.ssh
## - the two pubkeys (one of each pair) end up being authorised in the rootfs, in /var/lib/tftpboot/ogclient/ogclientmount/root/.ssh/authorized_keys
def _mkinitrd_squashfs_isofs (bttargetdir, osrelease, btrootfsimg, btrootfsmnt, pxepkg, isolinux_tpl, nameisoclient):
logger.info ('Stage 4.1 - Put initrd in place')
_mount_rootfs (btrootfsimg, btrootfsmnt)
btog.move_initrd (bttargetdir, osrelease)
logger.info ('Stage 4.2 - make squash filesystem')
btog.mksquashfs (bttargetdir, btrootfsmnt)
utils.umount (btrootfsmnt)
logger.info ('Stage 4.3 - make iso filesystem')
btog.mkisofs (pxepkg, isolinux_tpl, bttargetdir, nameisoclient)
def _main (cfgfile, config, type_client):
isolinux_tpl = config['General'].get ('isolinux_template')
btrootfsimglabel = config['General'].get ('rootfs_image_label')
logger.info ('OpenGnsys CLIENT installation begins')
fd = open (f'{curdir}/gitrelease', 'r') ## per the Dockerfile
gitrelease = fd.readline().strip()
fd.close()
osdistrib, oscodename, osrelease, osarch, oshttp = btog.GetOsInfo (type_client)
if osdistrib is None:
logger.error ('GetOsInfo() failed')
sys.exit (1)
bttargetdir, btrootfsimg, btrootfsmnt, btvirtualdisksize = btog.GetVar (osarch)
logger.info (':'.join ([osdistrib, oscodename, osrelease, osarch, oshttp]))
## this is convenient in case the previous run failed and we want to run this program again
try: utils.umount (btrootfsmnt)
except: pass
logger.info ('STAGE 1 - create and bootstrap rootfs')
_mkrootfs (btrootfsimg, btrootfsmnt, btrootfsimglabel, btvirtualdisksize, bttargetdir, osarch)
_debootstrap (btrootfsimg, btrootfsmnt, osarch, oscodename, oshttp)
logger.info ('STAGE 2 - copy files to the rootfs')
today = datetime.datetime.now(datetime.timezone.utc).strftime ('%Y%m%d')
_initramfs_version (gitrelease+'_'+today, osrelease, curdir)
_copy_og_files (btrootfsimg, btrootfsmnt, osdistrib, oscodename)
logger.info ('STAGE 3 - perform tasks within the chroot')
_chroot_tasks (cfgfile, curdir, osrelease, osarch)
_ssh_stuff (btrootfsimg, btrootfsmnt)
logger.info ('STAGE 4 - generate distribution files')
pxepkg = _get_pxepkg()
nameisoclient = '-'.join (['ogLive', oscodename, osrelease, osarch, gitrelease+'_'+today])
_mkinitrd_squashfs_isofs (bttargetdir, osrelease, btrootfsimg, btrootfsmnt, pxepkg, isolinux_tpl, nameisoclient)
logger.info ('OpenGnsys installation finished')
if __name__ == '__main__':
if os.getuid():
print ('ERROR: this program must run under root privileges!!', file=sys.stderr)
sys.exit (1)
parser = argparse.ArgumentParser()
parser.add_argument ('--loglevel', help='Log level', action='store')
parser.add_argument ('--codename', help='OS codename', action='store')
parser.add_argument ('--config', help='Path to configuration file', action='store')
args = parser.parse_args()
cfgfile = args.config or 'mkoglive.cfg'
config = utils.read_config (cfgfile)
if config is None:
print ('ERROR: no configuration found', file=sys.stderr)
sys.exit (1)
cfg_loglevel = config['General'].get ('logging_level')
logger = _logging (args.loglevel or cfg_loglevel)
_main (cfgfile, config, args.codename)

View File

@ -1,12 +0,0 @@
# 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

3
qndtest 100644
View File

@ -0,0 +1,3 @@
test
lgromero@test
aguerrero@test

View File

@ -1,10 +0,0 @@
[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