Skip to content

Commit

Permalink
Merge pull request #67 from random-archer/dev-code-review
Browse files Browse the repository at this point in the history
code review
  • Loading branch information
Andrei-Pozolotin authored May 9, 2020
2 parents 4b4e27c + 7e38007 commit 29ff01a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Features provided by the included service units:
* early network setup
* interactive user shell
* remote ssh access in initrd
* cryptsetup + plymouth support
* cryptsetup + custom password agent

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

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

2) install the package
```
Expand All @@ -48,7 +48,7 @@ pacman -S mkinitcpio-systemd-tool

3) activate required hooks in `/etc/mkinitcpio.conf`:
```
HOOKS="base ... systemd systemd-tool"
HOOKS=(base ... systemd systemd-tool)
```

4) configure, override and enable/disable [provided units](https://github.com/random-archer/mkinitcpio-systemd-tool/tree/master/src), for example: <br/>
Expand Down
8 changes: 6 additions & 2 deletions src/crypttab
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool

# REQUIRED READING:
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/Root-vs-Fstab
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/System-Recovery

# crypttab: mappings for encrypted partitions in initramfs
# * file location in initramfs: /etc/crypttab
# * file location in real-root: /etc/mkinitcpio-systemd-tool/config/crypttab
Expand All @@ -11,12 +15,12 @@
# https://www.freedesktop.org/software/systemd/man/systemd-cryptsetup-generator.html
# https://github.com/systemd/systemd/blob/master/src/cryptsetup/cryptsetup-generator.c

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

# <mapper-name> <block-device> <password/keyfile> <crypto-options>
# root UUID={{UUID_ROOT}} none luks
# swap UUID={{UUID_SWAP}} none luks
# swap UUID={{UUID_SWAP}} none luks
7 changes: 5 additions & 2 deletions src/fstab
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool

# REQUIRED READING:
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/Root-vs-Fstab
# * https://github.com/random-archer/mkinitcpio-systemd-tool/wiki/System-Recovery

# fstab: mappings for direct partitions in initramfs:
# * file location in initramfs: /etc/fstab
# * file location in real-root: /etc/mkinitcpio-systemd-tool/config/fstab
Expand All @@ -11,8 +15,7 @@
# https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html
# https://github.com/systemd/systemd/blob/master/src/fstab-generator/fstab-generator.c

# note:
# * ensure /sysroot mount folder inside initramfs disk image
# note:
# * remove "root=/dev/mapper/root" stanza from kernel command line
# * provide here root partition mapping (instead of kernel command line)
# * ensure that mapper-path in fstab corresponds to mapper-name in crypttab
Expand Down
2 changes: 1 addition & 1 deletion src/initrd-cryptsetup.service
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TTYPath=/dev/console
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.service replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.servive replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.service replace=yes create=yes

# provide folder for sysroot.mount
InitrdPath=/sysroot/ create=yes
Expand Down
4 changes: 2 additions & 2 deletions src/initrd-plymouth.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# https://github.com/freedesktop/plymouth/blob/master/docs/development.txt

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

# note:
Expand Down Expand Up @@ -50,7 +50,7 @@ TTYPath=/dev/console
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
# provision plymouth client
InitrdBinary=/usr/bin/plymouth

# TODO
Expand Down
2 changes: 1 addition & 1 deletion src/mkinitcpio-hook.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/ash
#!/usr/bin/env bash

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

Expand Down
5 changes: 3 additions & 2 deletions src/mkinitcpio-install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash

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

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

# Using shell linter: https://github.com/koalaman/shellcheck
# shellcheck shell=bash

# mkinitcpio entry point
help() {
Expand All @@ -16,7 +17,7 @@ help() {
# mkinitcpio entry point
build() {
#
# selection logic:
# systemd service unit selection logic:
#
# 1. "proper" symlinks in /etc/systemd/system
# mostly represent aliased/enabled service units;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TTYPath=/dev/console
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.path replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-console.service replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.path replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.servive replace=yes create=yes
InitrdPath=/usr/lib/systemd/system/systemd-ask-password-wall.service replace=yes create=yes

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

0 comments on commit 29ff01a

Please sign in to comment.