Skip to content

Commit

Permalink
Merge pull request #60 from random-archer/dev-plymouth
Browse files Browse the repository at this point in the history
plymouth support
  • Loading branch information
Andrei-Pozolotin authored Apr 19, 2020
2 parents b6d2824 + f4c3559 commit b072dc3
Show file tree
Hide file tree
Showing 18 changed files with 364 additions and 134 deletions.
7 changes: 5 additions & 2 deletions .azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
#
- script: tool/azure/setup.sh
displayName: install deps
#
- script: tool/azure/verify.sh
displayName: verify scripts
#
- template: tool/azure/steps-cache.yml
parameters: # change to reset cache
Expand Down Expand Up @@ -69,11 +72,11 @@ jobs:
#
- template: tool/azure/steps-image.yml
parameters:
image_path: test/unitada
image_path: test/nftables
#
- template: tool/azure/steps-image.yml
parameters:
image_path: test/nftables
image_path: test/unitada
#
- bash: machinectl --all --full
displayName: review machines
Expand Down
4 changes: 2 additions & 2 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/mkinitcpio-systemd-tool
#
# manual package build and install steps:
# * cd ${this_repo}
# * cd "$this_repo"
# * rm -r -f pkg/ *.pkg.tar.xz
# * makepkg -e
# * sudo pacman -U *.pkg.tar.xz
# * rm -r -f pkg/ *.pkg.tar.xz
#

pkgname=mkinitcpio-systemd-tool
Expand Down
15 changes: 15 additions & 0 deletions PKGBUILD.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

#
# Developer support: allow local install
#

set -e

this_repo=$(dirname "$0")

# manual package build and install steps:
cd "$this_repo"
rm -r -f pkg/ *.pkg.tar.xz
makepkg -e
sudo pacman -U *.pkg.tar.xz --noconfirm
9 changes: 5 additions & 4 deletions src/initrd-cryptsetup.path
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
# this is a twin unit for initrd-cryptsetup.service
# enable only initrd-cryptsetup.path, initrd-cryptsetup.service is activated on demand

# note:
# mutually exclusive with initrd-plymouth.path

# service dependencies:
# https://www.archlinux.org/packages/core/x86_64/cryptsetup/

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

[X-SystemdTool]

# disable default password agents
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes
# not used
25 changes: 20 additions & 5 deletions src/initrd-cryptsetup.service
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ After=initrd-shell.service
After=cryptsetup-pre.target
Before=cryptsetup.target
Requires=initrd-shell.service
# note: order to ensure plymouth wins when present
After=plymouth-start.service
# note: plymouthd server intercepts /dev/console tty device
ConditionPathExists=!/run/plymouth/pid

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

[Install]
# not used: activated on demand

[X-SystemdTool]

# disable default password agents
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes

# provision disk tables in initramfs
InitrdPath=/etc/crypttab source=/etc/mkinitcpio-systemd-tool/config/crypttab replace=yes
InitrdPath=/etc/fstab source=/etc/mkinitcpio-systemd-tool/config/fstab replace=yes
InitrdPath=/etc/crypttab source=/etc/mkinitcpio-systemd-tool/config/crypttab replace=yes
InitrdPath=/etc/fstab source=/etc/mkinitcpio-systemd-tool/config/fstab replace=yes

# provide folder for sysroot.mount
# provide folder for sysroot.mount
InitrdPath=/sysroot/ create=yes

# provide folder expected by systemd-cryptsetup
InitrdPath=/run/cryptsetup/ create=yes

# include early swap support
InitrdBinary=/usr/bin/swapon
InitrdBinary=/usr/bin/swapoff
Expand All @@ -54,7 +69,7 @@ InitrdBinary=/usr/bin/dmsetup
InitrdCall=add_module dm-crypt
InitrdCall=add_all_modules /crypto/

# include cryptsetup udev rules
# include cryptsetup udev rules
InitrdPath=/usr/lib/udev/rules.d/10-dm.rules
InitrdPath=/usr/lib/udev/rules.d/11-dm-initramfs.rules source=/usr/lib/initcpio/udev/11-dm-initramfs.rules
InitrdPath=/usr/lib/udev/rules.d/13-dm-disk.rules
Expand Down
59 changes: 59 additions & 0 deletions src/initrd-plymouth.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool

# Provides crypto+plymouth support in initramfs
# https://wiki.archlinux.org/index.php/plymouth
# https://github.com/freedesktop/plymouth/blob/master/docs/development.txt

# note:
# experimental, see
# * https://github.com/random-archer/mkinitcpio-systemd-tool/issues/59

# note:
# this is a twin unit for initrd-plymouth.service
# enable only initrd-plymouth.path, initrd-plymouth.service is activated on demand

# note:
# requries sd-plymouth in /etc/mkinitcpio.conf::HOOKS
# HOOKS=(base ... systemd sd-plymouth systemd-tool)

# note:
# mutually exclusive with initrd-cryptestup.path
# when both initrd-cryptestup.path and initrd-plymouth.path are
# enabled via `systemctl enable`, kernel command line controls selection:
# `plymouth.enable=0` : will result in activation of initrd-cryptestup.path
# `plymouth.enable=1` : will result in activation of initrd-plymouth.path

# service dependencies:
# https://aur.archlinux.org/packages/plymouth/

[Unit]
Description=Initrd Plymouth Path
Documentation=https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
ConditionPathExists=/etc/crypttab
ConditionPathExists=/etc/fstab
ConditionPathExists=/etc/initrd-release
DefaultDependencies=no
Conflicts=shutdown.target
After=plymouth-start.service
Before=basic.target shutdown.target
Before=paths.target shutdown.target cryptsetup.target
# respect plymouth kernel command line contract
ConditionKernelCommandLine=!plymouth.enable=0
# note: plymouthd server intercepts /dev/console tty device
ConditionPathExists=/run/plymouth/pid

[Path]
# bind to the twin unit
Unit=initrd-plymouth.service
# create monitored folder when missing
MakeDirectory=yes
# activate twin unit when cryptsetup request files are present
DirectoryNotEmpty=/run/systemd/ask-password

[Install]
WantedBy=sysinit.target

[X-SystemdTool]

# inherit cryptsetup resources
InitrdUnit=initrd-cryptsetup.path
58 changes: 58 additions & 0 deletions src/initrd-plymouth.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool

# Provides crypto+plymouth support in initramfs
# https://wiki.archlinux.org/index.php/plymouth
# https://github.com/freedesktop/plymouth/blob/master/docs/development.txt

# note:
# this is a twin unit for initrd-plymouth.service
# enable only initrd-plymouth.path, initrd-plymouth.service is activated on demand

# note:
# * switch between plymouthd server text-vs-gui mode by pressing "ESC" key on /dev/console

# service dependencies:
# https://aur.archlinux.org/packages/plymouth/

[Unit]
Description=Initrd Plymouth Service
Documentation=https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
ConditionPathExists=/etc/crypttab
ConditionPathExists=/etc/fstab
ConditionPathExists=/etc/initrd-release
DefaultDependencies=no
After=plymouth-start.service
After=initrd-shell.service
After=cryptsetup-pre.target
Before=cryptsetup.target
Requires=initrd-shell.service
# respect plymouth kernel command line contract
ConditionKernelCommandLine=!plymouth.enable=0

[Service]
# invoke shell as service with "plymouth" mode
ExecStart=/usr/lib/mkinitcpio-systemd-tool/initrd-shell.sh script_entry=service service_name=crypto_plymouth
Restart=on-failure
RestartSec=1s
# successful crypto unlock is reported as 100
RestartPreventExitStatus=100
StandardInput=tty
StandardOutput=inherit
StandardError=inherit
TTYPath=/dev/console

[Install]
# not used: activated on demand

[X-SystemdTool]

# disable default password agents
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-plymouth.path replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-plymouth.service replace=yes create=yes

# plymouth client app
InitrdBinary=/usr/bin/plymouth

# TODO
# remove dependency on sd-plymouth, provision these resources:
# https://aur.archlinux.org/cgit/aur.git/tree/sd-plymouth.initcpio_install?h=plymouth
Loading

0 comments on commit b072dc3

Please sign in to comment.