Changes between Initial Version and Version 1 of ClienteInitrdDSGenerarIMG


Ignore:
Timestamp:
Jul 4, 2012, 12:54:16 PM (12 years ago)
Author:
adv
Comment:

info ogLive

Legend:

Unmodified
Added
Removed
Modified
  • ClienteInitrdDSGenerarIMG

    v1 v1  
     1== Exportar el sqfs del ogLive a formato IMG para su modificación ==
     2
     3
     4{{{
     5Advertencia previa:
     66       -----------------------------
     77       - No usar este proceso en un sistema OpenGnNys en producción.
     88       - Se puede ejecutar este script desde un sistema Ubuntu 10.04, 11.04, 11.10, 12.04
     911     
     1012      Requisitos iniciales
     1113      --------------------
     1214      - Utilizar el usuario "root" para ejecutar el proceso de exportación sqfs a img.
     1315      - Comprobar la conexión a Internet, sobre todo si usas proxy:
     14              -- apt           # /etc/apt.conf
     15              -- subversion    # /etc/subversion/servers
     16              -- otras  # variable http_proxy
     1716      - /var/lib/tftpboot  espacio libre 2 GB.
     18}}}
     19
     20
     21* Requisitos previos
     22
     23{{{
     24* Detección kernel del ogLive a modificar.
     25root@ogTRUNK:/# ls /opt/opengnsys/lib/
     26ogLive-precise-3.2.0-23-generic-pae-r3017.iso
     27
     28* Usar en equipo mismo kernel que el ogLive a moficiar.
     29root@ogTRUNK:/opt/opengnsys/lib# uname -a
     30Linux ogTRUNK 3.2.0-20-generic #33-Ubuntu SMP Tue Mar 27 16:42:26 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
     31
     32apt-get install linux-image-3.0.0-23-generic-pae  linux-image-3.0.0-23-generic-pae
     33
     34root@ogTRUNK:/opt/opengnsys/lib# cat /etc/lsb-release
     35DISTRIB_ID=Ubuntu
     36DISTRIB_RELEASE=12.04
     37DISTRIB_CODENAME=precise
     38DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"
     39
     40
     41
     42}}
     43
     44NOTA: este procedimiento se ha comprobado en una ubuntu server 12.04 32bits "copy & paste".
     45{{{
     46apt-get install schroot subversion wget;
     47export OGCLIENTBASEDIR=/var/lib/tftpboot/ogclient/;
     48export OGCLIENTFILE=${OGCLIENTBASEDIR}ogclient.img;
     49export OGCLIENTMOUNT=${OGCLIENTBASEDIR}ogclientmount;
     50export OGCLIENTSIZEMB=1900;
     51export OGCLIENTLABEL=ogClient;
     52
     53mkdir -p $OGCLIENTMOUNT;
     54dd if=/dev/zero of=$OGCLIENTFILE bs=1048576 count=$OGCLIENTSIZEMB;
     55DISKLOOP=$(losetup -f);
     56losetup $DISKLOOP $OGCLIENTFILE;
     57echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk $DISKLOOP;
     58losetup -d $DISKLOOP ;
     59PARTLOOP=$(losetup -f);
     60losetup -o 32256 $PARTLOOP $OGCLIENTFILE && mkfs.ext3 -b 4096 -L $OGCLIENTLABEL $PARTLOOP;
     61losetup -d $PARTLOOP ;
     62losetup -d $PARTLOOP ;
     63
     64mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256;
     65
     66unsquashfs  -d /opt/opengnsys/tftpboot/ogclient/ogclientmount/ -f /opt/opengnsys/tftpboot/ogclient/ogclient.sqfs ;
     67umount $OGCLIENTMOUNT;
     68echo "fin";
     69
     70}}}
     71
     72{{{
     73echo "Configurando acceso al disco virtual ogLive, formato IMG";
     74cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`;
     75cat << EOF > /etc/schroot/schroot.conf
     76[IMGogclient]
     77type=loopback
     78file=/var/lib/tftpboot/ogclient/ogclient.img
     79description=ogclient ubuntu luc IMGi
     80#priority=1
     81users=root
     82groups=root
     83root-groups=root
     84mount-options=-o offset=32256
     85root-users=root
     86#[IMGogclient]
     87#type=loopback
     88#file=/var/lib/tftpboot/ogclient/ogclient.img
     89#description=ogclient ubuntu luc IMGi
     90#priority=1
     91#users=root
     92#groups=root
     93#root-groups=root
     94#mount-options=-o offset=32256
     95#root-users=root
     96#[DIRogclient]
     97#type=directory
     98#directory=/var/lib/tftpboot/ogclient/ogclientmount
     99#description=ogclient ubuntu lucid DIR
     100#priority=2
     101#users=root
     102#groups=root
     103#root-groups=root
     104#root-users=root
     105EOF
     106echo "Configurando montajes automáticos del sistema ogLive en formato IMG";
     107cp /etc/schroot/mount-defaults /etc/schroot/mount-defaults.`getDateTime`;
     108cat << EOF > /etc/schroot/mount-defaults
     109# mount.defaults: static file system information for chroots.
     110# Note that the mount point will be prefixed by the chroot path
     111# (CHROOT_PATH)
     112#
     113# <file system> <mount point>   <type>  <options>       <dump>  <pass>
     114proc            /proc           proc    defaults        0       0
     115#procbususb      /proc/bus/usb   usbfs   defaults        0       0
     116#/dev            /dev            none    rw,bind         0       0
     117/dev/pts        /dev/pts        none    rw,bind         0       0
     118/dev/shm        /dev/shm        none    rw,bind         0       0
     119#/home          /home           none    rw,bind         0       0
     120/tmp            /tmp            none    rw,bind         0       0                                                               
     121EOF
     122
     123echo "Fin configuración acceso al ogLive formato IMG";
     124
     125}}}