source: client/boot-tools/ogClientGeneratorV2.sh @ 3c0cdb0

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 3c0cdb0 was e0edc14, checked in by ramon <ramongomez@…>, 14 years ago

OpenGnSys 1.0 como versión princial del trunk (modificado #362).

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

  • Property mode set to 100755
File size: 4.7 KB
RevLine 
[58828de]1#!/bin/bash
2#@file    ogClientGenerator.sh
3#@brief   Script generación del cliente OpenGnSys
4#@warning
5#@version 0.9 -
6#@author  Antonio J. Doblas Viso.
7#@date    2010/05/24
8#*/
9
10
11#$1 OSCONENAME  lucid karmic
12#if [ $# -ne 1 ]; then
13#               echo ": invalid number of parameters"
14#               echo " host | lucid | karmic | jaunty | lenny | squeeze "
15#               exit 1
16#fi
17TYPECLIENT=host
18
19# Solo ejecutable por usuario root
20if [ "$(whoami)" != 'root' ]
21then
22        echo "ERROR: this program must run under root privileges!!"
23        exit 1
24fi
25
26
27
28#FIXME: variables del instalador oficial.
29WORKDIR=/tmp/opengnsys_installer
30INSTALL_TARGET=/opt/opengnsys
31LOG_FILE=/tmp/opengnsys_installation.log
32PROGRAMDIR=$(readlink -e $(dirname "$0"))
33
34
35#funciones especificas del cliente.
36source $PROGRAMDIR/ogClientManager.lib
37#funciones incluidas dentro del scritps general de instalacion.
38source $PROGRAMDIR/ogInstaller.lib
39
40echoAndLog "OpenGnSys CLIENT installation begins at $(date)"
41
42##########################################################################
43## FASE 1 -  Instalación de software adicional.
44##TO DO Integrar en el instaldor. Actualizar repositorios
45# Datos para la generación del cliente.
46DEPENDENCIES=( debootstrap subversion schroot squashfs-tools)
47apt-get update
48# Instalación de dependencias (paquetes de sistema operativo).
49declare -a notinstalled
50checkDependencies DEPENDENCIES notinstalled
51if [ $? -ne 0 ]; then
52        installDependencies notinstalled
53        if [ $? -ne 0 ]; then
54                echoAndLog "Error while installing some dependeces, please verify your server installation before continue"
55                exit 1
56        fi
57fi
58############## FIN DEL TO DO
59############################################## FIN FASE 1
60
61
62
63############## FASE 2   - Asignación de variables
64#obtenemos las variables necesarias.
65ogClientVar
66#obtenemos la información del host.
67ogClientOsInfo
68######################## FIN fase 2
69
70############# FASE 3: Segundo Sistema archivos (img) Creación.
71#TODO comprobacion de que el fichero esta creado.
72file $OGCLIENTFILE | grep "partition 1: ID=0x83"
73if [ $? == 1 ]
74then
75        ##3.1 creación y formateo del disco virtual. generamos el dispositivo loop.
76        ogClient2ndFile || exit 1
77fi
78
79
80#3.2 generamos el Sistema de archivos con debootstrap
81# Comprobamos que ya tenemos alguno.
82schroot -p -c IMGogclient -- touch /tmp/ogclientOK
83if [ -f /tmp/ogclientOK ]
84then
85        rm /tmp/ogclientOK
86else
87        ogClient2ndFs $TYPECLIENT || exit
88fi
89
90
91############### FASE 4: Configuración el acceso al Segundo Sistema de archivos (img), para schroot
92cat /etc/schroot/schroot.conf | grep ogclient || ogClientSchrootConf
93
94
95############### FASE 5: Configuración del Segundo Sistema de archivos (img) con la estructura especial de OpenGnsys
96ogClient2ndSVN $TYPECLIENT || exit
97
98
99
100
101############# FASE6: Ejecutamos los scripts de personalización del 2º sistema de archivos (img) desde la jaula schroot
102### 6.1 instalacion de software con apt-get
103schroot -p -c IMGogclient -- /root/InstallSoftware.sh
104echo "saltando"
105 if [ $? -ne 0 ]; then
106        errorAndLog "Instalando sofware adicional OG : ERROR"
107        exit
108else
109        echoAndLog "Instalando sofware adicional OG: OK"
110fi
111#### 6.2 compilación de software.
112cd /
113schroot -p -c IMGogclient -- /root/CompileSoftware.sh
114cd -
115
116### 6.3 configuracion hostname passroot securety
117cd /
118schroot -c IMGogclient -- /root/ConfFS.sh
119cd -
120#schroot -c IMGogclient -- echo -ne "og1\nog1\n" | passwd root
121# schroot -c IMGogclient -- passwd root | echo "root"
122
123
124### 6.4 incorporamos la clave publica del servidor
125cd /
126ssh-keygen -q -f /root/.ssh/id_rsa -N ""
127cp /root/.ssh/id_rsa.pub /tmp
128schroot -p -c IMGogclient -- /root/importSshKeys.sh
129cd -
130############ y la del propio cliente.
131schroot -c IMGogclient -- /root/generateSshKeysClient.sh
132
133## configuramos los locales.
134schroot -c IMGogclient -- /root/ReconfigureLocales.sh
135
136
137################## FIN fase 6.   Fin de comfiguración del segundo sistema de archivos (img)
138
139################## FASE 7.  Generamos el 1er sistema de archivos. INITRD
140#nota el parametro es el "tipo" de linux generado en debootstrap. usar solo "host", es decir version,kernel ... del propio host
141#nota: hace un schroot, al 2fs (img), ejecuta el fichero generateinitrd.
142#nota: deja en el directorio tmp del host el nuevo initrd, y lo copia al tftpboot
143ogClientInitrd $TYPECLIENT
144
145
146################## FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
147# generamos el 2sistema de archivos en squashfs
148ogClient2ndSqfs
149################## FIN FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
150
151
152##################### FASE 9. algunos detallas del pxe
153#dejamos ficheros de ejemplo para el pxe y el nfs
[88b75ac]154#ogClientConfpxe
[58828de]155##################### FIN FASE 9. algunos detallas del pxe
156
157
158# Mostrar sumario de la instalación e instrucciones de post-instalación.
159installationSummary
160
[e0edc14]161echoAndLog "OpenGnSys installation finished at $(date)"
Note: See TracBrowser for help on using the repository browser.