Remove unused code
parent
a1cd039d4f
commit
6c161095af
|
@ -197,7 +197,7 @@ class NTFSLibrary:
|
|||
|
||||
class OpengnsysGitLibrary:
|
||||
|
||||
"""Libreria de git"""
|
||||
"""OpenGnsys Git Library"""
|
||||
def __init__(self, require_cache = True, ntfs_implementation = NTFSImplementation.Kernel):
|
||||
"""
|
||||
Initializes the Git library for OpenGnsys.
|
||||
|
@ -1278,71 +1278,6 @@ class OpengnsysGitLibrary:
|
|||
repo.config_writer().add_value("user", "email", "OpenGnsys@opengnsys.com").release()
|
||||
repo.config_writer().add_value("core", "filemode", "false").release()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def ogUuidUpdate(str_repo, str_path_image, int_ndisk, int_part):
|
||||
"""
|
||||
#ogUuidUpdate str_repo str_path_image int_ndisk str_repo
|
||||
|
||||
#@brief Actualiza el UUID de un sistema de ficheros en los archivos de configuración.
|
||||
#@param str_repo repositorio de imágenes o caché local
|
||||
#@param str_path_image camino dOk, you can convince me that I'm not an "artist". But so what then? I'll keep generating pictures anyway. I don't make them because I yearn for the coveted status of "artist", but because I enjoy making whatever you want to call I'm making, and the exact terminology is about the least interesting part of the entire thing.e la imagen
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@param int_part nº de partición
|
||||
#@return (nada, por determinar)
|
||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||
#@exception OG_ERR_NOTFOUND fichero o dispositivo no encontrado.
|
||||
"""
|
||||
|
||||
# Comprobamos que sea un sistema linux
|
||||
if ogGetOsType(str_repo, str_path_image) != "Linux":
|
||||
ogRaiseError(OG_ERR_NOTFOUND, "Linux system.")
|
||||
return
|
||||
|
||||
# Comprobamos que existe archivo de información de la imagen
|
||||
INFOFILE = ogGetPath(str_repo, f".{str_path_image}.img.jsonl")
|
||||
if INFOFILE == "":
|
||||
return ogRaiseError(OG_ERR_NOTFOUND, INFOFILE)
|
||||
|
||||
# Comprobamos que exista la partición
|
||||
MNTDIR = ogMount(int_ndisk, int_part)
|
||||
if MNTDIR is None:
|
||||
ogRaiseError(OG_ERR_NOTFOUND, f"Device {str_repo} {str_path_image}")
|
||||
return
|
||||
|
||||
DEVICE = ogDiskToDev(int_ndisk, int_part)
|
||||
UUID = subprocess.check_output(["blkid", "-o", "value", "-s", "UUID", DEVICE]).decode().strip()
|
||||
OLDUUID = subprocess.check_output(["jq", ".uuid", INFOFILE]).decode().strip().replace('"', '')
|
||||
|
||||
# Para sistemas UEFI también cambio los archivos de la ESP
|
||||
if ogIsEfiActive():
|
||||
GRUBEFI = ogMount(ogGetEsp())
|
||||
GRUBEFI = f"{GRUBEFI}/boot/grubMBR/boot/grub/grub.cfg"
|
||||
else:
|
||||
GRUBEFI = ""
|
||||
|
||||
# Obtenemos el dispositivo en formato del grub
|
||||
grub_probe = os.environ.get("grub_probe", f"{OGBIN}/grub-probe1.99_{os.uname().machine}")
|
||||
ROOT = subprocess.check_output([grub_probe, "--device", ogDiskToDev(int_ndisk, int_part), "--target=drive"]).decode().strip().replace('()', "''")
|
||||
|
||||
# Cambiamos UUID en la configuración (fstab y grub)
|
||||
files = [
|
||||
f"{MNTDIR}/etc/fstab",
|
||||
f"{MNTDIR}/{{,boot/}}{GRUBEFI}",
|
||||
f"{MNTDIR}/{{,boot/}}{{grubMBR,grubPARTITION}}/boot/grub{{,2}}/{{menu.lst,grub.cfg}}",
|
||||
f"{GRUBEFI}"
|
||||
]
|
||||
for f in files:
|
||||
if os.path.isfile(f):
|
||||
with open(f, "r+") as file:
|
||||
content = file.read()
|
||||
content = content.replace(OLDUUID, UUID).replace("'hd.,gpt.'", ROOT).replace("hd.,msdos.", ROOT)
|
||||
file.seek(0)
|
||||
file.write(content)
|
||||
file.truncate()
|
||||
|
||||
def initRepo(self, device, repo_name):
|
||||
"""
|
||||
Initialize a Git repository on a specified device.
|
||||
|
|
Loading…
Reference in New Issue