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.
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:
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:
linux_build_installer_root
.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.
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.
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:
DISTRIBUTION: name of the distribution to be installed (see os.distribution
)
RELEASE: release of the distribution to be installed (see os.release
)
ARCH: architecture of the distribution to be installed (see os.architecture
)
MIRROR: used mirror server of the distribution for the installation (see system_local_mirror
and system_home_mirror
)
LOCALE: the locale of the target system (see locale
)
KEYMAP: the keymap of the target system (see keymap
)
TIMEZONE: the timezone of the target system (see timezone
)
DISK_DEVICES: a list of all managed disk devices. example: DISK_DEVICES=(‘sda’ ‘sdb’)
DISK_<device name>_SCHEME: the scheme of the disk device. example: DISK_SDA_SCHEME=“gpt”
DISK_<device name>_PARTITIONS: a list with the data of all partitions of a disk. Each entry has semi-colon seperated format with following data sorted by field:
true
) or not (false
)boot
to mark a bootable diskExample: DISK_SDA_PARTITIONS=(“10G;ext4;/;ro;0;0;true;boot” “2G;swap;;;0;0;false;”)
NETIF_DEVICES: a list of all managed network devices. example: DISK_DEVICES=(’eth0’ ’eth1’)
NETIF_<device name>: a list with the data of a network device. The value has semi-colon seperated format with following data sorted by field:
true
) or not (false
)Example: NETIF_ETH0=“10.0.2.20;255.255.255.0;24;fd12:3456:789a:1::20;64;false”
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.
This wrapper function installs Alpine Linux package from a Alpine Linux mirror server.
Parameter:
Return: It returns 0 on success. Otherwise 1.
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.
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
The function beginLogEntry
starts a new log entry.
Parameter:
Return: none
Hint:
The function finishLogEntry
finishes a log entry.
Parameter:
Return: none
Hint: