source: client/boot-tools/ogClientGeneratorV2.sh @ 1452cbd

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 1452cbd was 88b75ac, checked in by adv <adv@…>, 14 years ago

version1.0 #368 - Adaptando el antiguo ogclient a boot-tools

git-svn-id: https://opengnsys.es/svn/branches/version1.0@1854 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
42echoAndLog "OpenGnSys CLIENT installation begins at $(date)"
43##########################################################################
44## FASE 1 -  Instalación de software adicional.
45##TO DO Integrar en el instaldor. Actualizar repositorios
46# Datos para la generación del cliente.
47DEPENDENCIES=( debootstrap subversion schroot squashfs-tools)
48apt-get update
49# Instalación de dependencias (paquetes de sistema operativo).
50declare -a notinstalled
51checkDependencies DEPENDENCIES notinstalled
52if [ $? -ne 0 ]; then
53        installDependencies notinstalled
54        if [ $? -ne 0 ]; then
55                echoAndLog "Error while installing some dependeces, please verify your server installation before continue"
56                exit 1
57        fi
58fi
59############## FIN DEL TO DO
60############################################## FIN FASE 1
61
62
63
64
65
66echoAndLog "OpenGnSys CLIENT installation begins at $(date)"
67
68############## FASE 2   - Asignación de variables
69#obtenemos las variables necesarias.
70ogClientVar
71#obtenemos la información del host.
72ogClientOsInfo
73######################## FIN fase 2
74
75############# FASE 3: Segundo Sistema archivos (img) Creación.
76#TODO comprobacion de que el fichero esta creado.
77file $OGCLIENTFILE | grep "partition 1: ID=0x83"
78if [ $? == 1 ]
79then
80        ##3.1 creación y formateo del disco virtual. generamos el dispositivo loop.
81        ogClient2ndFile || exit 1
82fi
83
84
85#3.2 generamos el Sistema de archivos con debootstrap
86# Comprobamos que ya tenemos alguno.
87schroot -p -c IMGogclient -- touch /tmp/ogclientOK
88if [ -f /tmp/ogclientOK ]
89then
90        rm /tmp/ogclientOK
91else
92        ogClient2ndFs $TYPECLIENT || exit
93fi
94
95
96############### FASE 4: Configuración el acceso al Segundo Sistema de archivos (img), para schroot
97cat /etc/schroot/schroot.conf | grep ogclient || ogClientSchrootConf
98
99
100############### FASE 5: Configuración del Segundo Sistema de archivos (img) con la estructura especial de OpenGnsys
101ogClient2ndSVN $TYPECLIENT || exit
102
103
104
105
106############# FASE6: Ejecutamos los scripts de personalización del 2º sistema de archivos (img) desde la jaula schroot
107### 6.1 instalacion de software con apt-get
108schroot -p -c IMGogclient -- /root/InstallSoftware.sh
109echo "saltando"
110 if [ $? -ne 0 ]; then
111        errorAndLog "Instalando sofware adicional OG : ERROR"
112        exit
113else
114        echoAndLog "Instalando sofware adicional OG: OK"
115fi
116#### 6.2 compilación de software.
117cd /
118schroot -p -c IMGogclient -- /root/CompileSoftware.sh
119cd -
120
121### 6.3 configuracion hostname passroot securety
122cd /
123schroot -c IMGogclient -- /root/ConfFS.sh
124cd -
125#schroot -c IMGogclient -- echo -ne "og1\nog1\n" | passwd root
126# schroot -c IMGogclient -- passwd root | echo "root"
127
128
129### 6.4 incorporamos la clave publica del servidor
130cd /
131ssh-keygen -q -f /root/.ssh/id_rsa -N ""
132cp /root/.ssh/id_rsa.pub /tmp
133schroot -p -c IMGogclient -- /root/importSshKeys.sh
134cd -
135############ y la del propio cliente.
136schroot -c IMGogclient -- /root/generateSshKeysClient.sh
137
138## configuramos los locales.
139schroot -c IMGogclient -- /root/ReconfigureLocales.sh
140
141
142################## FIN fase 6.   Fin de comfiguración del segundo sistema de archivos (img)
143
144################## FASE 7.  Generamos el 1er sistema de archivos. INITRD
145#nota el parametro es el "tipo" de linux generado en debootstrap. usar solo "host", es decir version,kernel ... del propio host
146#nota: hace un schroot, al 2fs (img), ejecuta el fichero generateinitrd.
147#nota: deja en el directorio tmp del host el nuevo initrd, y lo copia al tftpboot
148ogClientInitrd $TYPECLIENT
149
150
151################## FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
152# generamos el 2sistema de archivos en squashfs
153ogClient2ndSqfs
154################## FIN FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
155
156
157##################### FASE 9. algunos detallas del pxe
158#dejamos ficheros de ejemplo para el pxe y el nfs
159#ogClientConfpxe
160##################### FIN FASE 9. algunos detallas del pxe
161
162
163# Mostrar sumario de la instalación e instrucciones de post-instalación.
164installationSummary
165
166echoAndLog "OpenGnSys installation finished at $(date)"
Note: See TracBrowser for help on using the repository browser.