refs #401 adds functions for tftpboot
parent
d342d88c80
commit
ff14b6b84f
|
@ -521,10 +521,24 @@ def tftpConfigure():
|
||||||
echoAndLog(f"Habilitando y arrancando el servicio {service}.service")
|
echoAndLog(f"Habilitando y arrancando el servicio {service}.service")
|
||||||
subprocess.run(["systemctl", "enable", f"{service}.service"], check=True)
|
subprocess.run(["systemctl", "enable", f"{service}.service"], check=True)
|
||||||
subprocess.run(["systemctl", "start", 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"
|
symlink_target = f"{INSTALL_TARGET}/tftpboot"
|
||||||
echoAndLog(f"Creando enlace simbólico de /var/lib/tftpboot a {symlink_target}")
|
echoAndLog(f"Creando enlace simbólico de /var/lib/tftpboot a {symlink_target}")
|
||||||
if not os.path.exists(symlink_target):
|
if not os.path.exists(symlink_target):
|
||||||
os.symlink("/var/lib/tftpboot", symlink_target)
|
os.symlink("/var/lib/tftpboot", symlink_target)
|
||||||
|
os.chown(symlink_target, pwd.getpwnam("ogboot").pw_uid, pwd.getpwnam("ogboot").pw_gid)
|
||||||
else:
|
else:
|
||||||
warningAndLog(f"El enlace simbólico ya existe: {symlink_target}")
|
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")
|
file.write(f"include = {SAMBACFGDIR}/smb-ogboot.conf\n")
|
||||||
service = SAMBASERV
|
service = SAMBASERV
|
||||||
subprocess.run(["systemctl", "enable", f"{service}.service"])
|
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
|
# Comprobar si se ha configurado correctamente Samba
|
||||||
if subprocess.run(["systemctl", "is-active", f"{service}.service"]).returncode == 0:
|
if subprocess.run(["systemctl", "is-active", f"{service}.service"]).returncode == 0:
|
||||||
echoAndLog(f"{service} service started successfully.")
|
echoAndLog(f"{service} service started successfully.")
|
||||||
|
|
Loading…
Reference in New Issue