diff options
Diffstat (limited to 'client/shared/etc/preinit')
-rwxr-xr-x | client/shared/etc/preinit/default.sh | 2 | ||||
-rwxr-xr-x | client/shared/etc/preinit/loadenviron.sh | 9 | ||||
-rwxr-xr-x | client/shared/etc/preinit/mountrepo.sh | 9 | ||||
-rwxr-xr-x | client/shared/etc/preinit/poweroff.sh | 35 |
4 files changed, 51 insertions, 4 deletions
diff --git a/client/shared/etc/preinit/default.sh b/client/shared/etc/preinit/default.sh index 539c12fe..addab9aa 100755 --- a/client/shared/etc/preinit/default.sh +++ b/client/shared/etc/preinit/default.sh @@ -5,7 +5,7 @@ set -a source /opt/opengnsys/etc/preinit/loadenviron.sh # Scripts de inicio. -for f in fileslinks loadmodules mountrepo; do +for f in fileslinks loadmodules mountrepo poweroff; do $OGETC/preinit/$f.sh done diff --git a/client/shared/etc/preinit/loadenviron.sh b/client/shared/etc/preinit/loadenviron.sh index af891534..c23fcc80 100755 --- a/client/shared/etc/preinit/loadenviron.sh +++ b/client/shared/etc/preinit/loadenviron.sh @@ -23,7 +23,8 @@ if [ -d $OPENGNSYS ]; then export OGCAC=$OPENGNSYS/cache export OGLOG=$OPENGNSYS/log - export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/opt/og2fs/2ndfs/opt/drbl/sbin + export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/opt/oglive/rootfs/opt/drbl/sbin + export PATH=$OGSCRIPTS:$PATH:$OGAPI:$OGBIN # Exportar parámetros del kernel. @@ -64,9 +65,15 @@ if [ -d $OPENGNSYS ]; then # Fichero de registros. export OGLOGFILE="$OGLOG/$(ogGetIpAddress).log" + # Configuracion de la red (valido offline) + cat /tmp/initrd.cfg | grep DEVICECFG && export $(cat /tmp/initrd.cfg | grep DEVICECFG) + source $DEVICECFG 2>/dev/null + # FIXME Pruebas para grupos de ordenadores #export OGGROUP=$(ogGetGroup) export OGGROUP="$group" + + ROOTREPO=${ROOTREPO:-"$OGSERVERIMAGES"} fi # Declaración de códigos de error. diff --git a/client/shared/etc/preinit/mountrepo.sh b/client/shared/etc/preinit/mountrepo.sh index aa0b9886..5c20499a 100755 --- a/client/shared/etc/preinit/mountrepo.sh +++ b/client/shared/etc/preinit/mountrepo.sh @@ -9,6 +9,7 @@ #*/ OGIMG=${OGIMG:-/opt/opengnsys/images} +ROOTREPO=${ROOTREPO:-"$ROOTSERVER"} # TODO Revisar proceso de arranque para no montar 2 veces el repositorio. if [ $ogactiveadmin == "true" ]; then @@ -18,8 +19,12 @@ if [ $ogactiveadmin == "true" ]; then protocol=${potocol:-"smb"} printf "$MSG_MOUNTREPO\n" "$protocol" "$boot" case "$protocol" in - nfs) mount.nfs ${ROOTSERVER}:$OGIMG $OGIMG -o rw,nolock ;; - smb) mount.cifs //${ROOTSERVER}/ogimages $OGIMG -o rw,serverino,acl,username=opengnsys,password=og ;; + nfs) mount.nfs ${ROOTREPO}:$OGIMG $OGIMG -o rw,nolock ;; + smb) PASS=$(grep "^[ ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 | \ + sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/') + PASS=${PASS:-"og"} + mount.cifs //${ROOTREPO}/ogimages $OGIMG -o rw,serverino,acl,username=opengnsys,password=$PASS + ;; esac fi diff --git a/client/shared/etc/preinit/poweroff.sh b/client/shared/etc/preinit/poweroff.sh new file mode 100755 index 00000000..9e7d700d --- /dev/null +++ b/client/shared/etc/preinit/poweroff.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#/** +#@file poweroff.sh +#@brief Script de inicio para cargar el proceso comprobación de clientes inactivos. +#@note Arranca y configura el proceso "cron". +#@warning License: GNU GPLv3+ +#@version 1.0.2 +#@author Ramon Gomez, ETSII Universidad de Sevilla +#@date 2011-10-25 +#*/ + + +# Si está configurado OpenGnSys ... +if [ -n "$OPENGNSYS" ]; then + #echo "$MSG_POWEROFFCONF" + + # Crear fichero de configuración por defecto (30 min. de espera). + POWEROFFCONF=/etc/poweroff.conf + cat << FIN > $POWEROFFCONF +POWEROFFSLEEP=30 +POWEROFFTIME= +FIN + + # Lanzar el proceso "cron". + cron -l + + # Definir la "crontab" lanzando el proceso de comprobación cada minuto. + echo "* * * * * [ -x $OGBIN/poweroffconf ] && $OGBIN/poweroffconf" | crontab - + +else + # FIXME Error: entorno de OpenGnSys no configurado. + echo "Error: OpenGnSys environment is not configured." # FIXME: definir mensaje. + exit 1 +fi + |