[Freedombox-discuss] Sharebox and tools for generating FreedomBox images

Lars Wirzenius liw at liw.fi
Mon May 30 18:20:12 UTC 2011


Back in August, I outlined a series of milestones for FreedomBox
development, labeled alpha 0, 1, 2, etc. The purpose of alpha 0 
was to find or develop a set of tools to generate system (disk) 
images, which seems to me an essential step.

I played with some tools, e.g., live-build, but did not find
something to my liking. I've now written one of my own, in
the hope that it suffices for now, until something good comes
along.

    https://gitorious.org/vmdebootstrap
    
vmdebootstrap works on Debian stable, and generates a disk
bootable image for i386 or amd64, and needs to be run on one of
those architectures. It does not yet work support other 
architectures, but it might get that later.

vmdebootstrap creates the image without running anything in
a virtual machine, just in a chroot. You will need my cliapp 
Python library, from http://liw.fi/cliapp/ .

The generated image is a RAW disk image (sparse file) which
can be used directly with kvm, qemu, and other virtualization
solution, though you may need to use qemu-img to convert it to
a suitable format. It also works directly if you write it to a 
raw disk device, such as a USB memory stick or hard disk.
(Write image on stick/disk with dd, boot off the stick/disk.)

The attached two scripts demonstrate how this might be used:
"sharebox" generates the disk image, and it uses
"sharebox-customize" to make custom changes to the image.
In this example, the generated system provides a world-readable
and world-writeable (no passwords) Windows SMB disk share,
called SHAREBOX. Boot the generated image and you can share
files, no configuration needed.

To test the image, I did this: I used virt-manager to create
a new virtual machine, and use the generated image as its disk
image, rather than creating a new image in virt-manager.
virt-manager also set up NAT networking, which means I can
access the SHAREBOX with Nautilus from the host (go to 
Places/Network), but it isn't visible outside the host.

I'm not distributing the generated disk image, but with
anyone can re-create it, and therefore also easily make 
changes to it. This will hopefully make it easy for 
people to start experimenting with making prototypes for 
FreedomBox. (If everyone distributes their prototypes as
a pair of scripts, like I've done, it'll be easy for everyone
else to see what's going on, unlike when a full image is
distributed.)

(You do need speedy access to a Debian mirror, or much patience. 
If this proves to be problematic, it may be a good idea to 
distribute copies of the mirror using DVDs or USB hard drives 
and the postal system. With my local mirror, even on my laptop
it only takes a few minutes to generate the sharebox image.)

Happy hacking.

PS. Thanks to Steve Langasek for helping me with Samba
configuration.

-- 
Freedom-based blog/wiki/web hosting: http://www.branchable.com/
-------------- next part --------------
#!/bin/sh

set -e

/home/liw/vmdebootstrap/vmdebootstrap/vmdebootstrap \
    --log sharebox.log \
    --log-level debug \
    --image sharebox.img \
    --hostname sharebox \
    --size 1G \
    --verbose \
    --enable-dhcp \
    --package ssh \
    --package samba \
    --mirror http://mirror.lan/debian/ \
    --customize ./sharebox-customize \
    --root-password=password1



More information about the Freedombox-discuss mailing list