summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2017-06-02 07:40:35 +0000
committerramon <ramongomez@us.es>2017-06-02 07:40:35 +0000
commitccda415f8b9492b440f6a77d54a09983c549b629 (patch)
tree7b83766756d134eea9da48bc006e1b60ab1fdccf
parentc311ef2f23332a9aff1a6f8a2ecd8ebd20be2190 (diff)
#768: Incluir directorio de ogLive al generar fichero PXE.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5333 a21b9725-9963-47de-94b9-378ad31fedc9
-rw-r--r--admin/WebConsole/includes/tftputils.php7
-rwxr-xr-xserver/bin/setclientmode5
2 files changed, 9 insertions, 3 deletions
diff --git a/admin/WebConsole/includes/tftputils.php b/admin/WebConsole/includes/tftputils.php
index f216f4e0..568854b6 100644
--- a/admin/WebConsole/includes/tftputils.php
+++ b/admin/WebConsole/includes/tftputils.php
@@ -75,6 +75,7 @@ function createBootMode ($cmd, $bootopt, $hostid, $lang) {
// Obtener información de la base de datos.
$cmd->texto="SELECT ordenadores.nombreordenador AS hostname, ordenadores.ip AS ip,
ordenadores.mac AS mac, ordenadores.netiface AS netiface,
+ ordenadores.oglivedir AS oglivedir,
aulas.netmask AS netmask, aulas.router AS router,
aulas.ntp AS ntp, aulas.dns AS dns, aulas.proxy AS proxy,
aulas.nombreaula AS grupo, repositorios.ip AS iprepo,
@@ -108,6 +109,7 @@ function createBootMode ($cmd, $bootopt, $hostid, $lang) {
$server=$rs->campos["ipserveradm"];
$vga=$rs->campos["vga"];
$winboot=$rs->campos["winboot"];
+ $oglivedir=$rs->campos["oglivedir"];
$ogunit=$rs->campos["ogunit"];
if ($ogunit == 0 or $rs->campos["directorio"] == null) {
$directorio="" ;
@@ -137,7 +139,8 @@ function createBootMode ($cmd, $bootopt, $hostid, $lang) {
" ogrepo=$repo" .
" oglive=$server" .
" oglog=$server" .
- " ogshare=$server";
+ " ogshare=$server" .
+ " oglivedir=$oglivedir";
// Añadir parámetros opcionales.
if (! empty ($ntp)) { $infohost.=" ogntp=$ntp"; }
if (! empty ($dns)) { $infohost.=" ogdns=$dns"; }
@@ -165,7 +168,7 @@ function createBootMode ($cmd, $bootopt, $hostid, $lang) {
exec ("sed -e 's|vga=...||g' -e 's|INFOHOST|$infohost|g' $pxedir/templates/$bootopt > $macfile");
}
else{
- exec ("sed -e 's|INFOHOST|$infohost|g' $pxedir/templates/$bootopt > $macfile");
+ exec ("sed -e 's|INFOHOST|$infohost|g' -e 's|set ISODIR=.*|set ISODIR=$oglivedir|g' $pxedir/templates/$bootopt > $macfile");
}
exec ("chmod 777 $macfile");
}
diff --git a/server/bin/setclientmode b/server/bin/setclientmode
index 241ca07d..c6125705 100755
--- a/server/bin/setclientmode
+++ b/server/bin/setclientmode
@@ -101,6 +101,7 @@ for MAC in $ETHERNET; do
' oglive=', @repoip,
' oglog=', (SELECT (@serverip:=ipserveradm) FROM entornos LIMIT 1),
' ogshare=', @serverip,
+ ' oglivedir=', ordenadores.oglivedir,
' winboot=', IFNULL (perfileshard.winboot, 'reboot'),
IF (aulas.ntp='', '', CONCAT (' ogntp=', aulas.ntp)),
IF (aulas.dns='', '', CONCAT (' ogdns=', aulas.dns)),
@@ -123,8 +124,10 @@ for MAC in $ETHERNET; do
# Quitar tabuladores, sustituir acentos y dejar resolución por defecto.
DATOS=$(echo ${DATOS// /} | tr 'áéíóúñÁÉÍÓÚÑ' 'aeiounAEIOUN')
[[ "$DATOS" =~ (vga|video) ]] || DATOS="$DATOS vga=788"
+ # Obtener directorio ogLive a partir de los datos.
+ OGLIVEDIR=$(echo "$DATOS" | awk -F= 'BEGIN {RS=" "} $1=="oglivedir" {print $2}')
# Crear fichero PXE a partir de la plantilla con los datos obtenidos en la BD.
- sed -e "s,vga=[0-9]*,,g; s,INFOHOST,${DATOS//,/\\,},g" $TEMPLATE >$PXEFILE
+ sed -e "s,vga=[0-9]*,,g; s,INFOHOST,${DATOS//,/\\,},g; s,set ISODIR=.*,set ISODIR=$OGLIVEDIR,g" $TEMPLATE >$PXEFILE
# Ponemos como propietario al usuario y grupo de Apache para que se pueda cambiar desde la consola web.
PERMS=$(ps axho user,group,comm|awk '!/root/ && /httpd|apache/ {u=$1; g=$2} END {if (g) printf "%s:%s",u,g}')
[ -n "$PERMS" ] && chown $PERMS $PXEFILE