The_Installer - heldersrvio/PureDarwin GitHub Wiki
This page is a "request for comments" related to the general installation process. Please feel free to contribute and comment. Through the general install process the installer should be able to also install itself.
Installing PureDarwin should be a two stage process, as illustrated here.
"Non-interactive mode" will require the user (eg. system admin) to do some extra work. The installer should always automatically attempt to copy non-interactive configuration files from a set location on the boot CD (eg. in /Library/Install/ ) to the target disk. In order to make use of this facility, a boot CD with files in this location should be specially prepared. We can make a root of the install CD, along with the pd_makedmg script, available for download for exactly this purpose.
This leads us to another possibilities, we could also target a type of PureDarwin release installed (e.g., nano, dev, rescue, test/bench, etc..).
Notes: We need to know from where we can put and provide the installation materials and to where the PureDarwin project will be installed. e.g., disk, but we have also: iso and VMware, qemu and other democratised emulation/simulation/virtualisation solution.
An installer script will be needed to guide the user through the first stage installation. A rough idea of how this would work (using the Chameleon bootloader components replacing the standard Darwin ones in /usr/standalone/i386/) is:
Show the user a list of attached drives and ask them to choose one. Show the user a list of partitions on the chosen drive, and ask them to choose one or enter the fdisk interactive partitioner. If the user chose to partition the disk, restart the system so that the changes take effect. Once the user has chosen a disk (number = $disk) and partition (number = $part) to install on, we can ask them for a volume name ($name) to give it, and then without further interaction:
- newfs_hfs -s -J -v [$name] /dev/rdisk[$disk]s[$part]
- dd if=/usr/standalone/i386/boot1h of=/dev/rdisk[$disk]s[$part]
- mount -t hfs /dev/disk[$disk]s[$part] /tmp
- cp /usr/standalone/i386/boot /tmp/ (for MBR)
- tar xfz /usr/standalone/PureDarwinCore.root.tar.gz -C /tmp/
- umount /tmp
- echo 'Remove CD-ROM...'
- shutdown -r now And we're on to the second stage install.
Correctly setting up bootloaders is a tricky business, especially in a multi-boot environment. One of the advantages of this two stage approach is that the user will find out if the system can successfully boot into Darwin before spending time installing (potentially involving lengthy downloads) all the packages needed by a complete system.
Comment: See the boot page for setting up the bootloader
The second stage installer will be designed to run in a Darwin environment, meaning that it will be exactly the same no matter what the first stage installer was.
In this way we will be moving the environment-specific parts of setup into the first stage (of which there will be a few different platform-specific versions), consequently we only need to maintain a single version of the main installation code. It will possibly need access to a network connection, although providing a local cache of packages will make this unnecessary.
"PureDarwin Core" is basically (in minimal PureDarwin installation which automatically runs a setup and install script at boot) allowing the user to add extra packages to. It should be possible for the user to chose not to install anything an be left with a working, bare-bones system.
("PureDarwin Boot" above is a fictional version of Nano equipped with the extra packages needed to run pd_setup)
This is covered on the Package management page.
This will include adding users (a default one is provided if no user account has been created) to the system and some settings.
The choices (configuring details such as the system timezone, preferred language, keyboard layouts, etc...) made by the user at the "pre-configuration" phase let the installation to be finish without the user waiting around..
A final question could be (or not) to fall into a shell or to reboot (on timeout too).