source: client/boot-tools/old/ogClientGeneratorV2.sh @ 26a1226

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 26a1226 was 26aeb3c, checked in by adv <adv@…>, 14 years ago

branch version 1.0 #420 separando proceso de creacion anterior

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

  • Property mode set to 100755
File size: 4.8 KB
Line 
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
96#ogClient2ndSVN $TYPECLIENT || exit
97cp ${SVNCLIENTDIR}/clientstructure/root/* /tmp/
98chmod 777 /tmp/*.sh
99schroot -p -c IMGogclient -- /tmp/importSVNboot-tools.sh
100
101
102
103
104############# FASE6: Ejecutamos los scripts de personalización del 2º sistema de archivos (img) desde la jaula schroot
105### 6.1 instalacion de software con apt-get
106schroot -p -c IMGogclient -- /root/InstallSoftware.sh
107echo "saltando"
108 if [ $? -ne 0 ]; then
109        errorAndLog "Instalando sofware adicional OG : ERROR"
110        exit
111else
112        echoAndLog "Instalando sofware adicional OG: OK"
113fi
114#### 6.2 compilación de software.
115cd /
116schroot -p -c IMGogclient -- /root/CompileSoftware.sh
117cd -
118
119### 6.3 configuracion hostname passroot securety
120cd /
121schroot -c IMGogclient -- /root/ConfFS.sh
122cd -
123#schroot -c IMGogclient -- echo -ne "og1\nog1\n" | passwd root
124# schroot -c IMGogclient -- passwd root | echo "root"
125
126
127### 6.4 incorporamos la clave publica del servidor
128cd /
129ssh-keygen -q -f /root/.ssh/id_rsa -N ""
130cp /root/.ssh/id_rsa.pub /tmp
131schroot -p -c IMGogclient -- /root/importSshKeys.sh
132cd -
133############ y la del propio cliente.
134schroot -c IMGogclient -- /root/generateSshKeysClient.sh
135
136## configuramos los locales.
137schroot -c IMGogclient -- /root/ReconfigureLocales.sh
138
139
140################## FIN fase 6.   Fin de comfiguración del segundo sistema de archivos (img)
141
142################## FASE 7.  Generamos el 1er sistema de archivos. INITRD
143#nota el parametro es el "tipo" de linux generado en debootstrap. usar solo "host", es decir version,kernel ... del propio host
144#nota: hace un schroot, al 2fs (img), ejecuta el fichero generateinitrd.
145#nota: deja en el directorio tmp del host el nuevo initrd, y lo copia al tftpboot
146ogClientInitrd $TYPECLIENT
147
148
149################## FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
150# generamos el 2sistema de archivos en squashfs
151ogClient2ndSqfs
152################## FIN FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
153
154
155##################### FASE 9. algunos detallas del pxe
156#dejamos ficheros de ejemplo para el pxe y el nfs
157#ogClientConfpxe
158##################### FIN FASE 9. algunos detallas del pxe
159
160
161# Mostrar sumario de la instalación e instrucciones de post-instalación.
162installationSummary
163
164echoAndLog "OpenGnSys installation finished at $(date)"
Note: See TracBrowser for help on using the repository browser.