refs #437 Changes ipxe template example in the create template endpoint and changes checksum file
parent
232d35ae0c
commit
6b47c4be93
|
@ -447,7 +447,7 @@ function uninstall() {
|
|||
[ ! -w $TFTPDIR ] && { echo "{\"error\": \"access installation directory.\"}"; exit 1; }
|
||||
|
||||
# Buscar el directorio correspondiente al checksum
|
||||
DIR=$(find $TFTPDIR -type f -name 'linuxISO.sum' -exec grep -l "$CHECKSUM" {} \; | xargs -I{} dirname {})
|
||||
DIR=$(find $TFTPDIR -type f -name 'ogclient.sqfs.sum' -exec grep -l "$CHECKSUM" {} \; | xargs -I{} dirname {})
|
||||
|
||||
# Si no se encuentra el directorio, devolver error
|
||||
if [ -z "$DIR" ]; then
|
||||
|
@ -525,7 +525,7 @@ function set_default() {
|
|||
[ ! -w $TFTPDIR ] && { echo "{\"error\": \"access installation directory.\"}"; exit 1; }
|
||||
|
||||
# Buscar el directorio correspondiente al checksum
|
||||
DIR=$(find $TFTPDIR -type f -name 'linuxISO.sum' -exec grep -l "$CHECKSUM" {} \; | xargs -I{} dirname {} | grep -v ".old")
|
||||
DIR=$(find $TFTPDIR -type f -name 'ogclient.sqfs.sum' -exec grep -l "$CHECKSUM" {} \; | xargs -I{} dirname {} | grep -v ".old")
|
||||
|
||||
# Si no se encuentra el directorio, devolver error
|
||||
if [ -z "$DIR" ]; then
|
||||
|
@ -600,7 +600,7 @@ function list_installed_oglives() {
|
|||
local OGLIVEARCH=""
|
||||
local OGLIVEREV=""
|
||||
local CHECKSUM=""
|
||||
local CHECKSUM_FILE="$TFTPDIR/$i/linuxISO.sum"
|
||||
local CHECKSUM_FILE="$TFTPDIR/$i/ogclient.sqfs.sum"
|
||||
|
||||
if [ -f "$CHECKSUM_FILE" ]; then
|
||||
CHECKSUM=$(cat "$CHECKSUM_FILE" | cut -d ' ' -f 1)
|
||||
|
@ -651,7 +651,7 @@ function get_info() {
|
|||
[ ! -w $TFTPDIR ] && { echo "{\"error\": \"access installation directory.\"}"; exit 1; }
|
||||
|
||||
# Buscar el directorio correspondiente al checksum, excluyendo los que terminan en .old.
|
||||
DIR=$(find $TFTPDIR -type f -name 'linuxISO.sum' -exec grep -l "$CHECKSUM" {} \; | grep -v '.old' | xargs -I{} dirname {})
|
||||
DIR=$(find $TFTPDIR -type f -name 'ogclient.sqfs.sum' -exec grep -l "$CHECKSUM" {} \; | grep -v '.old' | xargs -I{} dirname {})
|
||||
|
||||
# Si no se encuentra el directorio, devolver error.
|
||||
if [ -z "$DIR" ]; then
|
||||
|
|
|
@ -179,7 +179,7 @@ public function getDownloadMenu(): Response
|
|||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="string",
|
||||
* description="Unique identifier for the ogLive client, generated from linuxISO.sum",
|
||||
* description="Unique identifier for the ogLive client, generated from ogclient.sqfs.sum",
|
||||
* example="9e49a085ba74f97a81bdf9b3d0785094"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
|
@ -250,8 +250,8 @@ public function getOglives(): Response
|
|||
$directory = $entry;
|
||||
$ogLivePath = $directoryPath . $entry;
|
||||
|
||||
// Obtener el ID del archivo linuxISO.sum
|
||||
$sumFile = $ogLivePath . '/linuxISO.sum';
|
||||
// Obtener el ID del archivo ogclient.sqfs.sum
|
||||
$sumFile = $ogLivePath . '/ogclient.sqfs.sum';
|
||||
$id = '';
|
||||
if (file_exists($sumFile)) {
|
||||
$id = trim(file_get_contents($sumFile));
|
||||
|
@ -443,8 +443,8 @@ public function getOglive(string $checksum): Response
|
|||
|
||||
|
||||
/**
|
||||
* @Route("/ogboot/v1/oglives/default", name="setOgliveDefault", methods={"POST"})
|
||||
* @OA\Post(
|
||||
* @Route("/ogboot/v1/oglives/default", name="setOgliveDefault", methods={"PUT"})
|
||||
* @OA\Put(
|
||||
* path="/ogboot/v1/oglives/default",
|
||||
* summary="Set default ogLive client",
|
||||
* @OA\RequestBody(
|
||||
|
@ -1081,7 +1081,7 @@ public function getBootFile(string $mac): Response
|
|||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="name_template", type="string", example="pxe"),
|
||||
* @OA\Property(property="content_template", type="string", example="#!ipxe\nset timeout 0\nset timeout-style hidden\n\nset ISODIR ogLive\nset default 0\nset kernelargs INFOHOST\nkernel tftp://SERVERIP/ogLive/ogvmlinuz ${kernelargs}\ninitrd tftp://SERVERIP/ogLive/oginitrd.img\nboot")
|
||||
* @OA\Property(property="content_template", type="string", example="#!ipxe\nset timeout 0\nset timeout-style hidden\n\nset ISODIR __OGLIVE__\nset default 0\nset kernelargs __INFOHOST__\n# Menú de entrada para seleccionar OgLive\n:try_iso\nkernel tftp://__SERVERIP__/${ISODIR}/ogvmlinuz ${kernelargs} || goto fallback\ninitrd tftp://__SERVERIP__/${ISODIR}/oginitrd.img\nboot\n\n:fallback\necho \"OgLive default\"\nset ISODIR ogLive\nkernel tftp://__SERVERIP__/${ISODIR}/ogvmlinuz ${kernelargs}\ninitrd tftp://__SERVERIP__/${ISODIR}/oginitrd.img\nboot")
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
|
@ -1090,7 +1090,7 @@ public function getBootFile(string $mac): Response
|
|||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="message", type="string", example="Plantilla creada exitosamente."),
|
||||
* @OA\Property(property="template", type="string", example="#!ipxe\nset timeout 0\nset timeout-style hidden\n\nset ISODIR ogLive\nset default 0\nset kernelargs INFOHOST\nkernel tftp://SERVERIP/ogLive/ogvmlinuz ${kernelargs}\ninitrd tftp://SERVERIP/ogLive/oginitrd.img\nboot")
|
||||
* @OA\Property(property="template", type="string", example="#!ipxe\nset timeout 0\nset timeout-style hidden\n\nset ISODIR __OGLIVE__\nset default 0\nset kernelargs __INFOHOST__\n# Menú de entrada para seleccionar OgLive\n:try_iso\nkernel tftp://__SERVERIP__/${ISODIR}/ogvmlinuz ${kernelargs} || goto fallback\ninitrd tftp://__SERVERIP__/${ISODIR}/oginitrd.img\nboot\n\n:fallback\necho \"OgLive default\"\nset ISODIR ogLive\nkernel tftp://__SERVERIP__/${ISODIR}/ogvmlinuz ${kernelargs}\ninitrd tftp://__SERVERIP__/${ISODIR}/oginitrd.img\nboot")
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
|
@ -1123,7 +1123,7 @@ public function getBootFile(string $mac): Response
|
|||
try {
|
||||
file_put_contents($filePath, $contentTemplate);
|
||||
} catch (\Exception $e) {
|
||||
return new Response('Ocurrió un error al crear la plantilla de arranque.', 500);
|
||||
return new Response('Ocurrió un error al crear la plantilla de arranque. ' . $e->getMessage(), 500);
|
||||
}
|
||||
|
||||
return new Response(json_encode([
|
||||
|
|
Loading…
Reference in New Issue