Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env sh
get_vbox_version(){
local VER
VER=$(VBoxManage -v | awk -F "r" '{print $1}')
if [ -z "$VER" ]; then
echo "ERROR"
else
echo "$VER"
fi
}
write_vbox_dockerfile(){
local VER
VER=$(get_vbox_version)
if [ ! "$LATEST_RELEASE" = "ERROR" ]; then
sed "s/\$VBOX_VERSION/$VER/g" Dockerfile.tmpl > Dockerfile
else
echo "WUH WOH"
fi
}
write_vbox_dockerfile
docker build -t="my-boot2docker" .
docker run -i -t --rm my-boot2docker > boot2docker.iso
# $VBOX_VERSION should probably be something like 4.3.10 or somesuch
#
FROM boot2docker/boot2docker
RUN apt-get install p7zip-full
RUN mkdir -p /vboxguest && \
cd /vboxguest && \
curl -L -o vboxguest.iso http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso && \
7z x vboxguest.iso -ir'!VBoxLinuxAdditions.run' && \
sh VBoxLinuxAdditions.run --noexec --target . && \
mkdir x86 && cd x86 && tar xvjf ../VBoxGuestAdditions-x86.tar.bz2 && cd .. && \
mkdir amd64 && cd amd64 && tar xvjf ../VBoxGuestAdditions-amd64.tar.bz2 && cd .. && \
cd amd64/src/vboxguest-$VBOX_VERSION && KERN_DIR=/linux-kernel/ make && cd ../../.. && \
cp amd64/src/vboxguest-$VBOX_VERSION/*.ko $ROOTFS/lib/modules/$KERNEL_VERSION-tinycore64 && \
mkdir -p $ROOTFS/sbin && cp x86/lib/VBoxGuestAdditions/mount.vboxsf $ROOTFS/sbin/
RUN echo "" >> $ROOTFS/etc/motd; \
echo " boot2docker with VirtualBox guest additions version $VBOX_VERSION" >> $ROOTFS/etc/motd; \
echo "" >> $ROOTFS/etc/motd
RUN depmod -a -b $ROOTFS $KERNEL_VERSION-tinycore64
RUN /make_iso.sh
CMD ["cat", "boot2docker.iso"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.