source: client/engine/PostConf.lib @ 6277770

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 6277770 was 181c4de, checked in by ramon <ramongomez@…>, 13 years ago

#501: Cliente para sistemas Windows.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2982 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 4.6 KB
Line 
1#!/bin/bash
2#/**
3#@file    PostConf.lib
4#@brief   Librería o clase PostConf
5#@class   PostConf
6#@brief   Funciones para la postconfiguración de sistemas operativos.
7#@version 1.0.4
8#@warning License: GNU GPLv3+
9#*/
10
11
12#/**
13#         ogInstallLinuxClient int_ndisk int_filesys
14#@brief   Instala el cliente OpenGnSys para sistemas operativos Linux.
15#@param   int_ndisk    nº de orden del disco
16#@param   int_filesys  nº de orden del sistema de archivos
17#@return  (nada)
18#@exception OG_ERR_FORMAT    Formato incorrecto.
19#@exception OG_ERR_NOTFOUND  Fichero o dispositivo no encontrado.
20#@exception OG_ERR_PARTITION Paritición o sistema de archivos incorrectos.
21#@exception OG_ERR_LOCKED    Sistema de archivos bloqueado.
22#@version 1.0.4 - Primera adaptación para OpenGnSys.
23#@author  Ramon Gomez, ETSII Universidad de Sevilla
24#@date    2012-04-10
25#*/
26function ogInstallLinuxClient ()
27{
28# Variables locales.
29local PART MNTDIR CLIENTFILE i SBINDIR ETCDIR RCLOCAL
30# Si se solicita, mostrar ayuda.
31if [ "$*" == "help" ]; then
32    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_filesys" \
33           "$FUNCNAME 1 1"
34    return
35fi
36
37# Error si no se reciben 2 parámetros.
38[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
39# Obtener sistema de archvios.
40PART="$(ogDiskToDev $1 $2)" || return $?
41# Comprobar si el sistema de archivos no está bloqueado.
42MNTDIR=$(ogMount $1 $2) 2>/dev/null
43[ -n "$MNTDIR" ] || ogRaiseError OG_ERR_PARTITION "$1, $2" || return $?
44# Comprobar si existe el cliente y los directorios y ficheros destino.
45CLIENTFILE=$OGLIB/ogclient/ogAdmLnxClient
46[ -f $CLIENTFILE ] || ogRaiseError $OG_ERR_FOUND "$CLIENTFILE" || return $?
47for i in /sbin /usr/sbin /usr/local/sbin; do
48    [ -d $MNTDIR/$i ] && SBINDIR=$i
49done
50[ -n "$SBINDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$1 $2 sbin" || return $?
51for i in /etc /usr/local/etc; do
52    [ -d $MNTDIR/$i ] && ETCDIR=$i
53done
54[ -n "$ETCDIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$1 $2 etc" || return $?
55for i in $ETCDIR/rc.local $ETCDIR/rc.d/rc.local; do
56    [ -f $i ] && RCLOCAL=$i
57done
58[ -n "$RCLOCAL" ] || ogRaiseError $OG_ERR_NOTFOUND "$1 $2 rc.local" || return $?
59# Realizar la instalación en modo uso exclusivo.
60ogLock $1 $2
61# Copiar cliente, generar fichero de configuración e incluir en el arranque.
62cp -a $CLIENTFILE $MNTDIR/$SBINDIR
63cat > $MNTDIR/$ETCDIR/ogAdmLnxClient.cfg << EOT
64ServidorAdm=$(ogGetServerIp)
65PUERTO=2008
66IPLOCAL=$(ogGetIpAddress)
67EOT
68cp -a $MNTDIR/$RCLOCAL /tmp/rclocal
69awk -v sbin=$SBINDIR -v etc=$ETCDIR \
70        '{ if (/^#/) { print; }
71           else {
72                if (loc==0) {
73                    printf "%s/ogAdmLnxClient -f %s/ogAdmLnxClient.cfg &\n",sbin,etc;
74                    loc=1; }
75                print; }
76        }' /tmp/rclocal > $MNTDIR/$RCLOCAL
77rm /tmp/rclocal
78ogUnlock $1 $2
79}
80
81
82#/**
83#         ogInstallWindowsClient int_ndisk int_filesys
84#@brief   Instala el cliente OpenGnSys para sistemas operativos Windows.
85#@param   int_ndisk    nº de orden del disco
86#@param   int_filesys  nº de orden del sistema de archivos
87#@return  (nada)
88#@exception OG_ERR_FORMAT    Formato incorrecto.
89#@exception OG_ERR_NOTFOUND  Fichero o dispositivo no encontrado.
90#@exception OG_ERR_PARTITION Paritición o sistema de archivos incorrectos.
91#@exception OG_ERR_LOCKED    Sistema de archivos bloqueado.
92#@version 1.0.4 - Primera adaptación para OpenGnSys.
93#@author  Ramon Gomez, ETSII Universidad de Sevilla
94#@date    2012-04-11
95#*/
96function ogInstallWindowsClient ()
97{
98# Variables locales.
99local PART MNTDIR CLIENTFILE i SBINDIR ETCDIR RCLOCAL
100# Si se solicita, mostrar ayuda.
101if [ "$*" == "help" ]; then
102    ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_filesys" \
103    return
104fi
105
106# Error si no se reciben 2 parámetros.
107[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
108# Obtener sistema de archvios.
109PART="$(ogDiskToDev $1 $2)" || return $?
110# Comprobar si el sistema de archivos no está bloqueado.
111MNTDIR=$(ogMount $1 $2) 2>/dev/null
112[ -n "$MNTDIR" ] || ogRaiseError OG_ERR_PARTITION "$1, $2" || return $?
113# Comprobar si existe el cliente y los directorios y ficheros destino.
114CLIENTFILE=$OGLIB/ogclient/ogAdmWinClient.exe
115[ -f $CLIENTFILE ] || ogRaiseError $OG_ERR_FOUND "$CLIENTFILE" || return $?
116for i in winnt windows; do
117    DIR=$(ogGetPath $MNTDIR/$i)
118    [ -n "$DIR" ] && WINDIR=$DIR
119done
120[ -n "$WINDIR " ] || ogRaiseError $OG_ERR_NOTFOUND "$1 $2 windows" || return $?
121# Realizar la instalación en modo uso exclusivo.
122ogLock $1 $2
123# Copiar cliente, generar fichero de configuración e incluir en el arranque.
124cp -a $CLIENTFILE "$WINDIR"
125ogInstallMiniSetup $MNTDIR ogclient.cmd
126ogAddCmd $MNTDIR ogclient.cmd "ogAdmWinClient -install -s $(ogGetServerIp) -p 2008 -i $(ogGetIpAddress)"
127ogUnlock $1 $2
128}
129
Note: See TracBrowser for help on using the repository browser.