ogclone-engine/ogclient/scripts/bootOsCustomTemplate.py

44 lines
1.2 KiB
Python

#!/usr/bin/python3
#/**
# bootOsCustomTemplate.py
#@brief Plantilla para script de configuración personalizada de sistema operativo restaurado.
#@param $1 nº de disco
#@param $2 nº de partición
#@warning Renombrar este fichero como "bootOsCustom.py" para personalizar el script estándar "bootOs.py".
#@note La partición a inicializar debe estar montada
#**/
import sys
import ogGlobals
from SystemLib import ogRaiseError, ogEcho
from DiskLib import ogDiskToDev
from FileSystemLib import ogMount
from NetLib import ogGetHostname
from InventoryLib import ogGetOsType
prog = sys.argv[0]
# Control de errores
if len (sys.argv) < 3:
ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'Formato: {prog} ndisco nfilesys')
sys.exit (1)
disk, par = sys.argv[1:]
device = ogDiskToDev (disk, par)
if not device: sys.exit (1)
# Nota: el script "bootOs.py" llama al script "bootOsCustom.py" después de realizar la operaciones de inicio estándar y antes de desmontar las particiones e iniciar el sistema operativo.
mntdir = ogMount (disk, par)
if not mntdir: sys.exit (1)
name = ogGetHostname()
if not name: name = 'pc'
ostype = ogGetOsType (disk, par)
if 'Windows' == ostype:
pass
elif 'Linux' == ostype:
pass