=head1 NAME
aa-stage0 - Stage 0: Mounting root file system
=head1 SYNOPSIS
B<aa-stage0>
=head1 DESCRIPTION
B<aa-stage0>(1) is an B<execline> script meant to be used as I<init> inside an
initramfs.
It loads the environment from I</etc/anopa/env> (via B<s6-envdir>), and will log
messages into file I</boot.log>, prefixing them with a TAI timestamp via
B<s6-tai64n>.
It doesn't do much in itself, the bulk of the work being done via services, much
like during system init (stage 1/2). It will simply call B<aa-start>(1) using
I</services> as repodir, and I</etc/anopa/listdirs/onboot> as listdir for
services to start.
Note that this refer to the initramfs itself, so the content of
I</etc/anopa/listdirs/onboot> would differ on that from the system, or more
likely be the same as I</etc/anopa/initramfs/listdirs/onboot> from the root fs.
Services are meant to mount the root file system on to I</root-fs> and mount all
API file systems in there as well: I</root-fs/dev>, I</root-fs/proc>,
I</root-fs/sys> and I</root-fs/run>
It is also up to them to load required kernel modules in order to do so.
After B<aa-start>(1) has run, and if it exists, B<aa-stage0>(1) will execute
I</services/.anopa/post-start> with B<aa-start>(1)'s return code as
argument. This allows to e.g. open a shell if something went terribly wrong.
Note that file descriptor 3 will remain open for writing and connected to the
logger, so anything written there will be timestamped & logged.
For an example, see B<aa-post-stage0>(1)
If "break" was specified on the kernel command line, an interactive shell will
be open. Once you "exit" the shell, process continues.
Then B<aa-stage0>(1) will mount bind the rootfs (of the initramfs) onto
I</root-fs/run/initramfs> (so it's possible to pivot back into it at the end of
stage 3) before doing a mount move of I</root-fs> onto I</> and executing (via
B<aa-chroot>(1)) into I</sbin/init>, or whatever was specified via I<init> on
the kernel command line.