Skip to content

Commit b072dc3

Browse files
Merge pull request #60 from random-archer/dev-plymouth
plymouth support
2 parents b6d2824 + f4c3559 commit b072dc3

File tree

18 files changed

+364
-134
lines changed

18 files changed

+364
-134
lines changed

.azure.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
#
4343
- script: tool/azure/setup.sh
4444
displayName: install deps
45+
#
46+
- script: tool/azure/verify.sh
47+
displayName: verify scripts
4548
#
4649
- template: tool/azure/steps-cache.yml
4750
parameters: # change to reset cache
@@ -69,11 +72,11 @@ jobs:
6972
#
7073
- template: tool/azure/steps-image.yml
7174
parameters:
72-
image_path: test/unitada
75+
image_path: test/nftables
7376
#
7477
- template: tool/azure/steps-image.yml
7578
parameters:
76-
image_path: test/nftables
79+
image_path: test/unitada
7780
#
7881
- bash: machinectl --all --full
7982
displayName: review machines

PKGBUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/mkinitcpio-systemd-tool
66
#
77
# manual package build and install steps:
8-
# * cd ${this_repo}
8+
# * cd "$this_repo"
9+
# * rm -r -f pkg/ *.pkg.tar.xz
910
# * makepkg -e
1011
# * sudo pacman -U *.pkg.tar.xz
11-
# * rm -r -f pkg/ *.pkg.tar.xz
1212
#
1313

1414
pkgname=mkinitcpio-systemd-tool

PKGBUILD.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Developer support: allow local install
5+
#
6+
7+
set -e
8+
9+
this_repo=$(dirname "$0")
10+
11+
# manual package build and install steps:
12+
cd "$this_repo"
13+
rm -r -f pkg/ *.pkg.tar.xz
14+
makepkg -e
15+
sudo pacman -U *.pkg.tar.xz --noconfirm

src/initrd-cryptsetup.path

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@
1010
# this is a twin unit for initrd-cryptsetup.service
1111
# enable only initrd-cryptsetup.path, initrd-cryptsetup.service is activated on demand
1212

13+
# note:
14+
# mutually exclusive with initrd-plymouth.path
15+
1316
# service dependencies:
1417
# https://www.archlinux.org/packages/core/x86_64/cryptsetup/
1518

1619
[Unit]
1720
Description=Initrd Cryptsetup Path
1821
Documentation=https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
1922
ConditionPathExists=/etc/crypttab
23+
ConditionPathExists=/etc/fstab
2024
ConditionPathExists=/etc/initrd-release
2125
DefaultDependencies=no
2226
Conflicts=shutdown.target
@@ -34,7 +38,4 @@ DirectoryNotEmpty=/run/systemd/ask-password
3438
WantedBy=sysinit.target
3539

3640
[X-SystemdTool]
37-
38-
# disable default password agents
39-
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
40-
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes
41+
# not used

src/initrd-cryptsetup.service

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@ After=initrd-shell.service
2424
After=cryptsetup-pre.target
2525
Before=cryptsetup.target
2626
Requires=initrd-shell.service
27+
# note: order to ensure plymouth wins when present
28+
After=plymouth-start.service
29+
# note: plymouthd server intercepts /dev/console tty device
30+
ConditionPathExists=!/run/plymouth/pid
2731

2832
[Service]
29-
ExecStart=/usr/lib/mkinitcpio-systemd-tool/initrd-shell.sh script_entry=service service_name=cryptsetup
33+
# invoke shell as service with "terminal" mode
34+
ExecStart=/usr/lib/mkinitcpio-systemd-tool/initrd-shell.sh script_entry=service service_name=crypto_terminal
3035
Restart=on-failure
3136
RestartSec=1s
3237
# successful crypto unlock is reported as 100
@@ -36,15 +41,25 @@ StandardOutput=inherit
3641
StandardError=inherit
3742
TTYPath=/dev/console
3843

44+
[Install]
45+
# not used: activated on demand
46+
3947
[X-SystemdTool]
4048

49+
# disable default password agents
50+
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
51+
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes
52+
4153
# provision disk tables in initramfs
42-
InitrdPath=/etc/crypttab source=/etc/mkinitcpio-systemd-tool/config/crypttab replace=yes
43-
InitrdPath=/etc/fstab source=/etc/mkinitcpio-systemd-tool/config/fstab replace=yes
54+
InitrdPath=/etc/crypttab source=/etc/mkinitcpio-systemd-tool/config/crypttab replace=yes
55+
InitrdPath=/etc/fstab source=/etc/mkinitcpio-systemd-tool/config/fstab replace=yes
4456

45-
# provide folder for sysroot.mount
57+
# provide folder for sysroot.mount
4658
InitrdPath=/sysroot/ create=yes
4759

60+
# provide folder expected by systemd-cryptsetup
61+
InitrdPath=/run/cryptsetup/ create=yes
62+
4863
# include early swap support
4964
InitrdBinary=/usr/bin/swapon
5065
InitrdBinary=/usr/bin/swapoff
@@ -54,7 +69,7 @@ InitrdBinary=/usr/bin/dmsetup
5469
InitrdCall=add_module dm-crypt
5570
InitrdCall=add_all_modules /crypto/
5671

57-
# include cryptsetup udev rules
72+
# include cryptsetup udev rules
5873
InitrdPath=/usr/lib/udev/rules.d/10-dm.rules
5974
InitrdPath=/usr/lib/udev/rules.d/11-dm-initramfs.rules source=/usr/lib/initcpio/udev/11-dm-initramfs.rules
6075
InitrdPath=/usr/lib/udev/rules.d/13-dm-disk.rules

src/initrd-plymouth.path

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
2+
3+
# Provides crypto+plymouth support in initramfs
4+
# https://wiki.archlinux.org/index.php/plymouth
5+
# https://github.com/freedesktop/plymouth/blob/master/docs/development.txt
6+
7+
# note:
8+
# experimental, see
9+
# * https://github.com/random-archer/mkinitcpio-systemd-tool/issues/59
10+
11+
# note:
12+
# this is a twin unit for initrd-plymouth.service
13+
# enable only initrd-plymouth.path, initrd-plymouth.service is activated on demand
14+
15+
# note:
16+
# requries sd-plymouth in /etc/mkinitcpio.conf::HOOKS
17+
# HOOKS=(base ... systemd sd-plymouth systemd-tool)
18+
19+
# note:
20+
# mutually exclusive with initrd-cryptestup.path
21+
# when both initrd-cryptestup.path and initrd-plymouth.path are
22+
# enabled via `systemctl enable`, kernel command line controls selection:
23+
# `plymouth.enable=0` : will result in activation of initrd-cryptestup.path
24+
# `plymouth.enable=1` : will result in activation of initrd-plymouth.path
25+
26+
# service dependencies:
27+
# https://aur.archlinux.org/packages/plymouth/
28+
29+
[Unit]
30+
Description=Initrd Plymouth Path
31+
Documentation=https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
32+
ConditionPathExists=/etc/crypttab
33+
ConditionPathExists=/etc/fstab
34+
ConditionPathExists=/etc/initrd-release
35+
DefaultDependencies=no
36+
Conflicts=shutdown.target
37+
After=plymouth-start.service
38+
Before=basic.target shutdown.target
39+
Before=paths.target shutdown.target cryptsetup.target
40+
# respect plymouth kernel command line contract
41+
ConditionKernelCommandLine=!plymouth.enable=0
42+
# note: plymouthd server intercepts /dev/console tty device
43+
ConditionPathExists=/run/plymouth/pid
44+
45+
[Path]
46+
# bind to the twin unit
47+
Unit=initrd-plymouth.service
48+
# create monitored folder when missing
49+
MakeDirectory=yes
50+
# activate twin unit when cryptsetup request files are present
51+
DirectoryNotEmpty=/run/systemd/ask-password
52+
53+
[Install]
54+
WantedBy=sysinit.target
55+
56+
[X-SystemdTool]
57+
58+
# inherit cryptsetup resources
59+
InitrdUnit=initrd-cryptsetup.path

src/initrd-plymouth.service

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
2+
3+
# Provides crypto+plymouth support in initramfs
4+
# https://wiki.archlinux.org/index.php/plymouth
5+
# https://github.com/freedesktop/plymouth/blob/master/docs/development.txt
6+
7+
# note:
8+
# this is a twin unit for initrd-plymouth.service
9+
# enable only initrd-plymouth.path, initrd-plymouth.service is activated on demand
10+
11+
# note:
12+
# * switch between plymouthd server text-vs-gui mode by pressing "ESC" key on /dev/console
13+
14+
# service dependencies:
15+
# https://aur.archlinux.org/packages/plymouth/
16+
17+
[Unit]
18+
Description=Initrd Plymouth Service
19+
Documentation=https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
20+
ConditionPathExists=/etc/crypttab
21+
ConditionPathExists=/etc/fstab
22+
ConditionPathExists=/etc/initrd-release
23+
DefaultDependencies=no
24+
After=plymouth-start.service
25+
After=initrd-shell.service
26+
After=cryptsetup-pre.target
27+
Before=cryptsetup.target
28+
Requires=initrd-shell.service
29+
# respect plymouth kernel command line contract
30+
ConditionKernelCommandLine=!plymouth.enable=0
31+
32+
[Service]
33+
# invoke shell as service with "plymouth" mode
34+
ExecStart=/usr/lib/mkinitcpio-systemd-tool/initrd-shell.sh script_entry=service service_name=crypto_plymouth
35+
Restart=on-failure
36+
RestartSec=1s
37+
# successful crypto unlock is reported as 100
38+
RestartPreventExitStatus=100
39+
StandardInput=tty
40+
StandardOutput=inherit
41+
StandardError=inherit
42+
TTYPath=/dev/console
43+
44+
[Install]
45+
# not used: activated on demand
46+
47+
[X-SystemdTool]
48+
49+
# disable default password agents
50+
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-plymouth.path replace=yes create=yes
51+
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-plymouth.service replace=yes create=yes
52+
53+
# plymouth client app
54+
InitrdBinary=/usr/bin/plymouth
55+
56+
# TODO
57+
# remove dependency on sd-plymouth, provision these resources:
58+
# https://aur.archlinux.org/cgit/aur.git/tree/sd-plymouth.initcpio_install?h=plymouth

0 commit comments

Comments
 (0)