ogclone-engine/ogclient/scripts/configureOsCustomTemplate.py

39 lines
1.4 KiB
Python

#!/usr/bin/python3
#/**
# configureOsCustom
#@brief Plantilla para scirpt de configuracion personalizada de sistema operativo restaurado.
#@param $1 nº de disco
#@param $2 nº de partición
#@param $3 Repositorio: CACHE, REPO o dirección IP (opcional)
#@param $4 Nombre canónico de la imagen sin extensión (opcional)
#@warning Renombrar este fichero como "configureOsCustom" para sustituir al script estándar "configureOs".
#@note Los parámetros disco y partición son obligatorios y opcionalmente puede recibir también el repositorio y la imagen usada para en el despliegue.
#**/
import sys
import subprocess
import ogGlobals
from SystemLib import ogRaiseError, ogEcho
from InventoryLib import ogGetOsType
prog = sys.argv[0]
if len (sys.argv) not in [3, 5]:
ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'{ogGlobals.lang.MSG_FORMAT} configureOsCustom int_ndisc int_npart [str_repo str_imgname]')
sys.exit (1)
disk, par, *other = sys.argv[1:]
repo = other[0].upper() if len (other) > 0 else ''
imgname = other[1] if len (other) > 1 else ''
# Nota: incluye llamada al script "configureOs" para realizar previamente una configuración estándar.
subprocess.run ([f'configureOs.py', disk, par, imgname])
ostype = ogGetOsType (disk, par)
if 'Windows' == ostype:
pass
elif 'Linux' == ostype:
pass
elif 'MacOS' == ostype:
pass