opened 09:49PM - 28 May 18 UTC
closed 12:15AM - 30 May 19 UTC
feature request
I'm unsure if this is the right place to bring this up, but the subreddit did no…t seem appropriate.
I am in the planning stages for a linux distro and I would like to use distinst as the main method to install it. I have a tiny problem though: my distro is based on NixOS, a distro that is hightly irregular in many ways. Distinst seems to be geared closely to the Ubuntu installation process: make partitions, unpack, copy files, chroot, configure, install bootloader, and exit. NixOS follows a different process: make partitions, generate configuration, configure system, copy generated configuration files to target, copy package repository to target, chroot, activate configuration (which automatically notices that the bootloader is missing and installs it), prompt for a new root password, and exit.
I propose some method to insert stages into the distinst process without major rewrites. Perhaps some support for bash scripting with hooks? Like so:
```
hooks/
post-partition.sh # I can generate the configuration files here
pre-extract.sh # I can build a system configuration here
extract.sh # I can copy the generated system configuration and package repo here
configure.sh # Run from within the chroot. Here I can activate the configuration
bootloader.sh # This won't do anything, but since the file exists distinst will execute this instead of doing anything with the bootloader. This effectively skips the bootloader stage
post-bootloader.sh # Run from outside the chroot. Here, I can open up a dialog that will prompt for a root password (I'm aware that having a root password set isn't the best of ideas, but it will be necessary during the early stages of development for my distro).
```
Distinst could execute these scripts instead of doing its part for each stage where a script exists. It would be reasonable that each script should preform the action that distinst expects to avoid breakage. In other words, it would be reasonable for distinst to expect files in the target after the extract phase, and the target should be able to be chrooted into. If any of the scripts exit with a nonzero exit code, the installation should be declared failed with a generic error message like "post-partition phase failed", unless there could be some way to relay exact error info to distinst.
The scripts can either be loaded in from a hard-coded location in the repository (and distros can fork distinst to include them), or be included through the Config object, kind of like the squashfs location is defined by the installer frontend. Allowing a variable path would be easier to deal with, at least in my case.
This system would also require some extra status codes/steps that distinst can handle. Distos like mine could then very simply edit a few lines in the various installer frontends to display custom text where necessary.
Here is an example from the elementary installer. This is what it looks like now:
```
switch (status.step) {
case Distinst.Step.PARTITION:
progressbar_label.label = _("Partitioning Drive");
break;
case Distinst.Step.EXTRACT:
fraction += 2*(1.0/NUM_STEP);
progressbar_label.label = _("Extracting Files");
break;
case Distinst.Step.CONFIGURE:
fraction += 3*(1.0/NUM_STEP);
progressbar_label.label = _("Configuring the System");
break;
case Distinst.Step.BOOTLOADER:
fraction += 4*(1.0/NUM_STEP);
progressbar_label.label = _("Finishing the Installation");
break;
}
```
This is what my distro would have to patch it to:
```
switch (status.step) {
case Distinst.Step.PARTITION:
progressbar_label.label = _("Partitioning Drive");
break;
case Distinst.Step.POST_PARTITION:
fraction += 2*(1.0/NUM_STEP);
progressbar_label.label = _("Generating configuration files");
break;
case Distinst.Step.PRE_EXTRACT:
fraction += 3*(1.0/NUM_STEP);
progressbar_label.label = _("Configuring the System");
break;
case Distinst.Step.EXTRACT:
fraction += 4*(1.0/NUM_STEP);
progressbar_label.label = _("Copying Files");
break;
case Distinst.Step.CONFIGURE:
fraction += 5*(1.0/NUM_STEP);
progressbar_label.label = _("Activating the System Configuration");
break;
case Distinst.Step.BOOTLOADER:
fraction += 6*(1.0/NUM_STEP);
progressbar_label.label = _("Finishing the Installation");
break;
}
```
What are your thoughts on such a system? I believe that it could make distinst much more compatible with obscure and nonstandard Linux distros, while giving many of them capable and good-looking installers.
Thank you for your consideration