reworking sysinst

Marc Balmer <[email protected]>
Newsgroups gmane.os.netbsd.devel.installation
Organization The NetBSD Foundation
Message-ID <[email protected]>
Extending sysinst, the NetBSD system installer, or changing the
installation process, e.g. to install custom software, is quite a
complex task since in sysinst everything down to the displayed messages
is hardcoded in C.  It is a monolithic installer, without the
possibility to change the installation process or add extensions in a
modular way.

I have started to rework sysinst (based on software we use at my company
since several years) with the following goals:

- Provide an installer that is compatible with what we have now, i.e. no
changes in the installation process and no surprises.

- Make it easy to change or extend the installation process, e.g. to
install pkgsrc packages during the install process, and maybe even
configure the installed software.

- Modularize sysinst.  Not only changing the installation process should
be easy, but it should also be easy to add a module, e.g. to customize
the system after the standard installation has run.

To achieve these goals, I broke up sysinst in two parts:

- A "backend" part written in C, that contains the current installation
functionality, the messages and menu system.  This is more or less the
current sysinst binary with the addition of a Lua interpreter.  The core
functionality of sysinst is exposed to Lua by means of a C/Lua binding.

- A "frontend" part, written in Lua, that drives the installation
process.  The Lua script uses functionality provided by the "backend" to
do it's job.

The communication between the "frontend" and "backend" is
bi-directional:  The Lua scripts calls functions written in C, but the
backend functions in C can also call Lua functions, e.g. to let a Lua
script take over part of a certain installation step.

For the time being, most of the Lua specific code is in #ifdef
LUA/#endif brackets and there is no Lua script being put on the install
media.

The following parts of the source tree need changes

msgc(1): A function msg_printf() is added to print a raw message,
without the need to define it in the message files.  (Lua uses it's own
(unfinished) mechanism to do i18n.)

sysinst: Addition of a Lua interpreter, initialize it, provide bindings
to sysinst functions, call-back into Lua code

ramdisk kernels: The crunched binary needs to be linked against the Lua
library, the default Lua installer script needs to be put on the ramdisk.

I have an initial diff against -current as a starting point, it survived
a full release build on i386 but it will break other architectures due
to the Lua library not being linked to the ramdisk binary.

The diff is at http://www.netbsd.org/~mbalmer/diffs/, it's versioned and
I will update it from time to time.

Contributions to this project are very welcome!

- Marc Balmer

PS:  sysinst is also the topic of some proposed projects, maybe these
can easier be handled when sysinst has Lua support:

http://wiki.netbsd.org/projects/project/sysinst_pkgs/
http://wiki.netbsd.org/projects/project/sysinst-enhancements/
http://wiki.netbsd.org/projects/project/sysinst-xinterface/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.