Skip to content

Commit 29ff01a

Browse files
Merge pull request #67 from random-archer/dev-code-review
code review
2 parents 4b4e27c + 7e38007 commit 29ff01a

File tree

8 files changed

+21
-13
lines changed

8 files changed

+21
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Features provided by the included service units:
2626
* early network setup
2727
* interactive user shell
2828
* remote ssh access in initrd
29+
* cryptsetup + plymouth support
2930
* cryptsetup + custom password agent
3031

3132
</details>
@@ -39,7 +40,6 @@ Useful issues [resolved in the past](https://github.com/random-archer/mkinitcpio
3940
Basic usage steps:
4041

4142
1) study and practice [system recovery](https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/System-Recovery)<br/>
42-
as practice shows configuration errors do occur
4343

4444
2) install the package
4545
```
@@ -48,7 +48,7 @@ pacman -S mkinitcpio-systemd-tool
4848

4949
3) activate required hooks in `/etc/mkinitcpio.conf`:
5050
```
51-
HOOKS="base ... systemd systemd-tool"
51+
HOOKS=(base ... systemd systemd-tool)
5252
```
5353

5454
4) configure, override and enable/disable [provided units](https://github.com/random-archer/mkinitcpio-systemd-tool/tree/master/src), for example: <br/>

src/crypttab

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
22

3+
# REQUIRED READING:
4+
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/Root-vs-Fstab
5+
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/System-Recovery
6+
37
# crypttab: mappings for encrypted partitions in initramfs
48
# * file location in initramfs: /etc/crypttab
59
# * file location in real-root: /etc/mkinitcpio-systemd-tool/config/crypttab
@@ -11,12 +15,12 @@
1115
# https://www.freedesktop.org/software/systemd/man/systemd-cryptsetup-generator.html
1216
# https://github.com/systemd/systemd/blob/master/src/cryptsetup/cryptsetup-generator.c
1317

14-
# note:
18+
# note:
1519
# * provide here mapper partition UUID (instead of kernel command line)
1620
# * use password/keyfile=none to force cryptsetup password agent prompt
1721
# * ensure that mapper-path in fstab corresponds to mapper-name in crypttab
1822
# * for x-mount options see: https://www.freedesktop.org/software/systemd/man/systemd.mount.html
1923

2024
# <mapper-name> <block-device> <password/keyfile> <crypto-options>
2125
# root UUID={{UUID_ROOT}} none luks
22-
# swap UUID={{UUID_SWAP}} none luks
26+
# swap UUID={{UUID_SWAP}} none luks

src/fstab

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
22

3+
# REQUIRED READING:
4+
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/Root-vs-Fstab
5+
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/System-Recovery
6+
37
# fstab: mappings for direct partitions in initramfs:
48
# * file location in initramfs: /etc/fstab
59
# * file location in real-root: /etc/mkinitcpio-systemd-tool/config/fstab
@@ -11,8 +15,7 @@
1115
# https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html
1216
# https://github.com/systemd/systemd/blob/master/src/fstab-generator/fstab-generator.c
1317

14-
# note:
15-
# * ensure /sysroot mount folder inside initramfs disk image
18+
# note:
1619
# * remove "root=/dev/mapper/root" stanza from kernel command line
1720
# * provide here root partition mapping (instead of kernel command line)
1821
# * ensure that mapper-path in fstab corresponds to mapper-name in crypttab

src/initrd-cryptsetup.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ TTYPath=/dev/console
5050
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
5151
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.service replace=yes create=yes
5252
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes
53-
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.servive replace=yes create=yes
53+
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.service replace=yes create=yes
5454

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

src/initrd-plymouth.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# https://github.com/freedesktop/plymouth/blob/master/docs/development.txt
66

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

1111
# note:
@@ -50,7 +50,7 @@ TTYPath=/dev/console
5050
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-plymouth.path replace=yes create=yes
5151
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-plymouth.service replace=yes create=yes
5252

53-
# plymouth client app
53+
# provision plymouth client
5454
InitrdBinary=/usr/bin/plymouth
5555

5656
# TODO

src/mkinitcpio-hook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/ash
1+
#!/usr/bin/env bash
22

33
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
44

src/mkinitcpio-install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
44

55
# Provides https://wiki.archlinux.org/index.php/Mkinitcpio#Build_hooks
66

77
# Using shell linter: https://github.com/koalaman/shellcheck
8+
# shellcheck shell=bash
89

910
# mkinitcpio entry point
1011
help() {
@@ -16,7 +17,7 @@ help() {
1617
# mkinitcpio entry point
1718
build() {
1819
#
19-
# selection logic:
20+
# systemd service unit selection logic:
2021
#
2122
# 1. "proper" symlinks in /etc/systemd/system
2223
# mostly represent aliased/enabled service units;

tool/image/test/cryptsetup/test_base/usr/lib/systemd/system/initrd-cryptsetup.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ TTYPath=/dev/console
5151
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
5252
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.service replace=yes create=yes
5353
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes
54-
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.servive replace=yes create=yes
54+
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.service replace=yes create=yes
5555

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

0 commit comments

Comments
 (0)