From 955013af5b9d89fd3f663f7018e3a5b4d27d203f Mon Sep 17 00:00:00 2001 From: Lucas van Lierop Date: Tue, 2 Feb 2016 20:10:35 +0100 Subject: [PATCH 1/2] Attempt to run asm raffler in docker --- build.sh | 1 + jaytaph-bootsector-asm/Dockerfile | 36 +++++++++++++++++++++++++++++++ jaytaph-bootsector-asm/install.sh | 14 ------------ jaytaph-bootsector-asm/vboxrun.sh | 17 +++++++++++++++ raffle.sh | 2 +- 5 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 jaytaph-bootsector-asm/Dockerfile mode change 100644 => 100755 jaytaph-bootsector-asm/vboxrun.sh diff --git a/build.sh b/build.sh index 90cfc3d..a138f74 100755 --- a/build.sh +++ b/build.sh @@ -8,3 +8,4 @@ docker build -t basbl_zsh_raffler basbl-zsh docker build -t lucasvanlierop_cobol_raffler lucasvanlierop-cobol docker build -t rjkip_elixir_raffler rjkip-elixir docker build -t sgoettschkes_haskell_raffler sgoettschkes-haskell +docker build -t jaytaph_bootsector_asm_raffler jaytaph-bootsector-asm diff --git a/jaytaph-bootsector-asm/Dockerfile b/jaytaph-bootsector-asm/Dockerfile new file mode 100644 index 0000000..517820d --- /dev/null +++ b/jaytaph-bootsector-asm/Dockerfile @@ -0,0 +1,36 @@ +FROM jencryzthers/vboxinsidedocker +MAINTAINER lucas@vanlierop.org + +#ENV LANG C.UTF-8 +#ENV DEBIAN_FRONTEND noninteractive + +# Create working dir +RUN mkdir -p /var/app +COPY . /var/app +WORKDIR /var/app + +# The virtualbox driver device must be mounted from host +VOLUME /dev/vboxdrv + +# Install dependencies +#RUN apt-get update +#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget +RUN DEBIAN_FRONTEND=noninteractive apt-get install -yy dosfstools mtools nasm + +# Install virtual box +#RUN sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian wily contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" +#RUN wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add - +#RUN apt-get update +#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y virtualbox-5.0 dkms +#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y linux-headers-generic + +RUN apt-get install dkms +RUN sudo /etc/init.d/vboxdrv setup + +RUN dpkg-reconfigure virtualbox-dkms +RUN dpkg-reconfigure virtualbox +RUN modprobe vboxdrv +RUN modprobe vboxnetflt + +# Run raffler +CMD ["/var/app/vboxrun.sh"] diff --git a/jaytaph-bootsector-asm/install.sh b/jaytaph-bootsector-asm/install.sh index fb37916..d970ed9 100644 --- a/jaytaph-bootsector-asm/install.sh +++ b/jaytaph-bootsector-asm/install.sh @@ -4,20 +4,6 @@ # This stuff uses linux. Deal with it! # -sudo apt-get -yy install dosfstools mtools nasm -# Creates an empty 1.44MB floppy image -dd if=/dev/zero of=mr_floppy.img bs=512 count=2880 - -# Format it -sudo mkfs.msdos mr_floppy.img - -mcopy -i mr_floppy.img ../example_names ::/NAMES.DAT -mdir -i mr_floppy.img - -nasm -o bootsector.img raffler.S - -# copy bootsector to the start of the floppy image -dd if=bootsector.img of=mr_floppy.img bs=512 count=1 conv=notrunc # Mr Floppy is finished, run vboxrun.sh or some other way to get it running diff --git a/jaytaph-bootsector-asm/vboxrun.sh b/jaytaph-bootsector-asm/vboxrun.sh old mode 100644 new mode 100755 index 1430619..3ac32ea --- a/jaytaph-bootsector-asm/vboxrun.sh +++ b/jaytaph-bootsector-asm/vboxrun.sh @@ -1,5 +1,22 @@ #!/bin/sh +# Creates an empty 1.44MB floppy image +dd if=/dev/zero of=mr_floppy.img bs=512 count=2880 + +# Format it +mkfs.msdos mr_floppy.img + +mcopy -i mr_floppy.img /var/names/current ::/NAMES.DAT +mdir -i mr_floppy.img +nasm -o bootsector.img raffler.S + +# copy bootsector to the start of the floppy image +dd if=bootsector.img of=mr_floppy.img bs=512 count=1 conv=notrunc + +#bochs -f bochsrc -q + +#/sbin/vboxconfig + VBM=`which VBoxManage` TS=`date +"%s"` diff --git a/raffle.sh b/raffle.sh index eb63643..e5bd58e 100755 --- a/raffle.sh +++ b/raffle.sh @@ -11,7 +11,7 @@ NAMES_FILE=`realpath $WORKING_DIR/$1` cp $NAMES_FILE $NAMES_DIR/current # Raffle a raffler ;-) -declare -a RAFFLER_NAMES=('basbl_zsh' 'lucasvanlierop_cobol' 'rjkip_elixir' 'sgoettschkes_haskell' 'shawnmccool_scala') +declare -a RAFFLER_NAMES=('basbl_zsh' 'lucasvanlierop_cobol' 'rjkip_elixir' 'sgoettschkes_haskell' 'shawnmccool_scala' 'jaytaph_bootsector_asm' ) RANDOM_RAFFLER=${RAFFLER_NAMES[$RANDOM % ${#RAFFLER_NAMES[@]} ]} # run raffler in container with names dir mounted From 6164b49b35f80517b41ee35b3e6749d09e0d2ada Mon Sep 17 00:00:00 2001 From: Lucas van Lierop Date: Wed, 3 Feb 2016 21:44:46 +0100 Subject: [PATCH 2/2] Still not working but getting closer --- jaytaph-bootsector-asm/Dockerfile | 27 ++++----------------------- jaytaph-bootsector-asm/install.sh | 9 --------- jaytaph-bootsector-asm/vboxrun.sh | 6 +----- raffle.sh | 3 ++- 4 files changed, 7 insertions(+), 38 deletions(-) delete mode 100644 jaytaph-bootsector-asm/install.sh diff --git a/jaytaph-bootsector-asm/Dockerfile b/jaytaph-bootsector-asm/Dockerfile index 517820d..9016fd3 100644 --- a/jaytaph-bootsector-asm/Dockerfile +++ b/jaytaph-bootsector-asm/Dockerfile @@ -1,36 +1,17 @@ FROM jencryzthers/vboxinsidedocker MAINTAINER lucas@vanlierop.org -#ENV LANG C.UTF-8 -#ENV DEBIAN_FRONTEND noninteractive +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND noninteractive # Create working dir RUN mkdir -p /var/app COPY . /var/app WORKDIR /var/app -# The virtualbox driver device must be mounted from host -VOLUME /dev/vboxdrv - # Install dependencies -#RUN apt-get update -#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget -RUN DEBIAN_FRONTEND=noninteractive apt-get install -yy dosfstools mtools nasm - -# Install virtual box -#RUN sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian wily contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" -#RUN wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add - -#RUN apt-get update -#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y virtualbox-5.0 dkms -#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y linux-headers-generic - -RUN apt-get install dkms -RUN sudo /etc/init.d/vboxdrv setup - -RUN dpkg-reconfigure virtualbox-dkms -RUN dpkg-reconfigure virtualbox -RUN modprobe vboxdrv -RUN modprobe vboxnetflt +RUN apt-get update +RUN apt-get install -yy dosfstools mtools nasm # Run raffler CMD ["/var/app/vboxrun.sh"] diff --git a/jaytaph-bootsector-asm/install.sh b/jaytaph-bootsector-asm/install.sh deleted file mode 100644 index d970ed9..0000000 --- a/jaytaph-bootsector-asm/install.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# -# This stuff uses linux. Deal with it! -# - - - -# Mr Floppy is finished, run vboxrun.sh or some other way to get it running diff --git a/jaytaph-bootsector-asm/vboxrun.sh b/jaytaph-bootsector-asm/vboxrun.sh index 3ac32ea..e6f3cf5 100755 --- a/jaytaph-bootsector-asm/vboxrun.sh +++ b/jaytaph-bootsector-asm/vboxrun.sh @@ -13,10 +13,6 @@ nasm -o bootsector.img raffler.S # copy bootsector to the start of the floppy image dd if=bootsector.img of=mr_floppy.img bs=512 count=1 conv=notrunc -#bochs -f bochsrc -q - -#/sbin/vboxconfig - VBM=`which VBoxManage` TS=`date +"%s"` @@ -32,7 +28,7 @@ $VBM storagectl "$BOXNAME" --name "Mr Floppy Controller" --add floppy $VBM storageattach "$BOXNAME" --storagectl "Mr Floppy Controller" --port 0 --device 0 --type fdd --medium mr_floppy.img # Run the machine (you can reset the machine manually to raffle a new user!) -$VBM startvm "$BOXNAME" --type=gui +VBoxHeadless -s "$BOXNAME" diff --git a/raffle.sh b/raffle.sh index e042513..a7dfdbc 100755 --- a/raffle.sh +++ b/raffle.sh @@ -13,10 +13,11 @@ cp $NAMES_FILE $NAMES_DIR/current # Raffle a raffler ;-) declare -a RAFFLER_NAMES=('basbl_zsh' 'lucasvanlierop_cobol' 'rjkip_elixir' 'sgoettschkes_haskell' 'shawnmccool_scala' 'aochagavia_rust' 'jaytaph_bootsector_asm' ) RANDOM_RAFFLER=${RAFFLER_NAMES[$RANDOM % ${#RAFFLER_NAMES[@]} ]} +RANDOM_RAFFLER="jaytaph_bootsector_asm" # run raffler in container with names dir mounted CONTAINER_NAME="${RANDOM_RAFFLER}_raffler" echo -e "Raffling using \033[91m$RANDOM_RAFFLER\e[0m" echo -e "\033[92mAnd the winner is: " -docker run -v $NAMES_DIR:/var/names $CONTAINER_NAME +docker run -v $NAMES_DIR:/var/names -v /dev/vboxdrv:/dev/vboxdrv $CONTAINER_NAME echo -e "\e[0m"