diff options
Diffstat (limited to 'client/shared/etc')
-rwxr-xr-x | client/shared/etc/init/default.sh | 35 | ||||
-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 |
5 files changed, 82 insertions, 8 deletions
diff --git a/client/shared/etc/init/default.sh b/client/shared/etc/init/default.sh index 79385796..d1fea1c9 100755 --- a/client/shared/etc/init/default.sh +++ b/client/shared/etc/init/default.sh @@ -1,11 +1,21 @@ #!/bin/bash # TODO Separar esta sección en otro script + + # Lanzar servicios complementarios del cliente. -echo -ne "og\nog\n" | passwd root -#Compatibilidad ssh con el boot-tools 1.0.2 +PASS=$(grep "^[ ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 | \ + sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/') +PASS=${PASS:-"og"} +echo -ne "$PASS\n$PASS\n" | passwd root 2>/dev/null + +# Inicio del servidor sshd /usr/sbin/sshd + +# Desactivado apagado de monitor #setterm -blank 0 -powersave off -powerdown 0 < /dev/console > /dev/console 2>&1 + +# Activado WOL en la interfaz usada en arranque pxe ethtool -s $DEVICE wol g 2>/dev/null # Fichero de registro de incidencias (en el servidor; si no, en local). @@ -16,12 +26,29 @@ if ! touch $OGLOGFILE 2>/dev/null; then fi LOGLEVEL=5 -#facilitando el entorno Og desde ssh +#Facilitando el entorno Og desde ssh cp $OPENGNSYS/etc/preinit/loadenviron.sh /etc/profile.d/ + + + +########## PRUEBAS # Crear menú por defecto para el cliente generateMenuDefault -# Arranque de OpenGnSys Client. +# Matando plymount para inicir browser o shell +pkill -9 plymouthd + +[ -f /opt/opengnsys/scripts/runhttplog.sh ] && /opt/opengnsys/scripts/runhttplog.sh + +########## FIN PRUEBAS + +# Arranque de OpenGnSys Client daemon (web services). +if [ -x $OPENGNSYS/job_executer/init.d/job_executer ]; then + echo "Running Opengnsys client daemon (web services)" + $OPENGNSYS/job_executer/init.d/job_executer restart +fi + +# Arranque de OpenGnSys Client daemon (socket). if [ -x "$OPENGNSYS/bin/ogAdmClient" ]; then echo "$MSG_LAUNCHCLIENT" [ $ogactiveadmin == "true" ] && boot=admin 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 + |