=== Graphical Installer for FreeBSD

Links: +
link:https://people.defora.org/~khorben/FreeBSD/bsdinstall/bsdinstall%20-%20Now%20with%20Graphics!%20-%20AsiaBSDCon%202024%20-%20WIP%20Session.pdf[Slides from AsiaBSDCon 2024] URL: link:https://people.defora.org/~khorben/FreeBSD/bsdinstall/bsdinstall%20-%20Now%20with%20Graphics!%20-%20AsiaBSDCon%202024%20-%20WIP%20Session.pdf[] +
link:https://github.com/khorben/gbsddialog[gbsddialog] URL: link:https://github.com/khorben/gbsddialog[] +
link:https://youtu.be/jm6byc7N2O4[preview video] URL: link:https://youtu.be/jm6byc7N2O4[]

Contact: Pierre Pronchery <pierre@freebsdfoundation.org>

The first hurdle to overcome when testing a new Operating System is to get it installed.
What is more, the first impression new users gather from an Operating System is its installation process.
The state of the art for Operating System installers nowadays definitely involves a graphical process.
This is the case for mainstream systems but also for other UNIX systems comparable to link:https://www.freebsd.org[FreeBSD]: link:https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux[RedHat Enterprise Linux], link:https://ubuntu.com/[Ubuntu], https://www.debian.org[Debian GNU/Linux], or even link:https://www.devuan.org[Devuan GNU+Linux]
Regardless of the technical level of the actual user, this is how the platform will be compared in the public eye.

In practice, FreeBSD has already been derived as a desktop-oriented Operating System by different projects.
Of these, I only found link:https://www.ghostbsd.org[GhostBSD] as a maintained project offering a graphical procedure to install the system.
The objective here was to consider a procedure that FreeBSD could adopt as part of its base system, in order to ship a graphical installer much like the current installer.
However, link:https://ghostbsd-documentation-portal.readthedocs.io/en/latest/user/installation-guide/custom-installation.html#installing-ghostbsd[GhostBSD's installer] relies on a Gtk+ interface driven with Python, implying a hefty footprint on the installation media when adopting FreeBSD's usual image generation procedure.
It would also imply importing and maintaining new projects into the ports tree.

Instead, with knowledge of the current man:bsdinstall[8] and man:bsdconfig[8] utilities, I envisioned a BSD-licensed replacement for man:Xdialog[1].
Just like when invoking bsdconfig with the -X switch for graphical mode, it could be dropped in instead of man:bsddialog[1] and allow graphical installation - while sharing the infrastructure of the current installer.
To avoid confusion with the current implementation of Xdialog from the x11/xdialog port, I have named its replacement man:gbsddialog[1].
It also has to be said that Xdialog is quite obsolete (latest release in 2006) and this shows visually too.

After creating a Proof-of-Concept prototype past the 14.0 release, I was provided with a 2-months window by the link:https://www.freebsdfoundation.org[FreeBSD Foundation], in order to complete a working implementation.
Thanks to a few shortcuts, I was glad to present the outcome of this effort during the WIP session of link:https://2024.asiabsdcon.org/program.html[AsiaBSDCon 2024], including a working graphical installer.

Most of the necessary patches are already available for review in link:https://reviews.freebsd.org[FreeBSD's Phabricator]:

* link:https://reviews.freebsd.org/D44279[D44279 bsdinstall: implement adduser with bsddialog]
* link:https://reviews.freebsd.org/D44280[D44280 bsdinstall: implement rootpass with bsddialog]
* link:https://reviews.freebsd.org/D44670[D44670 bsdinstall: implement timezone with bsddialog]
* link:https://reviews.freebsd.org/D44671[D44671 bsdinstall: allow forcing a specific partitioning mode]
* link:https://reviews.freebsd.org/D44672[D44672 bsdinstall: obtain the dialog binary from $DIALOG]
* link:https://reviews.freebsd.org/D44673[D44673 bsdinstall: handle command-line options in targets]
* link:https://reviews.freebsd.org/D44674[D44674 bsdinstall: add support for graphical mode]

I have tried to keep these patches in growing order of friction expected before integration.

The most important objective of this project was to improve bsdinstall, regardless of the success of this integration.
From the items above, it should be noted that D44279, D44280, D44670 are expecting to improve the general look & feel of the installer, even while in text mode.
Similarly, D44671 and D44672 improve the overall versatility of the installer when scripted or customized.
D44673 and D44674 bring it on par with bsdconfig -X, even allowing the graphical installation of jails.

Some parts are still missing, or made use of shortcuts still unsuitable for integration:

* The "fetchmissingdists" target was avoided by shipping every component on the installation media;
* The "checksum" and "extract" targets had to be re-implemented with simpler code, degrading the user experience also with the regular installer;
* Creation of the installation media generates an additional, heavy image (almost 8 GB), and is suspected to be hindered by a bug in man:makefs[8].

The corresponding code can be found in my link:https://github.com/khorben/freebsd-src/[GitHub fork] in the link:https://github.com/khorben/freebsd-src/tree/khorben/bsdinstall-graphical4[khorben/bsdinstall-graphical4] branch.
As can be guessed from the branch name, depending on the complexity of rebasing operations, combined with the (hopefully) progressive integration of the changes proposed, new branches may be added to keep track of the progress.
(In fact a link:https://github.com/khorben/freebsd-src/tree/khorben/bsdinstall-graphical5[khorben/bsdinstall-graphical5] branch already exists.)

Still, a lot needs to be done for the installer to reach a new level of maturity overall.
While working on this project, I have received general complaints on the installer, and calls for a complete rewrite.
It is true that the current code base suffers from a number of issues and limitations.
The lack of a graphical installer is one of many symptoms, which range from the lack of recovery from errors, of navigability to previous steps, of a general vision of the installation progress, or of a network-based installer.
In the meantime, this is the installer we have and are familiar with, and I think it can still be saved and improved.

Special thanks go to mailto:emaste@FreeBSD.org[Ed Maste] and mailto:jrm@FreeBSD.org[Joe Mingrone] for the opportunity, and to mailto:jadawin@FreeBSD.org[Philippe Audeoud], mailto:tcberner[Tobias C. Berner], mailto:olce@FreeBSD.org[Olivier Certner], mailto:jrtc27@FreeBSD.org[Jessica Clarke], mailto:olivier@FreeBSD.org[Olivier Cochard-Labbé], mailto:bapt@FreeBSD.org[Baptiste Daroussin], mailto:brd@FreeBSD.org[Brad Davis], mailto:dexter@FreeBSD.org[Michael Dexter], mailto:lwhsu@FreeBSD.org[Li-Wen Hsu], mailto:0mp@FreeBSD.org[Mateusz Piotrowski], mailto:asiciliano@FreeBSD.org[Alfonso Siciliano], mailto:manu@FreeBSD.org[Emmanuel Vadot], and mailto:rwatson@FreeBSD.org[Robert Watson] for the feedback, reviews, and encouragements.
(If I missed anyone, you know I did not mean to!)

Sponsor: The FreeBSD Foundation
