refs #401 adds functions for tftpboot

ogboot_installer
qindel 2024-05-31 05:53:47 +00:00
parent d342d88c80
commit ff14b6b84f
1 changed files with 16 additions and 2 deletions

View File

@ -521,10 +521,24 @@ def tftpConfigure():
echoAndLog(f"Habilitando y arrancando el servicio {service}.service")
subprocess.run(["systemctl", "enable", f"{service}.service"], check=True)
subprocess.run(["systemctl", "start", f"{service}.service"], check=True)
#Crear directorio /var/lib/tftpboot
if not os.path.exists(TFTPCFGDIR):
os.makedirs(TFTPCFGDIR)
echoAndLog(f"Directorio {TFTPCFGDIR} creado.")
#Descargar oglive
echoAndLog("Downloading oglive...")
#Temporalmente se copia desde ~/oglive
subprocess.run(["cp", "-r", f"{PROGRAM_DIR}/../../oglive/ogLive-5.11.0-r20210413", f"/var/lib/tftpboot/"])
#Crear enlace simbólico de oglive-5.11.0-r20210413 a /var/lib/tftpboot/ogLive
subprocess.run(["ln", "-s", f"/var/lib/tftpboot/ogLive-5.11.0-r20210413", "/var/lib/tftpboot/ogLive"])
#Crear enlace simbólico de /var/lib/tftpboot/ogLive a /var/lib/tftpboot/ogLive/ogclient
subprocess.run(["ln", "-s", "/var/lib/tftpboot/ogLive", "/var/lib/tftpboot/ogclient"])
symlink_target = f"{INSTALL_TARGET}/tftpboot"
echoAndLog(f"Creando enlace simbólico de /var/lib/tftpboot a {symlink_target}")
if not os.path.exists(symlink_target):
os.symlink("/var/lib/tftpboot", symlink_target)
os.chown(symlink_target, pwd.getpwnam("ogboot").pw_uid, pwd.getpwnam("ogboot").pw_gid)
else:
warningAndLog(f"El enlace simbólico ya existe: {symlink_target}")
@ -702,7 +716,7 @@ def smbConfigure():
file.write(f"include = {SAMBACFGDIR}/smb-ogboot.conf\n")
service = SAMBASERV
subprocess.run(["systemctl", "enable", f"{service}.service"])
subprocess.run(["systemctl", "start", f"{service}.service"])
subprocess.run(["systemctl", "restart", f"{service}.service"])
# Comprobar si se ha configurado correctamente Samba
if subprocess.run(["systemctl", "is-active", f"{service}.service"]).returncode == 0:
echoAndLog(f"{service} service started successfully.")
@ -813,4 +827,4 @@ mount_NFS()
echoAndLog("Configurando Samba")
smbConfigure()
echoAndLog(f"ogBoot installation finished.")
echoAndLog(f"ogBoot installation finished.")