summaryrefslogtreecommitdiffstats
path: root/client/boot-tools/ogClientManager.lib
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2011-12-22 13:38:11 +0000
committerramon <ramongomez@us.es>2011-12-22 13:38:11 +0000
commitc3c7cb3ae6f6600223111a572050f34f2df6fa71 (patch)
tree96fce1db6bf64fee2845d3a48abcbe07d9937562 /client/boot-tools/ogClientManager.lib
parent4caea352de0d0a19d4e0a2e2dd04980dd28e6be0 (diff)
Congelar versión 1.0.2 en tags/opengnsys-1.0.2 (modifica #446).opengnsys-1.0.2
git-svn-id: https://opengnsys.es/svn/tags/opengnsys-1.0.2@2405 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/boot-tools/ogClientManager.lib')
-rw-r--r--client/boot-tools/ogClientManager.lib725
1 files changed, 0 insertions, 725 deletions
diff --git a/client/boot-tools/ogClientManager.lib b/client/boot-tools/ogClientManager.lib
deleted file mode 100644
index 9f56ec4a..00000000
--- a/client/boot-tools/ogClientManager.lib
+++ /dev/null
@@ -1,725 +0,0 @@
-
-ogClientVar()
-{
-export SVNCLIENTDIR=/tmp/opengnsys_installer/opengnsys/client/boot-tools
-export SVNCLIENTSTRUCTURE=/tmp/opengnsys_installer/opengnsys/client/shared
-export SVNCLIENTENGINE=/tmp/opengnsys_installer/opengnsys/client/engine
-
-export OGCLIENTBASEDIR=/var/lib/tftpboot/ogclient/
-export OGCLIENTFILE=${OGCLIENTBASEDIR}ogclient.img
-export OGCLIENTMOUNT=${OGCLIENTBASEDIR}ogclientmount
-# tamaño maximo limitado por schroot 2GB
-export OGCLIENTSIZEMB=1900
-#export OGCLIENTSIZEMB=1000
-# export OGCLIENTSIZEKB=500
-export OGCLIENTLABEL=ogClient
-#export OGLIB=/opt/opengnsys/client/lib
-}
-
-
-
-function ogClientOsInfo ()
-{
-#TODO según host, un OSHHTP u otro OSARCH
- #1 OSCODENAME jaunty|karmic|lucid
- #devuelve OSDISTRIB(ubuntu,debian),OSCODENAME(lucid,karmic,squeeze):OGRELEASE:httpAPT
- case $1 in
- host | HOST)
- export OSDISTRIB=$(lsb_release -i | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
- #OSCODENAME=$(lsb_release -c | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
- export OSCODENAME=$(cat /etc/lsb-release | grep CODENAME | awk -F= '{print $NF}')
- export OSRELEASE=$(uname -a | awk '{print $3}')
- uname -a | grep x86_64 > /dev/null && export OSARCH=amd64 || export OSARCH=i386
- export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
- ;;
- jaunty|JAUNTY)
- export OSDISTRIB=ubuntu
- export OSCODENAME=jaunty
- export OSRELEASE="2.6.28-11-generic"
- export OSARCH=i386
- export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
- ;;
- lenny|LENNY)
- export OSDISTRIB=debian
- export OSCODENAME=lenny
- export OSRELEASE="2.6.28-11-generic"
- export OSARCH=i386
- export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
- ;;
- squeeze|SQUEEZE)
- export OSDISTRIB=debian
- export OSCODENAME=squeeze
- export OSRELEASE="2.6.28-11-generic"
- export OSARCH=i386
- export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
- ;;
- karmic|KARMIC)
- export OSDISTRIB=ubuntu
- export OSCODENAME=karmic
- export OSRELEASE="2.6.31-14-generic"
- export OSARCH=i386
- export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
- ;;
- lucid|LUCID)
- export OSDISTRIB=ubuntu
- export OSCODENAME=lucid
- export OSRELEASE="2.6.32-21-generic-pae"
- export OSARCH=i386
- export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
- ;;
- *)
- return 1
- ;;
- esac
- echo $OSDISTRIB:$OSCODENAME:$OSRELEASE:$OSARCH:$OSHTTP
-}
-
-#creación y formateo del disco virtual.
-ogClient2ndFile ()
-{
-local RERROR DISKLOOP PARTLOOP #return code error
-echoAndLog "$FUNCNAME(): Creación y formateo del disco virtual $OGCLIENTSIZEMB MB "
-#Desmontamos por si acaso el dispositivo virtual
-mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
-mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
-echo "$FUNCNAME(): Creando el directorio donde se montará el disco virtual $OGCLIENTMOUNT"
-mkdir -p $OGCLIENTMOUNT
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Creando directorio $OGCLIENTMOUNT : ERROR"
- return 1
-fi
-echo "$FUNCNAME(): Creando el disco virtual que almacenará el FS del cliente $OGCLIENTSIZEMB MB de datos físicos"
-dd if=/dev/zero of=$OGCLIENTFILE bs=1048576 count=$OGCLIENTSIZEMB
-#qemu-img create $OGCLIENTFILE 3G
-#dd if=/dev/zero of=$OGCLIENTFILE bs=1k count=$OGCLIENTSIZEKB # necesita 500MB
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Creando el disco virtual: ERROR"
- return 1
-fi
-
-DISKLOOP=$(losetup -f)
-losetup $DISKLOOP $OGCLIENTFILE
-echo "$FUNCNAME(): particiondo el disco virtual - $DISKLOOP - con una particion primaria"
-echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk $DISKLOOP
-#echo $?
-# da error, porque no puede actualizar el kernel.
-#if [ $? -ne 0 ]
-#then
-# errorAndLog "$FUNCNAME(): Particionando el disco virutal: ERROR"
-# return 1
-#fi
-
-echoAndLog "$FUNCNAME(): Desmontando $DISKLOOP despues del particionado "
-losetup -d $DISKLOOP
-
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Liberando disco virtual despues del particionado: ERROR"
- return 1
-fi
-
-
-#mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
-#mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
-PARTLOOP=$(losetup -f)
-echo "$FUNCNAME(): Formateando la particion principal $PARTLOOP"
-losetup -o 32256 $PARTLOOP $OGCLIENTFILE && mkfs.ext3 -b 4096 -L $OGCLIENTLABEL $PARTLOOP
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Formateando la particion principal del disco virtual: ERROR"
- return 1
-fi
-echoAndLog "$FUNCNAME(): Desmontando $PARTLOOP despues del formateo "
-losetup -d $PARTLOOP
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Liberando la particion virtual despues del formateo: ERROR"
- return 1
-else
- echoAndLog "$FUNCNAME(): $OGCLIENTFILE $OGCLIENTSIZEMB MB : OK"
-fi
-}
-
-
-
-
-
-ogClient2ndFs ()
-{
-ogClientOsInfo $1
-echoAndLog "$FUNCNAME: Iniciando la generación del sistema de archivos "
-#Montamos el dispositivo virtual en su punto de montaje.
-mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
-
-mount | grep $OGCLIENTMOUNT && echoAndLog "$FUNCNAME: mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256 OK " || errorAndLog "$FUNCNAME: mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256 : FAILURE "
-
-#debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe ${OSCODENAME} ${OGCLIENTMOUNT} ${OSHTTP}
-debootstrap --arch=$OSARCH --components=main,universe ${OSCODENAME} ${OGCLIENTMOUNT} ${OSHTTP}
-
-
-if [ $? -ne 0 ]; then
- errorAndLog "$FUNCNAME: debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe $OSCODENAME $OGCLIENTMOUNT $OSHTTP
- : ha fallado!"
- mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
- return 1
-else
- echoAndLog "$FUNCNAME: debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe $OSCODENAME $OGCLIENTMOUNT $OSHTTP
- : ok"
- mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
- return 0
-fi
- sleep 5
-
-##preubas revisar OSRELEASE
-#debootstrap --include=linux-image-${OSRELEASE} --arch=i386 --variant=minbase $OSVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
-#debootstrap --variant=minbase --include=linux-image-${OGRELEASE} --arch=i386 $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
-#echo debootstrap --include=linux-image-${OGRELEASE},dbus --arch=i386 --components=main,universe $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
-}
-
-
-
-
-########## configura el segundo sistema de archivos
-########### parametro: "host"
-function ogClient2ndSVN()
-{
-ogClientOsInfo $1
-#1 la salida de ogClientOsInfo
-local LERROR
-LERROR=TRUE
-echoAndLog "$FUNCNAME: Iniciando la personalización con datos del SVN "
-# comprobar que está montado $OGCLIENTMOUNT
-mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
-
-# parseamos del apt.source
-sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list.ubuntu > ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Parsing apt.sources : ERROR"
- return 1
-fi
-
-#parseamos el script de generación del initrd.
-sed -e "s/OSRELEASE/$OSRELEASE/g" ${SVNCLIENTDIR}/clientstructure/root/GenerateInitrd.generic.sh > ${SVNCLIENTDIR}/clientstructure/root/GenerateInitrd.sh
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Parsing GenerateInitrd.sh : ERROR"
- return 1
-fi
-
-#damos permiso al directorio de scripts
-chmod 775 ${SVNCLIENTDIR}/clientstructure/root/*
-
-# los copiamos
-cp -prv ${SVNCLIENTDIR}/clientstructure/* $OGCLIENTMOUNT
-mkdir -p ${OGCLIENTMOUNT}/opt/opengnsys/
-cp -prv ${SVNCLIENTSTRUCTURE}/* ${OGCLIENTMOUNT}/opt/opengnsys/
-cp -prv ${SVNCLIENTENGINE}/* ${OGCLIENTMOUNT}/opt/opengnsys/lib/engine/bin/
-
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Copying client data : ERROR"
- return 1
-fi
-
-# copiamos algunas cosas del nfsexport
-
-#### Tipos de letra para el Browser.
-cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/lib/fonts
-#### Crear enlaces para compatibilidad con las distintas versiones del Browser.
-mkdir -p $OGCLIENTMOUNT/usr/local/Trolltech/QtEmbedded-4.5.1/lib/
-mkdir -p $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.2/lib/
-mkdir -p $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.3/lib/
-#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/Trolltech/QtEmbedded-4.5.1/lib/fonts
-#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/QtEmbedded-4.6.2/lib/fonts
-#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/QtEmbedded-4.6.3/lib/fonts
-cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/Trolltech/QtEmbedded-4.5.1/lib/fonts
-cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.2/lib/fonts
-cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.3/lib/fonts
-
-
-
-
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Linking Browser fonts : ERROR"
- return 1
-fi
-
-# B ########################################################
-cp -pr ${SVNCLIENTSTRUCTURE}/lib/pci.ids $OGCLIENTMOUNT/etc
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Copying pci.ids : ERROR"
- return 1
-fi
-
-cp ${SVNCLIENTSTRUCTURE}/bin/browser $OGCLIENTMOUNT/bin
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Copying Browser : ERROR"
- return 1
-fi
-
-cp ${SVNCLIENTSTRUCTURE}/bin/ogAdmClient $OGCLIENTMOUNT/bin
-if [ $? -ne 0 ]
-then
- errorAndLog "$FUNCNAME(): Copying ogAdmClient : ERROR"
- return 1
-else
- mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
- mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
- mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
- mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
- echoAndLog "$FUNCNAME: Finalizado: OK "
- return 0
-fi
-}
-
-
-ogClientSchrootConf()
-{
-echoAndLog "$FUNCNAME: Iniciando la configuración del schroot "
-cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`
-cat << EOF > /etc/schroot/schroot.conf
-[IMGogclient]
-type=loopback
-file=/var/lib/tftpboot/ogclient/ogclient.img
-description=ogclient ubuntu luc IMGi
-priority=1
-users=root
-groups=root
-root-groups=root
-mount-options=-o offset=32256
-root-users=root
-[DIRogclient]
-type=directory
-directory=/var/lib/tftpboot/ogclient/ogclientmount
-description=ogclient ubuntu lucid DIR
-priority=2
-users=root
-groups=root
-root-groups=root
-root-users=root
-EOF
-cp /etc/schroot/mount-defaults /etc/schroot/mount-defaults.`getDateTime`
-cat << EOF > /etc/schroot/mount-defaults
-# mount.defaults: static file system information for chroots.
-# Note that the mount point will be prefixed by the chroot path
-# (CHROOT_PATH)
-#
-# <file system> <mount point> <type> <options> <dump> <pass>
-proc /proc proc defaults 0 0
-#procbususb /proc/bus/usb usbfs defaults 0 0
-#/dev /dev none rw,bind 0 0
-/dev/pts /dev/pts none rw,bind 0 0
-/dev/shm /dev/shm none rw,bind 0 0
-#/home /home none rw,bind 0 0
-/tmp /tmp none rw,bind 0 0
-EOF
-
-echoAndLog "$FUNCNAME: Finalizado: OK "
-return 0
-}
-
-
-
-########### param1 "host"
-ogClientInitrd()
-{
-ogClientVar
-cd /
-ogClientOsInfo $1
-schroot -c IMGogclient -- /root/GenerateInitrd.generic.sh
-echo "cp /tmp/*-${OSRELEASE} $OGCLIENTBASEDIR"
-cp /tmp/*-${OSRELEASE} $OGCLIENTBASEDIR
-cp /tmp/initrd.img-${OSRELEASE} ${OGCLIENTBASEDIR}/oginitrd.img
-cp /tmp/vmlinuz-${OSRELEASE} ${OGCLIENTBASEDIR}/ogvmlinuz
-cd -
-}
-
-
-ogClient2ndSqfs()
-{
-ogClientVar
-echoAndLog "$FUNCNAME: Iniciando la creación del sistema de archivos en sqfs "
-# si ya existe un sqfs lo renombramos
-[ -f $OGCLIENTBASEDIR/ogclient.sqfs ] && mv $OGCLIENTBASEDIR/ogclient.sqfs $OGCLIENTBASEDIR/ogclient.sqfs.`date +%Y%m%d-%H%M%S`
-mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
-mksquashfs $OGCLIENTMOUNT $OGCLIENTBASEDIR/ogclient.sqfs
-chmod 744 $OGCLIENTBASEDIR/ogclient.sqfs
-mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
-}
-
-
-
-
-ogClientSshkeys()
-{
-echo comprobamos clave rsa en el host REPO OG.
-if [ ! -f /root/.ssh/id_rsa.pub ]
-then
- echo "creando claves rsa"
- ssh-keygen -q -f /root/.ssh/id_dsa -t dsa -N "opengnsys"
-else
- echo "la claves ya estan creadas"
-fi
-echo "copiamos la clave publica a /tmp"
-cp /root/.ssh/id_dsa.pub /tmp
-
-cat /tmp/id_dsa.pub
-
-echo "schroot con instrucciones."
-schroot -c IMGogclient -- /root/importSshKeys.sh
-
-echo "limpiando"
-rm /tmp/id_dsa.pub
-
-## copiamos ssh rsa del host al guest como authorized-key2
-##rm ${OGCLIENTMOUNT}/root/.ssh/authorized-key2
-##cat /root/.ssh/id_rsa.pub >> ${OGCLIENTMOUNT}/root/.ssh/authorized-key2
-#cat ${OGCLIENTMOUNT}/root/.ssh/id_rsa.pub >> ${OGCLIENTMOUNT}/root/.ssh/authorized-key2
-##mount | grep $OGCLIENTMOUNT || umount $OGCLIENTMOUNT
-}
-
-
-
-function ogCrearISO {
-apt-get install syslinux genisoimage
-#TODO: deb http://free.nchc.org.tw/drbl-core drbl stable
-#apt-get install gpxe
-mkdir -p /tmp/iso/isolinux
-#cd tmp/iso/
-cp -prv /usr/lib/syslinux/* /tmp/iso/isolinux/
-cp -prv /usr/share/gpxe/* /tmp/iso/isolinux/
-mkdir -p /tmp/iso/ogclient
-#el ogclienteToISO debe tener una copia del ogvmlinuz como linuxISO
-cp -prv /var/lib/tftpboot/ogclientToIso/* /tmp/iso/ogclient
-
-
-cat << FIN > /tmp/iso/isolinux/isolinux.cfg
-DEFAULT menu.c32
-PROMPT 0
-ALLOWOPTIONS 1
-
-MENU TITLE OpenGnsys 1.0.1 v00
-
-LABEL gpxe
-MENU LABEL gpxe
-KERNEL /clonezilla/live/vmlinuz1
-APPEND initrd=/clonezilla/live/initrd1.img boot=live union=aufs noswap vga=788 ip=frommedia
-
-
-#default 0
-#prompt 1
-#timeout 100
-
-#display mensaje.txt
-
-
-
-
-LABEL 0
-MENU LABEL ogClient vga irqpool acpi ogdebug ip:none
-KERNEL /ogclient/linuxISO
-APPEND initrd=/ogclient/oginitrd.img ro vga=788 irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=none
-
-LABEL 1
-MENU LABEL ogClient irqpoll acpi ip:none
-KERNEL /ogclient/linuxISO
-APPEND initrd=/ogclient/oginitrd.img ro irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=none
-
-LABEL 2
-MENU LABEL ogClient acpi debug ip=dhcp
-KERNEL /ogclient/linuxISO
-APPEND initrd=/ogclient/oginitrd.img ro acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=dhcp
-
-LABEL 3
-MENU LABEL ogClient ip=dhcp
-KERNEL /ogclient/linuxISO
-APPEND initrd=/ogclient/oginitrd.img ro acpi=off boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=dhcp
-
-
-#LABEL ogclient
-#KERNEL /ogclient/linuxISO
-#APPEND initrd=/ogclient/initrdISO.img
-
-#KERNEL linuxISO
-#APPEND initrd=initrdISO.img
-
-LABEL 4
-MENU LABEL local
-localboot 0x80
-append -
-
-
-label 5
-MENU LABEL Network boot via gPXE lkrn
-KERNEL gpxe.lkrn
-
-label 5
-MENU LABEL Network boot via gPXE usb
-KERNEL gpxe.usb
-
-label 5
-MENU LABEL Network boot via gPXE pxe
-KERNEL gpxe.pxe
-
-label 5
-MENU LABEL Network boot via gPXE iso
-KERNEL gpxe.iso
-FIN
-#### /tmp/iso#
-mkisofs -V ogClient -o ogClient.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -J -no-emul-boot -boot-load-size 4 -boot-info-table tmp/iso
-
-### vi /etc/grub.d/40_custom
-##
-#menuentry "og cache " {
-#set root=(hd0,4)
-#linux /ogvmlinuz ro vga=788 irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=none
-#initrd /oginitrd.img
-#}
-
-
-}
-
-function ogprobarISO {
-#/tmp/iso
-qemu -m 256 -boot d -cdrom ogClient.iso
-}
-
-
-
-
-
-
-
-ogClientConfpxe()
-{
-################## DEJAMOS FICHERO DE EJEMPLOS PARA:
-#default
-cat << FIN >> /var/lib/tftpboot/pxelinux.cfg/defaultNEWClient
-LABEL pxe-${OGRELEASE}
-KERNEL ogclient/vmlinuz-$OGRELEASE
-APPEND initrd=ogclient/initrd.img-$OGRELEASE ip=dhcp ro boot=og vga=788 irqpoll acpi=on reposerver=
-LABEL pxe-2.6.32-21-generic-pae
-KERNEL ogclient/vmlinuz-2.6.32-21-generic-pae
-APPEND initrd=ogclient/initrd.img-2.6.32-21-generic-pae ip=dhcp ro boot=oginit vga=788 irqpoll acpi=on ogrepo=172.17.36.11 ogprotocol=nfs og2nd=sqfs
-LABEL cache
-KERNEL grub.exe
-APPEND --config-file="find --set-root /vmlinuz; kernel /vmlinuz ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd /initrd.img"
-LABEL net
-KERNEL grub.exe
-APPEND keeppxe --config-file="pxe detect; kernel (pd)/ogclient/vmlinuz-2.6.32-21-generic-pae ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd (pd)/ogclient/initrd.img-2.6.32-21-generic-pae"
-LABEL IfNOTcacheGOnet
-KERNEL grub.exe
-APPEND keeppxe --config-file="pxe detect; default 0; timeout 0; hiddenmenu; title cache; fallback 1; find --set-root /vmlinuz; kernel /vmlinuz ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd /initrd.img; boot; title net; kernel (pd)/ogclient/vmlinuz-2.6.32-21-generic-pae ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd (pd)/ogclient/initrd.img-2.6.32-21-generic-pae; boot"
-#LABEL pxe-2.6.32-21-generic-pae
-#KERNEL ogclient/vmlinuz-2.6.32-21-generic-pae
-#APPEND initrd=ogclient/initrd.img-2.6.32-21-generic-pae ip=dhcp ro boot=og vga=788 irqpoll acpi=on reposerver=172.17.32.242
-#LABEL grub
-#KERNEL grub.exe
-#APPEND keeppxe
-FIN
-#/etc/hosts
-echo "/var/lib/tftpboot *(ro,no_subtree_check,no_root_squash,sync)" > /etc/exportsNEWClient
-/etc/init.d/nfs-kernel-server restart
-#####################################################################
-}
-
-
-
-############### No usados en el instalador, solo en actualizaciones.
-#/**
-# ogClientMount [str_program]
-#@brief Acceso al 2nd FS del cliente desde el Servidor Opengnsys
-#@param 1 Opciona: scripts o programa a ejecutar para automatizaciones
-#@return Si no hay parametros: login de acceso.
-#@return con un parametro: La salida del programa ejecutado
-#@exception
-#@note
-#@todo
-#@version 0.9 - Primera versión para OpenGnSys
-#@author Antonio J. Doblas Viso, Universidad de Málaga
-#@date 2010/02/15
-#*/ ##
-function ogClientMount ()
-{
- #TODO comprobar que OGFILE y OGFILEMOUNT existe.
- mount | grep $OGCLIENTFILE > /dev/null || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
- mount | grep $OGCLIENTMOUNT/proc > /dev/null || mount --bind /proc $OGCLIENTMOUNT/proc
- mount | grep $OGCLIENTMOUNT/sys > /dev/null || mount --bind /sys $OGCLIENTMOUNT/sys
- mount | grep $OGCLIENTMOUNT/tmp > /dev/null || mount --bind /tmp $OGCLIENTMOUNT/tmp
- mount | grep $OGCLIENTMOUNT/dev > /dev/null || mount --bind /dev $OGCLIENTMOUNT/dev
- mount | grep $OGCLIENTMOUNT/dev/pts > /dev/null || mount --bind /dev/pts $OGCLIENTMOUNT/dev/pts
-
-
- [ $# = 0 ] && $(chroot $OGCLIENTMOUNT /sbin/getty 38400 `tty`)
- [ $# = 1 ] && chroot $OGCLIENTMOUNT $1
-
-}
-
-#/**
-# ogClientUnmount
-#@brief Desmonta el 2nd FS del cliente desde el Servidor Opengnsys
-#@param
-#@return
-#@exception
-#@note
-#@todo
-#@version 0.9 - Primera versión para OpenGnSys
-#@author Antonio J. Doblas Viso, Universidad de Málaga
-#@date 2010/02/15
-#*/ ##
-
-function ogClientUnmount ()
-{
- cd /tmp
- echo "desmontando cliente espere"
- sleep 5
- mount | grep $OGCLIENTMOUNT/dev > /dev/null && umount $OGCLIENTMOUNT/dev || ogClientUnmount
- mount | grep $OGCLIENTMOUNT/dev/pts > /dev/null && umount $OGCLIENTMOUNT/dev/pts || ogClientUnmount
- mount | grep $OGCLIENTMOUNT/proc > /dev/null && umount $OGCLIENTMOUNT/proc || ogClientUnmount
- mount | grep $OGCLIENTMOUNT/sys > /dev/null && umount $OGCLIENTMOUNT/sys || ogClientUnmount
- mount | grep $OGCLIENTMOUNT/tmp > /dev/null && umount $OGCLIENTMOUNT/tmp || ogClientUnmount
- mount | grep $OGCLIENTMOUNT > /dev/null && umount $OGCLIENTMOUNT || ogClientUnmount
- #-d -f -l
-
-}
-
-
-############################ hasta el final del archivo antiguos
-############################# ANTIGUOS
-function ogClientGetRelease ()
-{
- #1 OSCODENAME jaunty|karmic|lucid
- case $1 in
- jaunty|JAUNTY)
- OSCODENAME=jaunty
- OGRELEASE="2.6.28-11-generic"
- echo $OGRELEASE
- ;;
- lenny|LENNY)
- OSCODENAME=lenny
- OGRELEASE="2.6.28-11-generic"
- echo $OGRELEASE
- ;;
- squeeze|SQUEEZE)
- OSCODENAME=squeeze
- OGRELEASE="2.6.28-11-generic"
- echo $OGRELEASE
- ;;
- karmic|KARMIC)
- OSCODENAME=karmic
- OGRELEASE="2.6.31-14-generic"
- echo $OGRELEASE
- ;;
- lucid|LUCID)
- OSCODENAME=lucid
- OGRELEASE="2.6.32-21-generic-pae"
- echo $OGRELEASE
- ;;
- *)
- return 1
- ;;
- esac
-
-}
-
-
-#/**
-# ogClientGenerator str_versionUbuntu str_release
-#@brief Crea el 2nd FS del cliente desde el Servidor Opengnsys
-#@param 1 Versión de ubuntu a generar, jaunty karmic
-#@return
-#@exception
-#@note
-#@todo
-#@version 0.9 - Primera versión para OpenGnSys
-#@author Antonio J. Doblas Viso, Universidad de Málaga
-#@date 2010/02/15
-#*/ ##
-
-function ogClientGeneratorDebootstrap ()
-{
- if [ $# != 2 ]
- then
- echo Debes introducir como argumento1: jaunty karmic lucid
- echo Debes introducir como argumento2: la release
- echo utiliza como entrada ogClientCheckVersion
- return
- fi
- OSCODENAME=$1
- OGRELEASE=$2
-
- # instalamos el ultimo debotstrap para permitir instalar versiones superiores a nuestro sistema
- #apt-get install gdebi-core
- #wget $LASTDEBOOTSTRAP
- #gdebi -n debootstrap_1.0.20_all.deb
-
- #Desmontamos por si acaso el dispositivo virtual
- mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
-
- #Creamos el directorio donde montaremos el disco virtual
- mkdir -p $OGCLIENTMOUNT
-
- #Creamos el disco virtual con el filesystem del cliente.
- dd if=/dev/zero of=$OGCLIENTFILE bs=1048576 count=$OGCLIENTSIZEMB
- #qemu-img create $OGCLIENTFILE 3G
- #dd if=/dev/zero of=$OGCLIENTFILE bs=1k count=$OGCLIENTSIZEKB # necesita 500MB
-
-
- #particionamos el disco virtual
- losetup /dev/loop0 $OGCLIENTFILE
- echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk /dev/loop0
- losetup -d /dev/loop0
-
-
- #formateamos la particion principal.
- losetup -o 32256 /dev/loop1 $OGCLIENTFILE
- mkfs.ext3 -b 4096 -L $OGCLIENTLABEL /dev/loop1
- #mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
- #mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
- losetup -d /dev/loop1
-
- #Montamos el dispositivo virtual en su punto de montaje.
- mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
-
- #TODO Comprobar arquitectura
- #Iniciamos la creación del sistema en el directorio de clientes.
- #echo debootstrap --include=linux-image-${OGRELEASE},dbus --arch=i386 --components=main,universe $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
- debootstrap --include=linux-image-${OGRELEASE},linux-headers-${OGRELEASE} --arch=i386 --components=main,universe $OSCODENAME $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
- ##preubas
- #debootstrap --include=linux-image-${OGRELEASE} --arch=i386 --variant=minbase $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
- #debootstrap --variant=minbase --include=linux-image-${OGRELEASE} --arch=i386 $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
-
- if [ $? -ne 0 ]; then
- errorAndLog "ogClientGeneratorDebootstrap(): ha fallado!"
- return 1
- else
- echoAndLog "ogClientGeneratorDebootstrap(): ok"
- return 0
- fi
- sleep 5
-
-mount | grep $OGCLIENTMOUNT && umount $OGCLIENTFILE
-
-cat << EOF > /etc/schroot/schroot.conf
-[DIRogclient]
-type=directory
-directory=/var/lib/tftpboot/ogclient/ogclientmount
-description=ogclient ubuntu lucid DIR
-priority=2
-users=root
-groups=root
-root-groups=root
-root-users=root
-EOF
-}
-
-
-
-
-