| 1 | == Exportar el sqfs del ogLive a formato IMG para su modificación == |
| 2 | |
| 3 | |
| 4 | {{{ |
| 5 | Advertencia previa: |
| 6 | 6 ----------------------------- |
| 7 | 7 - No usar este proceso en un sistema OpenGnNys en producción. |
| 8 | 8 - Se puede ejecutar este script desde un sistema Ubuntu 10.04, 11.04, 11.10, 12.04 |
| 9 | 11 |
| 10 | 12 Requisitos iniciales |
| 11 | 13 -------------------- |
| 12 | 14 - Utilizar el usuario "root" para ejecutar el proceso de exportación sqfs a img. |
| 13 | 15 - 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 |
| 17 | 16 - /var/lib/tftpboot espacio libre 2 GB. |
| 18 | }}} |
| 19 | |
| 20 | |
| 21 | * Requisitos previos |
| 22 | |
| 23 | {{{ |
| 24 | * Detección kernel del ogLive a modificar. |
| 25 | root@ogTRUNK:/# ls /opt/opengnsys/lib/ |
| 26 | ogLive-precise-3.2.0-23-generic-pae-r3017.iso |
| 27 | |
| 28 | * Usar en equipo mismo kernel que el ogLive a moficiar. |
| 29 | root@ogTRUNK:/opt/opengnsys/lib# uname -a |
| 30 | Linux 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 | |
| 32 | apt-get install linux-image-3.0.0-23-generic-pae linux-image-3.0.0-23-generic-pae |
| 33 | |
| 34 | root@ogTRUNK:/opt/opengnsys/lib# cat /etc/lsb-release |
| 35 | DISTRIB_ID=Ubuntu |
| 36 | DISTRIB_RELEASE=12.04 |
| 37 | DISTRIB_CODENAME=precise |
| 38 | DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS" |
| 39 | |
| 40 | |
| 41 | |
| 42 | }} |
| 43 | |
| 44 | NOTA: este procedimiento se ha comprobado en una ubuntu server 12.04 32bits "copy & paste". |
| 45 | {{{ |
| 46 | apt-get install schroot subversion wget; |
| 47 | export OGCLIENTBASEDIR=/var/lib/tftpboot/ogclient/; |
| 48 | export OGCLIENTFILE=${OGCLIENTBASEDIR}ogclient.img; |
| 49 | export OGCLIENTMOUNT=${OGCLIENTBASEDIR}ogclientmount; |
| 50 | export OGCLIENTSIZEMB=1900; |
| 51 | export OGCLIENTLABEL=ogClient; |
| 52 | |
| 53 | mkdir -p $OGCLIENTMOUNT; |
| 54 | dd if=/dev/zero of=$OGCLIENTFILE bs=1048576 count=$OGCLIENTSIZEMB; |
| 55 | DISKLOOP=$(losetup -f); |
| 56 | losetup $DISKLOOP $OGCLIENTFILE; |
| 57 | echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk $DISKLOOP; |
| 58 | losetup -d $DISKLOOP ; |
| 59 | PARTLOOP=$(losetup -f); |
| 60 | losetup -o 32256 $PARTLOOP $OGCLIENTFILE && mkfs.ext3 -b 4096 -L $OGCLIENTLABEL $PARTLOOP; |
| 61 | losetup -d $PARTLOOP ; |
| 62 | losetup -d $PARTLOOP ; |
| 63 | |
| 64 | mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256; |
| 65 | |
| 66 | unsquashfs -d /opt/opengnsys/tftpboot/ogclient/ogclientmount/ -f /opt/opengnsys/tftpboot/ogclient/ogclient.sqfs ; |
| 67 | umount $OGCLIENTMOUNT; |
| 68 | echo "fin"; |
| 69 | |
| 70 | }}} |
| 71 | |
| 72 | {{{ |
| 73 | echo "Configurando acceso al disco virtual ogLive, formato IMG"; |
| 74 | cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`; |
| 75 | cat << EOF > /etc/schroot/schroot.conf |
| 76 | [IMGogclient] |
| 77 | type=loopback |
| 78 | file=/var/lib/tftpboot/ogclient/ogclient.img |
| 79 | description=ogclient ubuntu luc IMGi |
| 80 | #priority=1 |
| 81 | users=root |
| 82 | groups=root |
| 83 | root-groups=root |
| 84 | mount-options=-o offset=32256 |
| 85 | root-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 |
| 105 | EOF |
| 106 | echo "Configurando montajes automáticos del sistema ogLive en formato IMG"; |
| 107 | cp /etc/schroot/mount-defaults /etc/schroot/mount-defaults.`getDateTime`; |
| 108 | cat << 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> |
| 114 | proc /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 |
| 121 | EOF |
| 122 | |
| 123 | echo "Fin configuración acceso al ogLive formato IMG"; |
| 124 | |
| 125 | }}} |