source: client/boot-tools/boottoolsgenerator.sh @ ee4beb4

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 ee4beb4 was d5c3ce2, checked in by ramon <ramongomez@…>, 11 years ago

#603: en el proceso de generación del ogLive en servidores con Ubuntu 13.04 y posterior, udev mantiene en uso el direcotrio donde se ha ejecutado debootstrap y es necesario matar el proceso antes de desmontar el directorio para poder usar schroot.

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

  • Property mode set to 100755
File size: 4.7 KB
RevLine 
[00a2c2c]1#!/bin/bash
2#@file    boottoolsgenerator.sh
3#@brief   Script generación del sistema opertativo cliente OpenGnSys
4#@warning
5#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
6#@author  Antonio J. Doblas Viso. Universidad de Malaga.
7#@date    2010/05/24
8#@version 1.0 - Compatibilidad OpengGnsys X.
9#@author  Antonio J. Doblas Viso. Universidad de Malaga.
10#@date    2011/08/03
11#*/
12
[d5c3ce2]13 #mkdir -p /tmp/opengnsys_installer/opengnsys
14 #svn export http://opengnsys.es/svn/branches/version1.0/client /tmp/opengnsys_installer/opengnsys
[841ce50]15
[00a2c2c]16
17#Variables
[77c1f6f]18TYPECLIENT="host"
[00a2c2c]19WORKDIR=/tmp/opengnsys_installer
20INSTALL_TARGET=/opt/opengnsys
21PROGRAMDIR=$(readlink -e $(dirname "$0"))
22
23# Solo ejecutable por usuario root
24if [ "$(whoami)" != 'root' ]
25then
26        echo "ERROR: this program must run under root privileges!!"
27        exit 1
28fi
29
[82ae131]30for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
31for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
32for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
33
34
[00a2c2c]35#funciones especificas del cliente.
36source $PROGRAMDIR/boottoolsfunctions.lib
37
[0d178ab]38####################################################################3
39echo "FASE 1 - Asignación de variables"
40#obtenemos las variables necesarias y la información del host.
41btogGetVar
[00a2c2c]42echoAndLog "OpenGnSys CLIENT installation begins at $(date)"
[77c1f6f]43btogGetOsInfo $TYPECLIENT
[00a2c2c]44##########################################################################
[0d178ab]45echo "FASE 2 - Instalación de software adicional."
[27ee376]46cat /etc/apt/sources.list | grep "http://free.nchc.org.tw/drbl-core" || echo "deb http://free.nchc.org.tw/drbl-core drbl stable " >> /etc/apt/sources.list
[d5c3ce2]47apt-get update; apt-get -y --force-yes install debootstrap subversion schroot squashfs-tools syslinux genisoimage gpxe qemu lsof
[ed7e34d]48###################################################################3
[0d178ab]49echo "FASE 3 - Creación del Sistema raiz RootFS (Segundo Sistema archivos (img)) "
50echo "Fase 3.1 Generar y formatear el disco virtual. Generar el dispositivo loop."
[00a2c2c]51file $BTROOTFSIMG | grep "partition 1: ID=0x83"
52if [ $? == 1 ]
53then
54        btogSetFsVirtual || exit 2
55fi
[0d178ab]56echo "Fase 3.2 Generar sistema de archivos con debootstrap"
[00a2c2c]57schroot -p -c IMGogclient -- touch /tmp/ogclientOK
58if [ -f /tmp/ogclientOK ]
59then
60        rm /tmp/ogclientOK
61else
62        btogSetFsBase || exit 3
63fi
[ed7e34d]64###################################################################3
[0d178ab]65echo "FASE 4 - Configurar acceso schroot al Segundo Sistema de archivos (img)"
[00a2c2c]66cat /etc/schroot/schroot.conf | grep $BTROOTFSIMG || btogSetFsAccess
[ed7e34d]67###########################################################################
[0d178ab]68echo "FASE 5 - Incorporando ficheros OpenGnSys el sistema raiz rootfs "
[a1d0fb2]69cp -a ${BTSVNBOOTTOOLS}/includes/usr/bin/* /tmp
70chmod +x /tmp/boot-tools/*.sh
[d5c3ce2]71# En Ubuntu 13.04+ es necesario matar proceso de "udev" antes de desmontar.
72umount $BTROOTFSMNT 2>/dev/null || (kill -9 $(lsof -t $BTROOTFSMNT); umount $BTROOTFSMNT 2>/dev/null)
[841ce50]73schroot -p -c IMGogclient -- /tmp/boot-tools/boottoolsFsOpengnsys.sh
[ed7e34d]74############################################################################################
[0d178ab]75echo "FASE 6 - Instalar software"
[ed7e34d]76echo "Fase 6.1 instalar paquetes deb con apt-get"
[27ee376]77schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareInstall.sh
[ed7e34d]78echo "Fase 6.2 compilar software."
[00a2c2c]79cd /
[27ee376]80schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareCompile.sh
[00a2c2c]81cd -
82
[0d178ab]83echo "FASE 7 - Personalizar el sistema creado"
84echo "Fase 7.1 Incorporar la clave publica del servidor"
[00a2c2c]85cd /
86ssh-keygen -q -f /root/.ssh/id_rsa -N ""
87cp /root/.ssh/id_rsa.pub /tmp
[27ee376]88schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshServer.sh
[00a2c2c]89cd -
[0d178ab]90echo "Fase 7.2. Incorpoar la clave publica del propio  cliente"
[ed7e34d]91schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshClient.sh
92
[0d178ab]93echo "Fase 7.3. Configurando las locales"
[ed7e34d]94schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsFsLocales.sh
[00a2c2c]95
96
[82ae131]97for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
98for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
99for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
100
[ed7e34d]101#########################################################################
[0d178ab]102echo "FASE 8 - Generar distribucion"
103echo "Fase 8.1 Generar el initrd"
[00a2c2c]104btogFsInitrd
[0d178ab]105echo "Fase 8.2 Generar fichero sqfs a partir del fichero img"
[27ee376]106btogFsSqfs
[77c1f6f]107umount $BTROOTFSMNT 2>/dev/null
[0d178ab]108echo "Fase 8.3 Generar la ISO"
[27ee376]109btogIsoGenerator
[ed7e34d]110######################################################################3
111########################################################################
[00a2c2c]112echoAndLog "OpenGnSys installation finished at $(date)"
[82ae131]113
Note: See TracBrowser for help on using the repository browser.