Linux Installer

Linux is an operation system that does not have its own ecosystem, but it is delivered by many distributions. Some of these distributions have their own installers and some others use or inherit them. The SDM framework provides a icustomizable base installer for all Linux installers. The following section deals with the structure and the function of this installer image.

General information

The SDM Linux installer based on a small netboot image of the Alpine Linux distribution and contains tools for some standard tasks like disk preparation and some custom tools for installing a special distribution.

Here is an overview about the installers of some important Linux distributions and their derivates:

Customization of the installer

The system root role has a tasklist named installer which is reponsible for creating an installer within specialised system roles. The specialised system role for Linux and the base of all Linux based distributions is system.linux. This role provides two further tasklists which are needed for the customization of an Linux installer. These tasklist are:

The creation of installers for Linux based distributions must execute the inherited buildinstaller tasks before placing the distribution-specific tools and files. The script runinstaller.sh which in performs the distribution-specific installation must be placed in the directory <linux_build_installer_root>/opt/ with execution permissions.

Installation process

The installation process starts after the boot process with partitioning, formatting and mounting the target disks. The root partition is mounted on the directory /target. Afterwards, the distribution-specific installation is permed via the script runinstaller.sh. This script basically has to install and activate the Python interpreter and the OpenSSH server. Furthermore, it also has to configure the network settings. Finally the autogenerated file fstab is placed, the SSH files authorized_keys and sshd_config are adjusted and the system is rebooted.

Structure of the answer file

The answer file of the Linux installer is a simple shell script that exports the system-specific data as variables to the shell environment. The file is fetched when the installer is started and saved under /tmp/answerfile. The data contained are:

Function API

The SDM framework provides a collection of useful shell functions for the Linux installer. These are located in the file /opt/functions.sh. The following section documents the available functions.

installPackages(package1 [.. [packageN]])

This wrapper function installs Alpine Linux package from a Alpine Linux mirror server.

Parameter:

Return: It returns 0 on success. Otherwise 1.

getAnswerfile(baseurl, localpath)

The function getAnswerfile fetchs the answer file from a base URL and saves it under a local path.

Parameter:

Return: It returns 0 on success. Otherwise 1.

runChroot(script)

This function changes the root directory to /target and executes a specified script. Before the chroot command is executed, some virtual device such as proc, sysfs and devpts are mounted. These are unmount again after the execution. Furthermore, the answer file is copied to the new root directory. It is also automatically delete again.

Parameter:

Return: none

beginLogEntry(msg)

The function beginLogEntry starts a new log entry.

Parameter:

Return: none

Hint:

finishLogEntry(msgresult)

The function finishLogEntry finishes a log entry.

Parameter:

Return: none

Hint: