refs #1133 #1134 #1137 adds oglive default to conf, adds new templates to the installer, adds default template to sustitute ip ogboot

ogboot-log
Luis Gerardo Romero Garcia 2024-11-13 08:25:34 +01:00
parent ce06044bf1
commit 4f222c2692
3 changed files with 112 additions and 7 deletions

View File

@ -0,0 +1,103 @@
#!ipxe
# Detectar si se está ejecutando en modo UEFI o BIOS
iseq ${platform} efi && goto uefi_menu || goto bios_mbr
:bios_mbr
echo "Running in BIOS mode - Booting MBR"
chain tftp://__SERVERIP__/grub.exe --config-file="title MBR;chainloader (hd0)+1;rootnoverify (hd0);boot" || echo "Failed to boot MBR in BIOS mode"
exit
:uefi_menu
echo "Running in UEFI mode - Searching boot loaders"
set detected no
# Buscar y configurar opciones de arranque
echo "Searching Grub"
sanboot --no-describe --drive 0 --filename \EFI\grub\Boot\grubx64.efi && goto add_grub
:add_grub
set detected yes
echo "Grub found"
goto boot_grub
:boot_grub
echo "Booting Grub"
sanboot --no-describe --drive 0 --filename \EFI\grub\Boot\grubx64.efi || echo "Failed to boot Grub"
exit
:refind
echo "Searching rEFInd"
sanboot --no-describe --drive 0 --filename \EFI\refind\shimx64.efi.signed && goto add_refind
:add_refind
set detected yes
echo "rEFInd found"
goto boot_refind
:boot_refind
echo "Booting rEFInd"
sanboot --no-describe --drive 0 --filename \EFI\refind\shimx64.efi.signed || echo "Failed to boot rEFInd"
exit
:part_01_02
echo "Searching Part-01-02"
sanboot --no-describe --drive 0 --filename \EFI\Part-01-02\Boot\ogloader.efi && goto add_part_01_02
:add_part_01_02
set detected yes
echo "Part-01-02 found"
goto boot_part_01_02
:boot_part_01_02
echo "Booting Part-01-02"
sanboot --no-describe --drive 0 --filename \EFI\Part-01-02\Boot\ogloader.efi || echo "Failed to boot Part-01-02"
exit
:part_01_03
echo "Searching Part-01-03"
sanboot --no-describe --drive 0 --filename \EFI\Part-01-03\Boot\ogloader.efi && goto add_part_01_03
:add_part_01_03
set detected yes
echo "Part-01-03 found"
goto boot_part_01_03
:boot_part_01_03
echo "Booting Part-01-03"
sanboot --no-describe --drive 0 --filename \EFI\Part-01-03\Boot\ogloader.efi || echo "Failed to boot Part-01-03"
exit
:microsoft
echo "Searching Microsoft"
sanboot --no-describe --drive 0 --filename \EFI\Microsoft\Boot\bootmgfw.efi && goto add_microsoft
:add_microsoft
set detected yes
echo "Microsoft Boot Manager found"
goto boot_microsoft
:boot_microsoft
echo "Booting Microsoft Boot Manager"
sanboot --no-describe --drive 0 --filename \EFI\Microsoft\Boot\bootmgfw.efi || echo "Failed to boot Microsoft Boot Manager"
exit
:ubuntu
echo "Searching Ubuntu"
sanboot --no-describe --drive 0 --filename \EFI\ubuntu\grubx64.efi && goto add_ubuntu
:add_ubuntu
set detected yes
echo "Ubuntu found"
goto boot_ubuntu
:boot_ubuntu
echo "Booting Ubuntu"
sanboot --no-describe --drive 0 --filename \EFI\ubuntu\grubx64.efi || echo "Failed to boot Ubuntu"
exit
:no_os_detected
iseq ${detected} no && echo "OpenGnsys no ha detectado ningún sistema operativo en este equipo"
exit

View File

@ -2,6 +2,7 @@
"ogCore_ServerIP": "172.17.8.82",
"ogBoot_ServerIP": "172.17.8.37",
"ogBoot_Dir": "/opt/opengnsys/ogboot",
"ogLive_Default": "https://ognproject.evlt.uma.es/oglive//ogLive-noble-6.8.0-31-generic-amd64-r20241024.8100be23_20241112.iso",
"ogBootSambaUser": "opengnsys",
"ogBootSambaPass": "og"
}

View File

@ -10,7 +10,7 @@ import platform, os, sys, subprocess, datetime, shutil, pwd, glob, logging, dist
import tempfile
ipxe_repo_url = "https://github.com/ipxe/ipxe.git"
oglive_iso_url = "https://ognproject.evlt.uma.es/trac/downloads/ogLive-focal-5.13.0-27-beta-amd64-r20210706.5b4bf5f.iso"
SAMBACFGDIR = "/etc/samba"
TFTPCFGDIR = "/var/lib/tftpboot"
@ -25,6 +25,7 @@ with open(config_file, 'r') as f:
OGCORE_IP = config["ogCore_ServerIP"]
OGBOOT_IP = config['ogBoot_ServerIP']
oglive_iso_url = config["ogLive_Default"]
INSTALL_OGBOOT_TARGET = config["ogBoot_Dir"]
OPENGNSYS_CLIENT_USER = config["ogBootSambaUser"]
OPENGNSYS_CLIENT_PASSWD = config["ogBootSambaPass"]
@ -110,9 +111,9 @@ def get_missing_packages():
case "18.04":
PACKAGES_TO_INSTALL = ["nano", "wget", "tree"]
case "22.04":
PACKAGES_TO_INSTALL = ["nfs-common", "xorriso", "genisoimage", "syslinux", "liblzma-dev", "nginx", "arp-scan", "automake", "build-essential", "btrfs-progs", "composer", "curl", "ctorrent", "debootstrap", "g++-multilib", "gawk", "gettext", "graphviz", "grub-efi-amd64-signed", "jq", "libdbi-dev", "libdbi1", "libev-dev", "libjansson-dev", "liblz4-tool", "libssl-dev", "moreutils", "netpipes", "php", "php-bcmath", "php-cli", "php-curl", "php-fpm", "php-gd", "php-json", "php-ldap", "php-mbstring", "php-mysql", "php8.1-common", "php-pear", "php-xml", "php-zip", "procps", "coreutils", "rsync", "samba", "samba-common-bin", "schroot", "shim-signed", "squashfs-tools", "subversion", "tftpd-hpa", "udpcast", "unzip", "wakeonlan", "wget", "xinetd", "jq", "moreutils", "net-tools", "isolinux", "syslinux"]
PACKAGES_TO_INSTALL = ["nfs-common", "xorriso", "genisoimage", "syslinux", "liblzma-dev", "nginx", "arp-scan", "automake", "build-essential", "btrfs-progs", "composer", "curl", "ctorrent", "debootstrap", "g++-multilib", "gawk", "gettext", "graphviz", "grub-efi-amd64-signed", "jq", "libdbi-dev", "libdbi1t64", "libev-dev", "libjansson-dev", "liblz4-tool", "libssl-dev", "moreutils", "netpipes", "php", "php-bcmath", "php-cli", "php-curl", "php-fpm", "php-gd", "php-json", "php-ldap", "php-mbstring", "php-mysql", "php8.1-common", "php-pear", "php-xml", "php-zip", "procps", "coreutils", "rsync", "samba", "samba-common-bin", "schroot", "shim-signed", "squashfs-tools", "subversion", "tftpd-hpa", "udpcast", "unzip", "wakeonlan", "wget", "xinetd", "jq", "moreutils", "net-tools", "isolinux", "syslinux"]
case "24.04":
PACKAGES_TO_INSTALL = ["nfs-common", "xorriso", "genisoimage", "syslinux", "liblzma-dev", "nginx", "arp-scan", "automake", "build-essential", "btrfs-progs", "composer", "curl", "ctorrent", "debootstrap", "g++-multilib", "gawk", "gettext", "graphviz", "grub-efi-amd64-signed", "jq", "libdbi-dev", "libdbi1", "libev-dev", "libjansson-dev", "liblz4-tool", "libssl-dev", "moreutils", "netpipes", "php8.3", "php8.3-bcmath", "php8.3-cli", "php8.3-curl", "php8.3-fpm", "php8.3-gd", "php8.3-ldap", "php8.3-mbstring", "php8.3-mysql", "php8.3-common", "php-pear", "php8.3-xml", "php8.3-zip", "procps", "coreutils", "rsync", "samba", "samba-common-bin", "schroot", "shim-signed", "squashfs-tools", "subversion", "tftpd-hpa", "udpcast", "unzip", "wakeonlan", "wget", "xinetd", "jq", "moreutils", "isolinux", "syslinux", "file"]
PACKAGES_TO_INSTALL = ["nfs-common", "xorriso", "genisoimage", "syslinux", "liblzma-dev", "nginx", "arp-scan", "automake", "build-essential", "btrfs-progs", "composer", "curl", "ctorrent", "debootstrap", "g++-multilib", "gawk", "gettext", "graphviz", "grub-efi-amd64-signed", "jq", "libdbi-dev", "libdbi1t64", "libev-dev", "libjansson-dev", "liblz4-tool", "libssl-dev", "moreutils", "netpipes", "php8.3", "php8.3-bcmath", "php8.3-cli", "php8.3-curl", "php8.3-fpm", "php8.3-gd", "php8.3-ldap", "php8.3-mbstring", "php8.3-mysql", "php8.3-common", "php-pear", "php8.3-xml", "php8.3-zip", "procps", "coreutils", "rsync", "samba", "samba-common-bin", "schroot", "shim-signed", "squashfs-tools", "subversion", "tftpd-hpa", "udpcast", "unzip", "wakeonlan", "wget", "xinetd", "jq", "moreutils", "isolinux", "syslinux", "file"]
case _:
PACKAGES_TO_INSTALL = ["bash", "rsync"]
#case "suse":
@ -543,12 +544,12 @@ def install_ipxe():
return False
subprocess.call(["cp", "bin-x86_64-efi/ipxe.efi", f"{INSTALL_OGBOOT_TARGET}/tftpboot"])
subprocess.call(["chown", "-R", "tftp:ogboot", f"{INSTALL_OGBOOT_TARGET}/tftpboot/"])
subprocess.call(["cp", f"{REPO_DIR}/tftpboot/grub.exe", f"{INSTALL_OGBOOT_TARGET}/tftpboot/"])
subprocess.run(["chmod", "-R", "775", f"{INSTALL_OGBOOT_TARGET}/tftpboot/"])
os.makedirs(f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates", exist_ok=True)
subprocess.call(["chown", "-R", "tftp:ogboot", f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates"])
subprocess.call(["chmod", "-R", "775", f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates"])
subprocess.call(["cp", f"{REPO_DIR}/tftpboot/ipxe_scripts/templates/pxe_default", f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates"])
subprocess.call(["cp", "-r", f"{REPO_DIR}/tftpboot/ipxe_scripts/templates/.", f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates"])
os.chdir(cwd)
return True
@ -575,7 +576,7 @@ def generate_ipxe_script():
with open(ipxe_output, "w") as ipxe_file:
ipxe_file.write(ipxe_content)
template_default = os.path.join(REPO_DIR, "tftpboot/ipxe_scripts/default.ipxe")
template_default = os.path.join(REPO_DIR, "etc/default.ipxe.tmpl")
default_output = os.path.join(INSTALL_OGBOOT_TARGET, "tftpboot/ipxe_scripts/default.ipxe")
with open(template_default, "r") as default_tmpl_file:
default_template_content = default_tmpl_file.read()
@ -744,7 +745,7 @@ def modify_php_fpm_config():
# Reiniciar el servicio PHP-FPM
subprocess.run(["systemctl", "restart", f"php{php_version}-fpm"], check=True)
logger.info("Servicio PHP-FPM reiniciado correctamente.")
subprocess.run(["systemctl", "restart", "nginx.service"])
# Verificar que el socket se ha creado
if os.path.exists(socket_path):
logger.info(f"Socket {socket_path} creado correctamente.")