diff --git a/etc/kea-dhcp4.conf.tmpl b/etc/kea-dhcp4.conf.tmpl index 047b8ed..1c40096 100644 --- a/etc/kea-dhcp4.conf.tmpl +++ b/etc/kea-dhcp4.conf.tmpl @@ -31,13 +31,13 @@ "name": "UEFI-64", "test": "not substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'", "boot-file-name": "ipxe.efi", - "next-server": "SERVERIP" + "next-server": "__SERVERIP__" }, { "name": "Legacy", "test": "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'", "boot-file-name": "undionly.kpxe", - "next-server": "SERVERIP" + "next-server": "__SERVERIP__" } ] } diff --git a/etc/mac_script.ipxe.tmpl b/etc/mac_script.ipxe.tmpl index faf030f..ad916da 100644 --- a/etc/mac_script.ipxe.tmpl +++ b/etc/mac_script.ipxe.tmpl @@ -7,8 +7,8 @@ set kernelargs ro boot=oginit quiet splash irqpoll acpi=on og2nd=sqfs ogprotocol echo "OgLive $ISODIR" ifopen net0 route -kernel tftp://SERVERIP/ogLive/ogvmlinuz ${kernelargs} -initrd tftp://SERVERIP/ogLive/oginitrd.img +kernel tftp://__SERVERIP__/ogLive/ogvmlinuz ${kernelargs} +initrd tftp://__SERVERIP__/ogLive/oginitrd.img boot diff --git a/installer/ogboot_installer.py b/installer/ogboot_installer.py index 8301029..7be99d6 100755 --- a/installer/ogboot_installer.py +++ b/installer/ogboot_installer.py @@ -287,7 +287,11 @@ def generate_config_url(): def create_ogboot_project(path_opengnsys_base): subprocess.run(["sudo", "useradd", "-m", "ogboot"]) #subprocess.run(["composer", "create-project", "--no-interaction", "symfony/website-skeleton", path_opengnsys_base], user="root") - subprocess.run(["composer", "create-project", "--no-interaction", "symfony/website-skeleton", path_opengnsys_base]) + #parent_dir = os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))) + #composer_json_path = os.path.join(parent_dir, 'composer.json') + subprocess.run(["composer", "create-project", "symfony/website-skeleton", path_opengnsys_base]) + os.chdir(path_opengnsys_base) + shutil.copy(f"{WORKDIR}/ogboot/.env", INSTALL_TARGET) subprocess.run(["rm", f"{path_opengnsys_base}/composer.lock"]) print("Esqueleto de la aplicación creado y archivo composer.lock eliminado.") @@ -452,8 +456,9 @@ def tftpConfigure(): subprocess.run(["systemctl", "enable", f"{service}.service"]) subprocess.run(["systemctl", "start", f"{service}.service"]) + os.symlink("/var/lib/tftpboot", f"{INSTALL_TARGET}/tftpboot") # comprobamos el servicio tftp - time.sleep(1) + #time.sleep(1) #testPxe() def mount_NFS(): @@ -493,18 +498,12 @@ def mount_NFS(): def generate_ipxe_script(): print("Generando script IPXE...") - #os.symlink(INSTALL_TARGET, INSTALL_OPENGNSYS_TARGET) - #print(f"INSTALL_TARGET: {INSTALL_TARGET}") - #print(f"INSTALL_OPENGNSYS_TARGET: {INSTALL_OPENGNSYS_TARGET}") - #os.symlink(INSTALL_TARGET, INSTALL_OPENGNSYS_TARGET, target_is_directory=True) ip_address_server = subprocess.check_output(["ifconfig", "eth0"]).decode().split("\n")[1].split()[1] template = os.path.join(WORKDIR, "ogboot/etc/dhcp_boot.ipxe.tmpl") ipxe_output = "/opt/ogboot/tftpboot/ipxe_scripts/dhcp_boot.ipxe" os.makedirs(os.path.dirname(ipxe_output), exist_ok=True) - print (f"copiando -{template}- a -{ipxe_output}-") - print (f"reemplazando IP -{ip_address_server}- en -{ipxe_output}-") shutil.copy(template, ipxe_output) with open(ipxe_output, "r") as ipxe_file: ipxe_content = ipxe_file.read() @@ -540,7 +539,7 @@ def smbConfigure(): # Copiar plantilla de recursos para OpenGnsys with open(os.path.join(WORKDIR, 'ogboot/etc/smb-ogboot.conf.tmpl'), 'r') as tmpl_file: template = tmpl_file.read() - replaced_template = template.replace('OGBOOTDIR', INSTALL_TARGET) + replaced_template = template.replace('OGBOOTDIR', INSTALL_OPENGNSYS_TARGET) with open(os.path.join(SAMBACFGDIR, 'smb-ogboot.conf'), 'w') as conf_file: conf_file.write(replaced_template) @@ -601,16 +600,16 @@ else: if not os.path.exists("ogboot"): os.symlink(os.path.dirname(PROGRAM_DIR), "ogboot") -create_ogboot_project(INSTALL_TARGET) -if os.system("echo $?") != 0: - errorAndLog("Error while creating skeleton directory!") - exit(1) - createDirs(INSTALL_TARGET) if os.system("echo $?") != 0: errorAndLog("Error while creating directory paths!") exit(1) +create_ogboot_project(INSTALL_TARGET) +if os.system("echo $?") != 0: + errorAndLog("Error while creating skeleton directory!") + exit(1) + # Configuración de TFTP. tftpConfigure() @@ -674,4 +673,4 @@ elif args.dhcp == 'configure': pass elif args.dhcp == 'none': print("DHCP no será instalado ni configurado") - pass \ No newline at end of file + pass