diff options
Diffstat (limited to 'server')
-rwxr-xr-x | server/bin/setclientmode | 17 | ||||
-rw-r--r-- | server/etc/dhcpd.conf.tmpl | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/server/bin/setclientmode b/server/bin/setclientmode index 0cc57002..a934783e 100755 --- a/server/bin/setclientmode +++ b/server/bin/setclientmode @@ -11,7 +11,8 @@ PROG=$(basename $0) OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} SERVERCONF=$OPENGNSYS/etc/ogAdmServer.cfg -PXEDIR=$OPENGNSYS/tftpboot/pxelinux.cfg +PXEDIR=$OPENGNSYS/tftpboot/menu.lst +TEMPLATE="$PXEDIR/templates/$1" LOGFILE=$OPENGNSYS/log/opengnsys.log # Control básico de errores. @@ -24,8 +25,8 @@ if [ ! -r $SERVERCONF ]; then echo "$PROG: Sin acceso a fichero de configuración" exit 2 fi -if [ ! -e $PXEDIR/"$1" ]; then - echo "No existe archivo platilla: $PXEDIR/$1" +if [ ! -e $TEMPLATE ]; then + echo "No existe archivo platilla: $TEMPLATE" exit fi @@ -49,18 +50,18 @@ if [ -z "$ETHERNET" ]; then exit 1 fi -# Creamos los enlaces -# PXE no permite enlaces simbolicos y las letras han de ir en minuscula +# Copiar fichero de configuración y actualizar base de datos. date +"%b %d %T $PROG: Configurando \"$1\" en \"$2\"" | tee -a $LOGFILE NPC=0 for AUX in $ETHERNET; do date +"%b %d %T $PROG: Detectada ethernet \"$AUX\" en \"$2\"" | tee -a $LOGFILE - AUX=$(echo $AUX | awk '{print tolower($0)}') AUX="01-${AUX:0:2}-${AUX:2:2}-${AUX:4:2}-${AUX:6:2}-${AUX:8:2}-${AUX:10:2}" # Si existe anteriormente lo borra [ -e $PXEDIR/$AUX ] && rm $PXEDIR/$AUX - if [ "$1" != "default" ]; then - ln $PXEDIR/"$1" $PXEDIR/$AUX + if [ "$1" != "default" ]; thenm + cp -a $TEMPLATE $PXEDIR/$AUX + mysql -u "$USUARIO" -p"$PASSWORD" -D "$CATALOG" -N -e \ + "UPDATE ordenadores SET arranque=\"$1\" WHERE mac=\"$ETHERNET\";" fi let NPC=NPC+1 done diff --git a/server/etc/dhcpd.conf.tmpl b/server/etc/dhcpd.conf.tmpl index 687bbf0f..fb6afa00 100644 --- a/server/etc/dhcpd.conf.tmpl +++ b/server/etc/dhcpd.conf.tmpl @@ -10,7 +10,7 @@ subnet NETIP netmask NETMASK { default-lease-time 600; max-lease-time 7200; next-server SERVERIP; - filename "pxelinux.0"; + filename "grldr"; use-host-decl-names on; # host HOSTNAME1 { |