lukechilds / dockerpi

A Virtualised Raspberry Pi inside a Docker image

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Autologin and/or boot script support

mik13ST opened this issue · comments

Should this tool support autologin? I'd like to use this image in an automated build environment and having to log in manually or having to patch the raspbian image to enable autologin is cumbersome.

Of course it's possible, but should it be done? Is this tool supposed to be used like this? I guess this is more of a raspbian issue than an issue of this project. What is your opinion?

It's not currently possible with this project but I absolutely feel your pain!

I've had similar needs and do have plans to modify dockerpi to support this in the future.

I imagine it working something like this:

docker run -v mysetupscript.sh:/setup.sh lukechilds/dockerpi:image-builder > myos.img

This would then pull down a Raspbian (or something else) image, boot it with QEMU, execute your script to apply your changes, shut down, then spit out the resulting image.

It's not urgent for me so no idea when I'll get round to it, feel free to have a go at implementing it.

In the meantime, have you seen @meeDamian's https://github.com/meeDamian/raspbian?

It allows you to write a script to /boot/firstboot.sh that will be executed on first boot.

In the meantime, have you seen @meeDamian's https://github.com/meeDamian/raspbian?

It allows you to write a script to /boot/firstboot.sh that will be executed on first boot.

Wonderful, that would be the next thing I would need. It turns out I no longer need autologin with that firstboot.sh script execution before login (multi-user-target.wants). I am currently using the manual method of that tool because I have a locally customized image already. Injecting this script into the raspbian image booted by dockerpi basically gives me provisioning (a term I know from Vagrant) which suits my purpose.

So I guess some kind of support for provisioning like this would be nice.

I don't actually need dockerpi to build customized raspbian images (yet).

Just for future investigation.

I tried to add the following code to the entrypoint.sh but it can't mount loop device inside busybox or alpine inside docker. Maybe you will have more luck with it)

https://gist.github.com/kafeg/ed183f50b0cb975f5ac2a83347ccda31

So i returned to solution where ubuntu host is required:

  • run dockerpi once to extract filesystem.img
  • kill running container with delay
  • unpack filesystem.img on host using mountimg.sh from link above
  • add there service and script files, execute some commands to install service
  • umount
  • boot dockerpi again - it should execute everything from the script

But in this way I can't for e.g. using Windows or MacOS host, i should use Ubuntu or other Linux with sfdisk executable.

I use this container with expect to build customised raspbian images. The project is here and the blog post here

Hey guys. I made a simple script to create custom images: https://gist.github.com/kafeg/93d8057cf32e249d91da332449016eb4