source: ogLive-Builder-Git/boottoolsgenerator.sh @ 4cb1a5b

browserbuild-browserdeps-vadimfilebeat-installerimprove-versionlgromero-testsmainno-apt-moduleoglive-ipv6pull-from-cloning-enginepybuilderqndtest
Last change on this file since 4cb1a5b was aad89c0, checked in by ramon <ramongomez@…>, 8 years ago

#724 #768: Cambios en generación de cliente ogLive:

  • Script boottoolsgenerator.sh soporta parámetro para generar ogLive basado en distribuciones soportadas.
  • Soporta variable del kernel oglivedir con subdirectorio de instalación de ogLive.
  • Dejar de compilar paquetes incluidos en distribuciones Ubuntu.
  • Procesar ficheros JSON en scripts BASH.

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

  • Property mode set to 100755
File size: 4.9 KB
RevLine 
[2cffa56]1#!/bin/bash
2#@file    boottoolsgenerator.sh
[42b1b74]3#@brief   Script generación del sistema opertativo cliente OpenGnsys
[2cffa56]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
[b3d380b]13 #mkdir -p /tmp/opengnsys_installer/opengnsys
[42b1b74]14 #svn export http://opengnsys.es/svn/branches/version1.1/client /tmp/opengnsys_installer/opengnsys
[ad828d4]15
[2cffa56]16
17#Variables
[aad89c0]18TYPECLIENT="${1:-host}"
[2cffa56]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
[8428ee5]30# Cambiar a directorio temporal.
31cd /tmp
32
[e0efe8a]33for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
34for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
35for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
36
37
[2cffa56]38#funciones especificas del cliente.
39source $PROGRAMDIR/boottoolsfunctions.lib
40
[c4105e1]41####################################################################3
42echo "FASE 1 - Asignación de variables"
43#obtenemos las variables necesarias y la información del host.
44btogGetVar
[42b1b74]45echoAndLog "OpenGnsys CLIENT installation begins at $(date)"
[944b467]46btogGetOsInfo $TYPECLIENT
[2cffa56]47##########################################################################
[c4105e1]48echo "FASE 2 - Instalación de software adicional."
[f060c58]49grep "http://free.nchc.org.tw/drbl-core" /etc/apt/sources.list || echo "deb http://free.nchc.org.tw/drbl-core drbl stable" >> /etc/apt/sources.list
50apt-get update
51[ -n "$(apt-cache search gpxe)" ] && PXEPKG="gpxe"
52[ -n "$(apt-cache search ipxe)" ] && PXEPKG="ipxe"
53apt-get -y --force-yes install debootstrap subversion schroot squashfs-tools syslinux genisoimage $PXEPKG qemu lsof
[8ebae0e]54###################################################################3
[c4105e1]55echo "FASE 3 - Creación del Sistema raiz RootFS (Segundo Sistema archivos (img)) "
56echo "Fase 3.1 Generar y formatear el disco virtual. Generar el dispositivo loop."
[2cffa56]57file $BTROOTFSIMG | grep "partition 1: ID=0x83"
58if [ $? == 1 ]
59then
60        btogSetFsVirtual || exit 2
61fi
[c4105e1]62echo "Fase 3.2 Generar sistema de archivos con debootstrap"
[2cffa56]63schroot -p -c IMGogclient -- touch /tmp/ogclientOK
64if [ -f /tmp/ogclientOK ]
65then
66        rm /tmp/ogclientOK
67else
68        btogSetFsBase || exit 3
69fi
[8ebae0e]70###################################################################3
[c4105e1]71echo "FASE 4 - Configurar acceso schroot al Segundo Sistema de archivos (img)"
[2cffa56]72cat /etc/schroot/schroot.conf | grep $BTROOTFSIMG || btogSetFsAccess
[8ebae0e]73###########################################################################
[42b1b74]74echo "FASE 5 - Incorporando ficheros OpenGnsys al sistema raíz rootfs "
[dfbf4fa]75cp -a ${BTSVNBOOTTOOLS}/includes/usr/bin/* /tmp
76chmod +x /tmp/boot-tools/*.sh
[42b1b74]77# Incluir revisión.
78sed -i "1 s/$/ $VERSIONSVN/" ${BTSVNBOOTTOOLS}/includes/etc/initramfs-tools/scripts/VERSION.txt
[b3d380b]79# En Ubuntu 13.04+ es necesario matar proceso de "udev" antes de desmontar.
80umount $BTROOTFSMNT 2>/dev/null || (kill -9 $(lsof -t $BTROOTFSMNT); umount $BTROOTFSMNT 2>/dev/null)
[ad828d4]81schroot -p -c IMGogclient -- /tmp/boot-tools/boottoolsFsOpengnsys.sh
[8ebae0e]82############################################################################################
[c4105e1]83echo "FASE 6 - Instalar software"
[8ebae0e]84echo "Fase 6.1 instalar paquetes deb con apt-get"
[0714cda]85schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareInstall.sh
[8ebae0e]86echo "Fase 6.2 compilar software."
[2cffa56]87cd /
[0714cda]88schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareCompile.sh
[2cffa56]89cd -
90
[c4105e1]91echo "FASE 7 - Personalizar el sistema creado"
92echo "Fase 7.1 Incorporar la clave publica del servidor"
[2cffa56]93cd /
94ssh-keygen -q -f /root/.ssh/id_rsa -N ""
95cp /root/.ssh/id_rsa.pub /tmp
[0714cda]96schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshServer.sh
[2cffa56]97cd -
[c4105e1]98echo "Fase 7.2. Incorpoar la clave publica del propio  cliente"
[8ebae0e]99schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshClient.sh
100
[c4105e1]101echo "Fase 7.3. Configurando las locales"
[8ebae0e]102schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsFsLocales.sh
[2cffa56]103
104
[e0efe8a]105for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
106for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
107for i in `mount | grep IMGogclient | grep /var | cut -f3 -d" "`; do echo $i; umount $i; done
108
[8ebae0e]109#########################################################################
[c4105e1]110echo "FASE 8 - Generar distribucion"
111echo "Fase 8.1 Generar el initrd"
[2cffa56]112btogFsInitrd
[c4105e1]113echo "Fase 8.2 Generar fichero sqfs a partir del fichero img"
[0714cda]114btogFsSqfs
[944b467]115umount $BTROOTFSMNT 2>/dev/null
[c4105e1]116echo "Fase 8.3 Generar la ISO"
[0714cda]117btogIsoGenerator
[8ebae0e]118######################################################################3
119########################################################################
[42b1b74]120echoAndLog "OpenGnsys installation finished at $(date)"
[e0efe8a]121
Note: See TracBrowser for help on using the repository browser.