maxnet / berryboot

Berryboot -- Boot menu / OS installer
http://www.berryboot.com/
Other
807 stars 133 forks source link

use own script before OS is loaded.... #567

Open codekoch opened 5 years ago

codekoch commented 5 years ago

Hi, I build a system for schools based on berryboot (http://mediakit.education). Two questions:

  1. Is there any possibility to use a selfmade script (i.e. checking for an update on usb-stick etc.) before the imagefile and the data of the OS are loaded?
  2. Is there any command to force a reset of OS image? At the moment I delete the data files within the already started OS, but this is not the optimal solution....

Thx in advance.

macmpi commented 5 years ago

Yes, create a berryboot-init sh file and add it to the root of your squash image. mksquashfs ./berryboot-init my_image.sqsh It will be run as your image is mounted, before actual switch_root initiates the OS.

codekoch commented 5 years ago

OK. But the problem is that i have to switch off the script sometimes for testing and manipulate the OS. The script is only for updating and resetting the OS.

macmpi commented 5 years ago

Maybe looking at my scripts enabling self-update/reset for some popular distribution images (Volumio2/LibreELEC/Lakka) may help you for what you are trying to achieve.

Quite a hack-ish way to self-copy & reroute the init execution with berryboot-init, so that image can then be unmounted, replaced, relaunched... Would be nice if berryboot could offer a clean mechanism to do such things, but works well so far.

codekoch commented 5 years ago

I tried it with a tiny script:

!/bin/busybox sh

echo "Hello?" read -n

And i added it to my image with mksquashfs ./berryboot-init my_image.img

But nothing happens....no "Hello" appears during boot :-(

I guess I unterstand something wrong...

Need more help...

maxnet commented 5 years ago

It does print "Executing init script" during boot? If not it did not find your /berryboot-init file.

codekoch commented 5 years ago

No, it does'nt print "Executing init script" . But mksquashfs ./berryboot-init my_image.img copied the berryboot-init file....

macmpi commented 5 years ago

@codekoch which berryboot version are you using? I remember some early september 2018 release had troubles with locating berryboot-init file. But it has been fixed since (latest Dec 2018 is fine).