Skip to content

Commit e95f37d

Browse files
committed
Add Calamares installer extension
Add new Calamares-based installer extension with configuration for automated Armbian installations, including partition, unpackfs, displaymanager, and shellprocess modules. Signed-off-by: Igor Pecovnik <igor@armbian.com>
1 parent aaad48e commit e95f37d

File tree

9 files changed

+215
-0
lines changed

9 files changed

+215
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Armbian Generic Calamares Installer Extension
3+
4+
function post_repo_customize_image__install_calamares() {
5+
display_alert "Adding calamares package to the image."
6+
do_with_retries 3 chroot_sdcard_apt_get_update
7+
do_with_retries 3 chroot_sdcard_apt_get_install "calamares qtwayland5"
8+
display_alert "Configuring Calamares for any Desktop Environment..."
9+
run_host_command_logged "cp -vr \"${SRC}/extensions/calamares-installer/config/\"* \"$SDCARD/\""
10+
11+
# --- Create the Armbian Branding Directory ---
12+
# Calamares needs a branding directory with a 'branding.desc' file.
13+
# We copy the default theme as a base.
14+
echo "Setting up Calamares branding..."
15+
mkdir -p "${SDCARD}/etc/calamares/branding"
16+
run_host_command_logged "cp -r \"${SDCARD}/usr/share/calamares/branding/default\" \"${SDCARD}/etc/calamares/branding/armbian\""
17+
18+
# --- Fix the Branding Component Name ---
19+
# The copied branding.desc file still contains 'componentName: default'.
20+
# We must change it to 'armbian' to match our directory name and settings.conf.
21+
echo "Updating branding component name to 'armbian'..."
22+
sed -i 's/componentName: default/componentName: armbian/g' "${DEST}/etc/calamares/branding/armbian/branding.desc"
23+
24+
# --- Copy the QML Files ---
25+
# The default branding theme is often incomplete and missing the 'qml' folder.
26+
# We must get the QML files from the global Calamares installation directory.
27+
QML_SOURCE_DIR="${SDCARD}/usr/share/calamares/qml"
28+
QML_BRANDING_DIR="${SDCARD}/etc/calamares/branding/armbian/qml"
29+
30+
if [ -d "$QML_SOURCE_DIR" ]; then
31+
echo "Copying QML files from global directory to branding directory..."
32+
mkdir -p "$QML_BRANDING_DIR"
33+
run_host_command_logged "cp -r \"$QML_SOURCE_DIR\"/* \"$QML_BRANDING_DIR/\""
34+
else
35+
echo "ERROR: Global QML directory not found at $QML_SOURCE_DIR"
36+
echo "The 'calamares' package may be incomplete or broken."
37+
exit 1
38+
fi
39+
chroot_sdcard "chmod +x /usr/libexec/armbian-finalize.sh"
40+
display_alert "Calamares configuration complete."
41+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Calamares Modules Configuration
2+
# This file declares which modules are available for the installer.
3+
# The module names here must match the names used in settings.conf.
4+
5+
# --- UI Modules (shown in the sidebar) ---
6+
# These modules provide the user interface for the installation steps.
7+
8+
- name: welcome
9+
- name: partition
10+
- name: users
11+
- name: summary
12+
- name: finished
13+
14+
# --- Execution Modules (run in the background) ---
15+
# These modules perform the actual work of installing the system.
16+
17+
- name: partition
18+
- name: rsync
19+
- name: machineid
20+
- name: fstab
21+
- name: locale
22+
- name: keyboard
23+
- name: users
24+
- name: displaymanager
25+
- name: packages
26+
- name: grubcfg
27+
- name: bootloader
28+
- name: shellprocess
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Generic Display Manager Configuration for Calamares
2+
# This file works for XFCE (LightDM), GNOME (GDM3), and KDE (SDDM).
3+
4+
# By leaving the list empty, Calamares will auto-detect the display manager
5+
# based on the packages installed in the image.
6+
displaymanagers: []
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
partitionFileSystemType: "ext4"
2+
defaultFileSystemType: "ext4"
3+
# This tells Calamares to create a separate /boot partition
4+
efiSystemPartition: "/boot"
5+
userSwapChoices:
6+
- none
7+
- file
8+
ensureSuspendToDisk: false
9+
allowZfs: false
10+
allowLuksAutomatedPartitioning: false
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This module copies the live filesystem to the target partition.
2+
# It's used when the live system is not a squashfs image.
3+
4+
# The source directory is the root of the live system.
5+
source: "/"
6+
7+
# The destination is the root of the target partition.
8+
destination: ""
9+
10+
# Exclude directories that are created by the kernel or are not meant to be copied.
11+
exclude:
12+
- /proc
13+
- /sys
14+
- /dev
15+
- /run
16+
- /tmp
17+
- /mnt
18+
- /media
19+
- /etc/calamares # Exclude our installer config from the final system
20+
21+
# Additional rsync options for a reliable copy.
22+
rsyncOptions: [ "-a", "-X", "-A", "--numeric-ids", "--info=progress2" ]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dontChroot: false
2+
timeout: 300
3+
script:
4+
- "/usr/libexec/armbian-finalize.sh"
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Calamares Configuration File for Armbian
2+
# This file defines the sequence of modules for the installation process.
3+
4+
# Tells Calamares to look for modules in the 'modules/' subdirectory
5+
# of the configuration directory (/etc/calamares/).
6+
modules-search: [ local ]
7+
8+
# --- Module Instances ---
9+
# This section defines explicit instances for modules that need custom configuration.
10+
# Modules without custom configs can be referenced directly by name in the sequence.
11+
instances:
12+
- id: rsync
13+
module: rsync
14+
config: rsync.conf
15+
- id: partition
16+
module: partition
17+
config: partition.conf
18+
- id: displaymanager
19+
module: displaymanager
20+
config: displaymanager.conf
21+
- id: shellprocess_final
22+
module: shellprocess
23+
config: shellprocess_final.conf
24+
25+
# This is the main installation sequence.
26+
# It is divided into 'show' steps (displayed in the UI) and 'exec' steps (run in the background).
27+
# The order is critical.
28+
sequence:
29+
# --- UI Steps ---
30+
# These modules will be shown to the user in the graphical wizard.
31+
- show:
32+
- welcome # Welcome screen
33+
- partition # Disk partitioning
34+
- users # User creation (username, password, root)
35+
- summary # Pre-installation summary
36+
37+
# --- Execution Steps ---
38+
# These modules perform the actual installation work.
39+
# They run in the background after the user clicks "Install".
40+
- exec:
41+
- partition # Applies the partitioning choices
42+
- rsync # Copies the live filesystem to the target partition
43+
- machineid # Creates a unique machine ID
44+
- fstab # Generates /etc/fstab
45+
- locale # Sets system locale
46+
- keyboard # Sets keyboard layout
47+
- users # Creates the user accounts
48+
- displaymanager # Configures the display manager (if applicable)
49+
- packages # Installs additional packages (if any are defined)
50+
- grubcfg # Prepares GRUB configuration
51+
- bootloader # Installs the bootloader to the MBR/EFI
52+
- shellprocess_final # Runs the final post-installation script
53+
54+
# --- Final UI Step ---
55+
# This module is shown after the installation is complete.
56+
- show:
57+
- finished # Installation finished screen
58+
59+
# --- Global Settings ---
60+
61+
# The branding component name. This MUST match the directory name
62+
# in /etc/calamares/branding/ and the 'componentName' in branding.desc.
63+
branding: armbian
64+
65+
# Prompt the user to continue even if there are non-critical errors.
66+
# Set to 'true' for debugging, 'false' for production.
67+
prompt-install: false
68+
69+
# Set to 'true' to prevent Calamares from chrooting into the target system.
70+
# Most modules require this to be 'false'.
71+
dont-chroot: false
72+
73+
# Set to 'true' to enable OEM mode (for pre-installing systems).
74+
oem-setup: false
75+
76+
# UI/UX settings
77+
disable-cancel: false
78+
disable-cancel-during-exec: false
79+
hide-back-and-next-during-exec: false
80+
81+
# Set to 'true' to automatically close Calamares after a successful installation.
82+
quit-at-end: false
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
echo "--- Running Armbian Finalization Script ---"
3+
4+
if [ -f /usr/lib/armbian/armbian-install ]; then
5+
echo "Executing armbian-install to configure the bootloader..."
6+
/usr/lib/armbian/armbian-install
7+
else
8+
echo "ERROR: /usr/lib/armbian/armbian-install not found!"
9+
exit 1
10+
fi
11+
12+
echo "--- Armbian Finalization Complete ---"
13+
exit 0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Install Armbian
4+
Comment=Install this system permanently to your disk
5+
Exec=pkexec /usr/bin/calamares
6+
Icon=system-software-install
7+
Terminal=false
8+
Categories=System;
9+
StartupNotify=true

0 commit comments

Comments
 (0)