diff --git a/boottoolsfunctions.lib b/boottoolsfunctions.lib index f968d75..04b5f46 100644 --- a/boottoolsfunctions.lib +++ b/boottoolsfunctions.lib @@ -13,6 +13,7 @@ # Autor: Antonio J. Doblas Viso. Universidad de Málaga. function btogGetVar() { + export BTSVNBOOTTOOLS=/tmp/opengnsys_installer/opengnsys/client/boot-tools export BTSVNSHARE=/tmp/opengnsys_installer/opengnsys/client/shared export BTSVNENGINE=/tmp/opengnsys_installer/opengnsys/client/engine @@ -23,10 +24,16 @@ export BTTARGETDIR=/var/lib/tftpboot/ogclient/ export BTROOTFSIMG=${BTTARGETDIR}ogclient.img export BTROOTFSMNT=${BTTARGETDIR}ogclientmount # tamaño maximo limitado por schroot 2GB -export BTVIRTUALDISKSIZE=1000 +export BTVIRTUALDISKSIZE=2000 export BTROOTFSIMGLABEL=ogClient export LOG_FILE=/tmp/boot-tools_installation.log + +NAMEISOCLIENT=`cat /tmp/opengnsys_info_rootfs` +NAMEHOSTCLIENT=`cat /tmp/opengnsys_chroot` + +export NAMEISOCLIENT +export NAMEHOSTCLIENT } @@ -228,6 +235,8 @@ proc /proc proc defaults 0 0 /tmp /tmp none rw,bind 0 0 EOF +rm /etc/schroot/setup.d/*chrootname + echoAndLog "$FUNCNAME: Finalizado: OK " return 0 } @@ -247,17 +256,26 @@ function btogFsInitrd () [ -z "$BTROOTFSIMG" ] && btogGetVar [ -z "$OSCODENAME" ] && btogGetOsInfo - -#TODO generara md5 del kernel y del initrd. - cd / schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsInitrdGenerate.sh echo "cp /tmp/*-${OSRELEASE} ${BTTARGETDIR}" cp /tmp/*-${OSRELEASE} ${BTTARGETDIR} +#Creando copias de las version oginitr y ogvmlinux previas +TIMEMOD=`date +%Y%m%d-%H%M%S` +[ -f $BTTARGETDIR/oginitrd.img ] && mv $BTTARGETDIR/oginitrd.img $BTTARGETDIR/oginitrd.img.$TIMEMOD; mv $BTTARGETDIR/oginitrd.img.sum $BTTARGETDIR/oginitrd.img.sum.$TIMEMOD +[ -f $BTTARGETDIR/ogvmlinuz ] && mv $BTTARGETDIR/ogvmlinuz $BTTARGETDIR/ogvmlinuz.$TIMEMOD; mv $BTTARGETDIR/ogvmlinuz.sum $BTTARGETDIR/ogvmlinuz.sum.$TIMEMOD + +#copiando cp /tmp/initrd.img-${OSRELEASE} ${BTTARGETDIR}/oginitrd.img cp /tmp/vmlinuz-${OSRELEASE} ${BTTARGETDIR}/ogvmlinuz +#generamos md5 del kernel y del initrd. +DATASUM=`md5sum "${BTTARGETDIR}/oginitrd.img" | cut -f1 -d" "` +echo $DATASUM > ${BTTARGETDIR}/oginitrd.img.sum +DATASUM=`md5sum "${BTTARGETDIR}/ogvmlinuz" | cut -f1 -d" "` +echo $DATASUM > ${BTTARGETDIR}/ogvmlinuz.sum +#Damos permisos cd - -chmod -R 755 $OGCLIENTBASEDIR +chmod -R 755 $BTTARGETDIR } #btogFsSqfs convierte el sistema root en sqfs @@ -270,17 +288,18 @@ chmod -R 755 $OGCLIENTBASEDIR function btogFsSqfs () { #Dependencias. -ogClientVar +[ -z "$BTROOTFSIMG" ] && btogGetVar +[ -z "$OSCODENAME" ] && btogGetOsInfo echoAndLog "$FUNCNAME: Iniciando la creación del sistema de archivos en sqfs " # si ya existe un sqfs lo renombramos [ -f $BTTARGETDIR/ogclient.sqfs ] && mv $BTTARGETDIR/ogclient.sqfs $BTTARGETDIR/ogclient.sqfs.`date +%Y%m%d-%H%M%S` mount | grep $BTROOTFSMNT || mount $BTROOTFSIMG $BTROOTFSMNT -o loop,offset=32256 - mksquashfs $BTROOTFSMNT $BTTARGETDIR/ogclient.sqfs -chmod 744 $BTTARGETDIR/ogclient.sqfs - mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT +chmod 744 $BTTARGETDIR/ogclient.sqfs +DATASUM=`md5sum "${BTTARGETDIR}/ogclient.sqfs" | cut -f1 -d" "` +echo $DATASUM > ${BTTARGETDIR}/ogclient.sqfs.sum } @@ -295,21 +314,20 @@ mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT #@author Antonio J. Doblas Viso. Universidad de Malaga. #@date 2011/08/03 function btogIsoGenerator { +#Dependencias. +#[ -z "$BTROOTFSIMG" ] && btogGetVar +btogGetVar +#Preparamos los gestores de arranque 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 +MENU TITLE OpenGnsys ${NAMEISOCLIENT} LABEL gpxe MENU LABEL gpxe @@ -357,8 +375,32 @@ label 8 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 + + + + +# preparamos el directorio boot-tools. +mkdir -p /tmp/iso/ogclient +cp ${BTTARGETDIR}/ogclient.sqfs /tmp/iso/ogclient/ +cp ${BTTARGETDIR}/ogclient.sqfs.sum /tmp/iso/ogclient/ +cp ${BTTARGETDIR}/ogvmlinuz /tmp/iso/ogclient/ +cp ${BTTARGETDIR}/ogvmlinuz.sum /tmp/iso/ogclient/ +cp ${BTTARGETDIR}/ogvmlinuz /tmp/iso/ogclient/linuxISO +cp ${BTTARGETDIR}/ogvmlinuz.sum /tmp/iso/ogclient/linuxISO.sum +cp ${BTTARGETDIR}/oginitrd.img /tmp/iso/ogclient/ +cp ${BTTARGETDIR}/oginitrd.img.sum /tmp/iso/ogclient/ +#el ogclienteToISO debe tener una copia del ogvmlinuz como linuxISO +#cp -prv /var/lib/tftpboot/ogclientToIso/* /tmp/iso/ogclient + +cd /tmp +#TIMEMOD=`date +%Y%m%d-%H%M%S` +####Generamos la iso +echo "mkisofs -V ogClient -o ${NAMEISOCLIENT}.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -J -no-emul-boot -boot-load-size 4 -boot-info-table /tmp/iso" +mkisofs -V ogClient -o ${NAMEISOCLIENT}.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -J -no-emul-boot -boot-load-size 4 -boot-info-table /tmp/iso +##Generamos el md5 +DATASUM=`md5sum ${NAMEISOCLIENT}.iso | cut -f1 -d" "` +echo $DATASUM > ${NAMEISOCLIENT}.iso.sum + ### vi /etc/grub.d/40_custom ## diff --git a/boottoolsgenerator.sh b/boottoolsgenerator.sh index b21ed84..56d6b30 100755 --- a/boottoolsgenerator.sh +++ b/boottoolsgenerator.sh @@ -10,6 +10,13 @@ #@date 2011/08/03 #*/ + #mkdir -p /tmp/opengnsys_installer/opengnsys; + #mkdir -p /tmp/opengnsys_installer/opengnsys2; + #cp -prv /home/administrador/workspace/OpenGnsys/branches/version2/* /tmp/opengnsys_installer/opengnsys2/; + #cp -prv /home/administrador/workspace/OpenGnsys/branches/version1.0/client/ /tmp/opengnsys_installer/opengnsys/; + +#find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null; + #Variables TYPECLIENT=host @@ -35,7 +42,7 @@ echoAndLog "OpenGnSys CLIENT installation begins at $(date)" ## FASE 1 - Instalación de software adicional. cat /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 apt-get update -apt-get -y --force-yes install debootstrap subversion schroot squashfs-tools syslinux genisoimage apt-get install gpxe +apt-get -y --force-yes install debootstrap subversion schroot squashfs-tools syslinux genisoimage gpxe qemu ##### FASE 2 - Asignación de variables #obtenemos las variables necesarias y la información del host. @@ -62,8 +69,8 @@ cat /etc/schroot/schroot.conf | grep $BTROOTFSIMG || btogSetFsAccess # FASE 5: Incorporando con ficheros OG el sistema raiz rootfs cp -prv ${BTSVNBOOTTOOLS}/includes/usr/bin/* /tmp/ -chmod 777 /tmp/*.sh -schroot -p -c IMGogclient -- /tmp/boottoolsFsOpengnsys.sh +chmod 777 /tmp/boot-tools/*.sh +schroot -p -c IMGogclient -- /tmp/boot-tools/boottoolsFsOpengnsys.sh # FASE6: Instalacion de software # 6.1 instalacion de software con apt-get @@ -93,16 +100,18 @@ schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshClient.sh ## 7.3 configuramos los locales. schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsFsLocales.sh -exit 99 #Fase 7. Generando la ISO. #7.1 el initrd btogFsInitrd + + #7.2 Convertivos el sistema raiz img en formato sqfs btogFsSqfs #7.3 Generamos la iso btogIsoGenerator + # Mostrar sumario de la instalación e instrucciones de post-instalación. installationSummary diff --git a/includes/etc/initramfs-tools/scripts/ogfunctions b/includes/etc/initramfs-tools/scripts/ogfunctions index ae76bf2..c701cae 100644 --- a/includes/etc/initramfs-tools/scripts/ogfunctions +++ b/includes/etc/initramfs-tools/scripts/ogfunctions @@ -1,11 +1,20 @@ #@file ogfunctions.lib -#@brief Librería o clase para la generación del 1erFS +#@brief Librería o clase para la gestion del sistema operativo de los clientes OpenGnsys #@class client -#@brief Funciones para la generación del primers sistema (initrd) +#@brief Librería o clase para la gestion del sistema operativo de los clientes OpenGnsys #@version 0.91 #@warning License: GNU GPLv3+ - +#/** +# ogExportKernelParameters +#@brief Exporta los parametros pasados al kernel +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.7 - +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2010/05/24 +#*/ ## ogExportKernelParameters () { GLOBAL="cat /proc/cmdline" @@ -13,33 +22,35 @@ ogExportKernelParameters () do echo $i | grep "=" > /dev/null && export $i done -return 0 + return 0 } +#/** +# ogExportVarEnvironment +#@brief Exporta las variables usadas en el proceso de inicio OpenGnsys y las almacena en /tmp +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2011/05/24 +#*/ ## ogExportVarEnvironment () { export CFGINITRD="/tmp/initrd.cfg" OGPROTOCOL="${ogprotocol:-smb}" case "$OGPROTOCOL" in nfs|NFS) - #export NFSROOTBOOT="/var/lib/tftpboot" export SRCOGLIVE="/var/lib/tftpboot" && echo "SRCOGLIVE=$SRCOGLIVE" >> $CFGINITRD - #export NFSCLIENTDIR="/opt/opengnsys/client" export SRCOGSHARE="/opt/opengnsys/client" && echo "SRCOGSHARE=$SRCOGSHARE" >> $CFGINITRD - #export NFSLOGDIR="/opt/opengnsys/log/clients" export SRCOGLOG="/opt/opengnsys/log/clients" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD - #export NFSIMGDIR="/opt/opengnsys/images" export SRCOGIMAGES="/opt/opengnsys/images" && echo "SRCOGIMAGES=$SRCOGIMAGES" >> $CFGINITRD ;; smb|SMB|cifs|CIFS|samba|SAMBA) export OPTIONS=" -o user=opengnsys,pass=og" - #export SMBROOTBOOT="tftpboot" && echo "SMBROOTBOOT=$SMBROOTBOOT" >> $CFGINITRD export SRCOGLIVE="tftpboot" && echo "SRCOGLIVE=$SRCOGLIVE" >> $CFGINITRD - #export SMBCLIENTDIR="ogclient" && echo "SMBCLIENTDIR=$SMBCLIENTDIR" >> $CFGINITRD export SRCOGSHARE="ogclient" && echo "SRCOGSHARE=$SRCOGSHARE" >> $CFGINITRD - #export SMBLOGDIR="oglog" && echo "SMBLOGDIR=$SMBLOGDIR" >> $CFGINITRD export SRCOGLOG="oglog" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD - #export SMBIMGDIR="ogimages" && echo "SMBIMGDIR=$SMBIMGDIR" >> $CFGINITRD export SRCOGIMAGES="ogimages" && echo "SRCOGIMAGES=$SRCOGIMAGES" >> $CFGINITRD ;; local|LOCAL) @@ -47,27 +58,20 @@ ogExportVarEnvironment () ;; esac #punto de acceso al boot-tools live - #export LOCALROOTBOOT="/opt/og2fs/tftpboot" && echo "LOCALROOTBOOT=$LOCALROOTBOOT" >> $CFGINITRD export DSTOGLIVE="/opt/oglive/tftpboot" #punto de montaje para unionfs - #export LOCALROOTRAM="/opt/og2fs/1stfs" && echo "LOCALROOTRAM=$LOCALROOTRAM" >> $CFGINITRD export OGLIVERAMFS="/opt/oglive/ramfs" && echo "OGLIVERAMFS=$OGLIVERAMFS" >> $CFGINITRD #punto de montaje donde se accede al 2nd FS mediante loop - #export LOCALROOTIMG="/opt/og2fs/2ndfs" && echo "LOCALROOTIMG=$LOCALROOTIMG" >> $CFGINITRD export OGLIVEROOTFS="/opt/oglive/rootfs" && echo "OGLIVEROOTFS=$OGLIVEROOTFS" >> $CFGINITRD #punto de union entre LOCALROOTIMG y LOCALROOTRAM - #export LOCALROOTUNION="/opt/og2fs/unionfs" && echo "LOCALROOTUNION=$LOCALROOTUNION" >> $CFGINITRD export OGLIVEUNIONFS="/opt/oglive/unionfs" && echo "OGLIVEUNIONFS=$OGLIVEUNIONFS" >> $CFGINITRD #etiquta para los dispositivos offline export OGLIVELABEL="ogClient" #echo "puntos de montajes para los demas accesos" #echo "acceso al client, engine, scritps, interfaz" - #export LOCALCLIENTDIR="/opt/opengnsys" && echo "LOCALCLIENTDIR=$LOCALCLIENTDIR" >> $CFGINITRD export DSTOGSHARE="/opt/opengnsys" && echo "DSTOGSHARE=$DSTOGSHARE" >> $CFGINITRD - #export LOCALLOGDIR="/opt/opengnsys/log" && echo "LOCALLOGDIR=$LOCALLOGDIR" >> $CFGINITRD export DSTOGLOG="/opt/opengnsys/log" && echo "DSTOGLOG=$DSTOGLOG" >> $CFGINITRD - #export LOCALIMGDIR="/opt/opengnsys/images" && echo "LOCALIMGDIR=$LOCALIMGDIR" >> $CFGINITRD export DSTOGIMAGES="/opt/opengnsys/images" && echo "DSTOGIMAGES=$DSTOGIMAGES" >> $CFGINITRD ##INFORMACION DE OTRAS VARIABLES OBTENDIAS EN OTRAS FUNCIONES ogConfigureNetwork. @@ -87,18 +91,36 @@ ogExportVarEnvironment () return 0 } + +#/** +# ogConfigureRamfs +#@brief Configura el initrd para adaptarlo al sistema raiz. +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2010/05/24 +#*/ ## ogConfigureRamfs () { - #mkdir -p $LOCALROOTBOOT mkdir -p $DSTOGLIVE - #mkdir -p $LOCALROOTRAM mkdir -p $OGLIVERAMFS - #mkdir -p $LOCALROOTIMG mkdir -p $OGLIVEROOTFS - #mkdir -p $LOCALROOTUNION mkdir -p $OGLIVEUNIONFS } + +#/** +# ogLoadNetModule +#@brief Carga en un demerminado modulo de red, requiere compilación previo del modulo +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2010/05/24 +#*/ ## ogLoadNetModule () { if [ -n "$ognetmodule" ] @@ -109,6 +131,16 @@ ogLoadNetModule () } +#/** +# ogPostConfigureFS +#@brief Configura el sistema raiz, para independizarlo entre los clientes. +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2010/05/24 +#*/ ## ogPostConfigureFS() { # configuramos el /etc/hostname. @@ -135,27 +167,37 @@ ogPostConfigureFS() echo "localnet $NETIP" >> /etc/networks #route - echo "ogLive1.0.2" > /etc/debian_chroot + #echo "ogLive1.0.2" > /etc/debian_chroot #enlace si iniciamos desde ogprotocolo=local { cdrom, usb, cache } . # monta el raiz del dispositivo local en /opt/og2fs/tftpboot - acceso al fichero .sqfs # y monta el sistema root sqfs en /opt/og2fs/2ndfs - #[ "$LOCALMEDIA" == "CACHE" ] && ln -s /opt/oglive/tftpboot /opt/opengnsys/cache - #[ "$ogprotocol" == "local" ] && ln -s /opt/oglive/2ndfs/opt/opengnsys/* /opt/opengnsys/ [ "$LOCALMEDIA" == "CACHE" ] && ln -s $DSTOGLIVE /opt/opengnsys/cache [ "$ogprotocol" == "local" ] && ln -s ${OGLIVEROOTFS}/opt/opengnsys/* /opt/opengnsys/ + #Montamos un directorio temporal para el apt-get + mount tmpfs /var/cache/apt/archives -t tmpfs -o size=15M + mkdir -p /var/cache/apt/archives/partial } - +#/** +# ogGetROOTSERVER +#@brief Determina los puntos de accesos a los distintos recursos. #Requiere ogConfigureNetworking. #Exporta ROOTSERVER # si la red ha sido configurada con dhcp el valor de ROOTSERVER será el valor de next-server del dhcp # si la red ha sido configurada con el parametro de kernel ip, será el segundo valor. - ## ip=iphost:ipnext-server:ipgateway:netmask:hostname:iface:none - ## ip=172.17.36.21:62.36.225.150:172.17.36.254:255.255.255.0:prueba1:eth0:none +## ip=iphost:ipnext-server:ipgateway:netmask:hostname:iface:none +## ip=172.17.36.21:62.36.225.150:172.17.36.254:255.255.255.0:prueba1:eth0:none +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2010/05/24 +#*/ ## ogGetROOTSERVER () { # get nfs root from dhcp @@ -190,12 +232,23 @@ ogGetROOTSERVER () return 0 } -#ogConnect -# parm 1 ip servidor TODO:dns -# parm 2 protocolo -# parm 3 punto de acceso remoto -# parm 4 punto de montaje local -# parm 5 acceso de lectura tipo ",ro" + + +#/** +# ogConnect +#@brief Conecta con los recursos necesarios para opengnsys +#@param1 ip del servidor TODO:dns +#@param2 protocolo +#@param3 punto de acceso remoto +#@param4 punto de montaje local +#@param5 acceso de lectura tipo ",ro" +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2011/05/24 +#*/ ## + ogConnect () { SERVER=$1 @@ -213,7 +266,17 @@ ogConnect () ;; esac } - + + +#/** +# ogConnectOgLive +#@brief Conecta con el recurso para usar el sistema raiz externo, remoto o local +#@param1 +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2011/05/24 ogConnectOgLive () { # Si ogprotocol=local, la funcion ogExportVar => SRCOGLIVE=local @@ -236,7 +299,15 @@ ogConnectOgLive () } - +#/** +# ogMergeLive +#@brief Metafuncion para fusionar el initrd con el sistema raiz. +#@param1 +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2011/05/24 ogMergeLive() { #Si existe en el punto de acceso del del oglive el fichero ogclient.sqfs @@ -265,10 +336,15 @@ fi - -#ogUnionLiveDir -#par 1 el directorio a unir. -# para el parmetro 1 (directorio), +#/** +# ogUnionLiveDir +#@brief fusiona dos directorios con unionfs +#@param1 +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2011/05/24 ogUnionLiveDir() { TMPDIR=/$1 #dir @@ -287,14 +363,36 @@ ogUnionLiveDir() - +#/** +# ogConfigureLoopback +#@brief Configura la interfaz loopback para cliente torrent +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 Usando funciones generales de ubuntu +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2010/05/24 +#@version 1.0.1 Deteccion automatica de interfaz con enlace activo. +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2011/05/24 +#*/ ## ogConfigureLoopback() { -# for the portmapper we need localhost -ifconfig lo 127.0.0.1 -#/etc/init.d/portmap start + # for the portmapper we need localhost + ifconfig lo 127.0.0.1 + #/etc/init.d/portmap start } +#/** +# ogConfigureNetworking +#@brief Configura la interfaz de red usada en el pxe +#@param +#@return +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author Antonio J. Doblas. Universidad de Malaga. +#@date 2010/05/24 +#*/ ## ogConfigureNetworking() { #echo "ogConfigureNetworking: Buscando interfaz a configurar DEVICE" @@ -425,18 +523,18 @@ else fi } - ##################################################################### -# Ask yesno question. -# -# Usage: yesno OPTIONS QUESTION -# -# Options: -# --timeout N Timeout if no input seen in N seconds. -# --default ANS Use ANS as the default answer on timeout or -# if an empty answer is provided. -# -# Exit status is the answer. 0=yes 1=no +#/** +# ogYesNo +#@brief Gestion de peticiones de usuario en modo ogdebug=true +#@param1 OPTIONS --timeout N --default ANSWER +#@param1 Questions +#@return 1=yes 0=no +#@exception OG_ERR_FORMAT Formato incorrecto. +#@version 0.9 +#@author: +@date 2010/05/24 +#*/ ## ogYesNo() { local ans @@ -511,121 +609,5 @@ ogYesNo() if [[ $ok -eq 0 ]]; then warning "Valid answers are: yes y no n"; fi done [[ "$ans" = "y" || "$ans" == "yes" ]] -} - - -### # borrar - -ogConectROOTSERVER () -{ -local OPTIONS -#params a detectar -if [ $ogrepo ] -then - # Validar si la ip es correcta - ROOTREPO=$ogrepo -else - ROOTREPO=$ROOTSERVER -fi - -case "$ogprotocol" in - local) - echo "Montar imagen del sistema root desde dispositivo local" - for i in $(blkid /dev/s* | grep ogClient | awk -F: '{print $2}' | tr -d \"); do export $i; done - mount -t $TYPE LABEL=$LABEL $LOCALROOTBOOT - if [ $? != 0 ] - then - mount -t reiserfs LABEL=CACHE $LOCALROOTBOOT - export LOCALMEDIA=CACHE - fi - ;; - httfs) - echo "protocolo httfs aun no soportado" - ;; - sshfs) - echo "protocolo sshfs aun no soportado" - ;; - smb) - echo "Preparando conexión con el Repositorio $ROOTSERVER por $ogprotocol" - OPTIONS=" -o user=opengnsys,pass=og" - mount.cifs //${ROOTSERVER}/${SMBROOTBOOT} $LOCALROOTBOOT $OPTIONS - mount.cifs //${ROOTSERVER}/${SMBCLIENTDIR} $LOCALCLIENTDIR $OPTIONS - mount.cifs //${ROOTSERVER}/${SMBLOGDIR} $LOCALLOGDIR $OPTIONS - - mount.cifs //${ROOTREPO}/${SMBIMGDIR} $LOCALIMGDIR ${OPTIONS},ro - ;; - nfs) - echo "Preparando conexión con el Repositorio $ROOTSERVER por $ogprotocol" - nfsmount -o nolock $ROOTSERVER:$NFSROOTBOOT $LOCALROOTBOOT - nfsmount -o nolock,ro $ROOTSERVER:$NFSCLIENTDIR $LOCALCLIENTDIR - nfsmount -o nolock $ROOTSERVER:$NFSLOGDIR $LOCALLOGDIR - - nfsmount -o nolock,ro $ROOTREPO:$NFSIMGDIR $LOCALIMGDIR - ;; -esac -} - - ogMerge2ndFile() -{ -if [ -f $LOCALROOTBOOT/ogclient/ogclient.sqfs ] -then - cat /proc/mounts > /tmp/mtab.preunion - if [ "$og2nd" == "img" ] - then - #para acceder al img - losetup /dev/loop0 $LOCALROOTBOOT/ogclient/ogclient.img -o 32256 - mount /dev/loop0 $LOCALROOTIMG - else - ## para acceder al squashfs - mount $LOCALROOTBOOT/ogclient/ogclient.sqfs $LOCALROOTIMG -t squashfs -o loop - fi - for i in etc var lib bin sbin usr root boot; do - unionmount $i - done - cat /tmp/mtab.preunion > /etc/mtab -else - echo "Fichero imagen del cliente no encontrado" - return 1 -fi -} - -unionmount() -{ - tmpdir=/$1 #dir - FUSE_OPT="-o default_permissions -o allow_other -o use_ino -o nonempty -o suid" - UNION_OPT="-o cow -o noinitgroups" - UBIN="unionfs-fuse" - #UPATH="/unionfs" - #LOCALROOTIMG="/opt/og2fs/2ndfs" - #LOCALROOTRAM="/opt/og2fs/1stfs" #/unionfs/host #punto de montaje para unionfs - #LOCALROOTUNION=/opt/og2fs/unionfs/" #/unionfs/union #punto de union entreo LOCALROOTIMG y LOCALROOTRAM - #mkdir -p $LOCALROOTRAM #/unionfs/host - #mkdir -p $LOCALROOTUNION #/unionfs/union - mkdir -p $LOCALROOTRAM$tmpdir - #mount --bind /$tmpdir $LOCALROOTRAM$tmpdir - U1STDIR="${LOCALROOTRAM}${tmpdir}=RW" - U2NDDIR="${LOCALROOTIMG}${tmpdir}=RO" - UNIONDIR=$LOCALROOTUNION$tmpdir - mkdir -p $UNIONDIR - $UBIN $FUSE_OPT $UNION_OPT ${U1STDIR}:${U2NDDIR} $UNIONDIR - mount --bind $UNIONDIR $tmpdir -} - - -unionmountOLD() -{ - FUSE_OPT="-o default_permissions -o allow_other -o use_ino -o nonempty -o suid" - UNION_OPT="-o cow -o noinitgroups" - UPATH="/unionfs" - UBIN="unionfs-fuse" - mkdir -p /unionfs/host - mkdir -p /unionfs/union - dir=$1 - mkdir -p /unionfs/host/$dir - #mount --bind /$dir /unionfs/host/$dir - mkdir -p /unionfs/union/$dir - host="/unionfs/host/${dir}=RW" - common="/opt/og2fs/${dir}=RO" - $UBIN $FUSE_OPT $UNION_OPT ${host}:${common} /unionfs/union/$dir - mount --bind /unionfs/union/$dir /$dir -} +} + diff --git a/includes/etc/initramfs-tools/scripts/oginit b/includes/etc/initramfs-tools/scripts/oginit index 94226a1..bdf4e7f 100755 --- a/includes/etc/initramfs-tools/scripts/oginit +++ b/includes/etc/initramfs-tools/scripts/oginit @@ -24,6 +24,9 @@ #@version 1.0. - Adaptacion variables. Corrección enlace red #@author Antonio J. Doblas Viso. Universidad de Málaga. EVLT. #@date 2011/06/16 +#@version 1.0.1 - Adaptacion inicio multiples dispositivos, usb, red, cd +#@author Antonio J. Doblas Viso. Universidad de Málaga. EVLT. +#@date 2011/07/4 #*/ diff --git a/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh b/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh index d741b1c..513a251 100644 --- a/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh +++ b/includes/usr/bin/boot-tools/boottoolsFsOpengnsys.sh @@ -5,6 +5,13 @@ #svn checkout http://www.opengnsys.es/svn/branches/version2/ /tmp/opengnsys_installer/opengnsys2 find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null; +export SVNURL="http://opengnsys.es/svn/branches/version1.0/client/" +VERSIONSVN=$(LANG=C svn info $SVNURL | awk '/Revision:/ {print "r"$2}') + +VERSIONBOOTTOOLS=ogLive + +NAMEISOCLIENT="/tmp/opengnsys_info_rootfs" +NAMEHOSTCLIENT="/tmp/opengnsys_chroot" SVNCLIENTDIR=/tmp/opengnsys_installer/opengnsys/client/boot-tools SVNCLIENTSTRUCTURE=/tmp/opengnsys_installer/opengnsys/client/shared @@ -19,14 +26,16 @@ OSCODENAME=$(cat /etc/lsb-release | grep CODENAME | awk -F= '{print $NF}') OSRELEASE=$(uname -a | awk '{print $3}') uname -a | grep x86_64 > /dev/null && export OSARCH=amd64 || export OSARCH=i386 OSHTTP="http://es.archive.ubuntu.com/ubuntu/" + echo $OSDISTRIB:$OSCODENAME:$OSRELEASE:$OSARCH:$OSHTTP + LERROR=TRUE echo "$FUNCNAME: Iniciando la personalización con datos del SVN " # parseamos del apt.source -sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list.ubuntu > ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list +sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/includes/etc/apt/sources.list.ubuntu > ${SVNCLIENTDIR}/includes/etc/apt/sources.list if [ $? -ne 0 ] then echo "$FUNCNAME(): Parsing apt.sources : ERROR" @@ -114,5 +123,9 @@ cp -prv ${SVNOG2}/job_executer $OGCLIENTMOUNT/opt/opengnsys/bin/ cp ${SVNCLIENTSTRUCTURE}/bin/ogAdmClient $OGCLIENTMOUNT/bin +echo ${VERSIONBOOTTOOLS}-${OSCODENAME}-${OSRELEASE}-${VERSIONSVN} > $NAMEISOCLIENT +echo ${VERSIONBOOTTOOLS}-${OSCODENAME}-${VERSIONSVN} > $NAMEHOSTCLIENT +echo ${VERSIONBOOTTOOLS}-${OSCODENAME}-${VERSIONSVN} > /etc/debian_chroot +echo ${VERSIONBOOTTOOLS}-${OSCODENAME}-${VERSIONSVN} > /etc/opengnsys_chroot diff --git a/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh b/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh index a421352..3c9b1a2 100755 --- a/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh +++ b/includes/usr/bin/boot-tools/boottoolsSoftwareCompile.sh @@ -15,26 +15,16 @@ apt-get -y --force-yes install build-essential libattr* attr make m4 gettext lib source /opt/opengnsys/lib/engine/bin/ToolsGNU.c -#TODO: comprobar si esta instalado. -ctorrent install +which ctorrent || ctorrent install -#TODO: comprobar si esta instalado. -udpcast install +which udp-sender || udpcast install -#ntfs-3g install +which ms-sys || ms-sys install -#TODO: comprobar si esta instalado. -ms-sys install - -#TODO: comprobar si esta instalado. -wget -O partclone_0.2.16_i386.deb http://downloads.sourceforge.net/project/partclone/stable/0.2.16/partclone_0.2.16_i386.deb?use_mirror=ovh -gdebi -n partclone_0.2.16_i386.deb - -#TODO: comprobar si esta instalado. -cd /tmp -wget http://damien.guibouret.free.fr/savepart.zip -unzip savepart.zip -d /sbin/ +which partclone.ntfs || $(wget -O partclone_0.2.16_i386.deb http://downloads.sourceforge.net/project/partclone/stable/0.2.16/partclone_0.2.16_i386.deb?use_mirror=ovh; gdebi -n partclone_0.2.16_i386.deb) + + +which spartlnx.run || $(cd /tmp; wget http://damien.guibouret.free.fr/savepart.zip; unzip savepart.zip -d /sbin/) -#apt-get remove build-essential libattr* attr make m4 gettext libmhash-dev gdebi-core gawk diff --git a/includes/usr/bin/boot-tools/boottoolsSoftwareInstall.sh b/includes/usr/bin/boot-tools/boottoolsSoftwareInstall.sh index cb65f67..1c4a978 100755 --- a/includes/usr/bin/boot-tools/boottoolsSoftwareInstall.sh +++ b/includes/usr/bin/boot-tools/boottoolsSoftwareInstall.sh @@ -28,7 +28,7 @@ apt-get -y --force-yes install linux-image-${OSRELEASE} linux-headers-${OSRELEAS apt-get -y --force-yes install console-data locales # sofware networking -apt-get -y --force-yes install netpipes nfs-common sshfs smbfs smbclient davfs2 unionfs-fuse open-iscsi nmap tcpdump arping dnsutils +apt-get -y --force-yes install netpipes nfs-common sshfs smbfs smbclient davfs2 unionfs-fuse open-iscsi nmap tcpdump arping dnsutils tftp apt-get clean # software services @@ -46,7 +46,7 @@ apt-get -y --force-yes install drbl-partimage fsarchiver pv kexec-tools apt-get -y --force-yes install mbuffer #monitor -apt-get install bwbar bmon iftop ifstat dstat hdparm sdparm blktool testdisk ssmping mii-diag +apt-get -y --force-yes install bwbar bmon iftop ifstat dstat hdparm sdparm blktool testdisk ssmping mii-diag ## software postconf apt-get -y --force-yes install drbl-chntpw chntpw ethtool lshw gawk subversion @@ -56,14 +56,17 @@ apt-get -y --force-yes install lzma zip unzip gzip lzop drbl-lzop pigz pbzip2 lb #compatibilidad og2 -apt-get install python-openssl python +apt-get -y --force-yes install python-openssl python apt-get -y --force-yes remove busybox apt-get -y --force-yes install busybox-static bash-static + + +#apt-get -y --force-yes install xorg-dev xorg lxde roxterm + apt-get clean -#apt-get -y --force-yes xorg-dev xorg lxde roxterm # #################################################################### ###################### Reconfigurando paquetes ###################### diff --git a/includes/usr/bin/boot-tools/boottoolsSoftwareXwindows b/includes/usr/bin/boot-tools/boottoolsSoftwareXwindows new file mode 100644 index 0000000..ce7042c --- /dev/null +++ b/includes/usr/bin/boot-tools/boottoolsSoftwareXwindows @@ -0,0 +1,12 @@ +#!/bin/bash + +export LANGUAGE=C +export LC_ALL=C +export LANG=C + +apt-get clean +apt-get -y update + +apt-get -y --force-yes install xorg-dev xorg lxde roxterm + +apt-get clean \ No newline at end of file diff --git a/includes/usr/bin/boot-tools/qemu.sh b/includes/usr/bin/boot-tools/qemu.sh index c5a93cd..4903167 100755 --- a/includes/usr/bin/boot-tools/qemu.sh +++ b/includes/usr/bin/boot-tools/qemu.sh @@ -6,4 +6,7 @@ export PATH=$PATH dpkg -i *.deb modprobe 8139too modprobe 8139cp dhclient -/etc/init.d/ssh restart \ No newline at end of file +/etc/init.d/ssh restart + + +#qemu -hda ogclient.img -kernel ./ogvmlinuz -initrd ./oginitrd.img -append "root=/dev/sda1 rw init=false" -boot c \ No newline at end of file