Skip to content
Snippets Groups Projects
Commit ee3ede19 authored by davpobl's avatar davpobl
Browse files

Commit inicial

parents
Branches
No related tags found
No related merge requests found
LICENSE 0 → 100644
MIT License
Copyright (c) 2020 David Población
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
# docker-minix2
Permite la ejecución de Minix 2 sobre QEMU en contenedores Docker. Necesario tener instalado `docker` y `docker-compose`.
Crea dos contenedores:
* Uno basado en [QEMU/i386](https://hub.docker.com/r/qemu/i386) con el puerto 5901 abierto para acceder a Minix mediante un visor VNC
* Otro basado en [Debian 10](https://hub.docker.com/_/debian) desde el que se puede montar el sistema de archivos Minix y sincronizar con git.
## Configuración
Variables de entorno:
* debian:
* `GIT_REPO`: repositorio de git. Sin valor por defecto
* `GIT_USER`: usuario de git. Sin valor por defecto
* `GIT_EMAIL`: e-mail de git. Sin valor por defecto
* qemu:
* `RAM_SIZE`: tamaño de la memoria RAM para Minix en MB. Por defecto 16.
## Despliegue
`docker-compose up --build -d`
## Scripts
Existen los siguientes scripts en la carpeta `/home/scripts` de Debian a los que se puede acceder a través de `bash`:
* `runme.sh`: monta, sincroniza, hace push y desmonta el sistema de archivos Minix
* `mount.sh`: monta Minix en `/mnt` y `/mnt/usr`
* `rsync.sh`: sincroniza el sistema de archivos de Minix en `/home/git`
* `git.sh`: añade todos los archivos de `/home/git`, realiza el commit y el push en el repositorio remoto que se especificó
* `umount.sh`: desmonta `/mnt` y `/mnt/usr`. Es posible que falle a veces si se han hecho escrituras en dicho directorio, si es así, ejecutar hasta que se desmonte.
## Uso
Minix se puede acceder a través de un visor VNC desde `127.0.0.1:5901`
### Sincronizar con git
1. Parar el contenedor de QEMU con `docker stop <contenedor>`
2. Ejecutar `bash` en el contenedor con Debian (`docker exec -it <contenedor> bash`)
3. Dentro de la terminal de Debian, ejecutar `sh /home/scripts/runme.sh`
4. Introducir los datos de inicio de sesión
### Añadir archivos a Minix
Es posible añadir archivos locales en Minix a través de Debian, pero solo en el punto de montaje `/mnt/usr`:
1. Parar el contenedor de QEMU con `docker stop <contenedor>`
2. Ejecutar `bash` en el contenedor con Debian (`docker exec -it <contenedor> bash`)
3. Dentro de la terminal de Debian, ejecutar `sh /home/scripts/mount.sh`
4. Añadir los archivos que queramos en `/mnt/usr`. El tamaño de la partición es de unos 44MB.
5. Desmontar con `sh /home/scripts/umount.sh`
\ No newline at end of file
FROM debian:10
MAINTAINER David Población "david.poblacion@alumnos.uva.es"
ENV GIT_REPO $GIT_REPO
ENV GIT_USER $GIT_USER
ENV GIT_EMAIL $GIT_EMAIL
RUN apt-get update
RUN apt-get install git -y
RUN apt-get install wget -y
RUN apt-get install unzip -y
RUN apt-get install rsync -y
RUN wget https://minix1.woodhull.com/pub/contrib/mx204bx01.zip
RUN unzip mx204bx01.zip minix204/minix.img
RUN mv minix204/minix.img /home/minix.img
RUN rm -r minix204
RUN rm mx204bx01.zip
RUN mkdir /home/git
RUN mkdir /mnt/usr
RUN mkdir /home/scripts
COPY mount.sh /home/scripts
COPY git.sh /home/scripts
COPY start.sh /home/scripts
COPY runme.sh /home/scripts
COPY umount.sh /home/scripts
COPY rsync.sh /home/scripts
RUN chmod +x /home/scripts/start.sh
VOLUME /home
ENTRYPOINT sh /home/scripts/start.sh
\ No newline at end of file
#!/bin/bash
apt-get update
apt-get install git -y
mkdir /home/mnt
mkdir /home/mnt/usr
\ No newline at end of file
#!/bin/bash
cd /home/git/mnti
if [ ! -d .git ]; then
git init
git remote add origin $GIT_REPO
git config user.name $GIT_NAME
git config user.email $GIT_EMAIL
fi
git add .
git commit -a --allow-empty-message -m ''
git push origin master
\ No newline at end of file
#!/bin/bash
cp /home/minix.img /home/minix2.img
mount -t minix -o loop,offset=1024 /home/minix2.img /mnt
mount -t minix -o loop,offset=5669888 /home/minix.img /mnt/usr
# los offset se obtienen con fdisk -l y después se multiplican por 512 el comienzodo
\ No newline at end of file
#!/bin/bash
rsync -av \
--hard-links \
--whole-file \
--no-specials \
--chown $(whoami) \
--exclude 'dev' \
--exclude 'etc/ttytab' \
--exclude 'etc/mtab' \
--exclude 'etc/utmp' \
--exclude 'usr/adm' \
--exclude 'boot' \
/mnt /home/git
\ No newline at end of file
#!/bin/bash
sh /home/scripts/mount.sh
sh /home/scripts/rsync.sh
sh /home/scripts/git.sh
sh /home/scripts/umount.sh
\ No newline at end of file
while true; do sleep 1000; done
#!/bin/bash
umount -f /mnt/usr
umount -f /mnt
rm /home/minix2.img
# los offset se obtienen con fdisk -l y después se multiplican por 512 el comienzodo
\ No newline at end of file
version: '3'
services:
debian:
build: ./debian/
privileged: true
environment:
- "GIT_REPO="
- "GIT_USER="
- "GIT_EMAIL="
volumes:
- minix_data:/home
qemu:
build: ./qemu/
volumes:
- minix_data:/home
ports:
- 5901:5901
depends_on:
- debian
volumes:
minix_data:
\ No newline at end of file
FROM qemu/i386
MAINTAINER David Población "david.poblacion@alumnos.uva.es"
ENV RAM_SIZE=16
VOLUME /home
ENTRYPOINT qemu-system-i386 -drive format=raw,file=/home/minix.img,if=ide -m $RAM_SIZE -vnc :1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment