summarylogtreecommitdiffstats
path: root/systemd-root-password
blob: 771a7df7ce0b3c4e4d0bf9dfb7596ea9ccbbc8e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

build() {
    local shadow_file="/etc/shadow.initramfs" name="systemd-root-password"
    if [ -f "${shadow_file}" -o -L "${shadow_file}" ]; then
        echo "==> INFO (${name}): Set password for root user in the initramfs-image based on content from ${shadow_file}"
        grep '^root:' "${shadow_file}" > "$BUILDROOT/etc/shadow"
    else
        echo "==> WARN (${name}): Unable to set password for root user for the initramfs-image. The file ${shadow_file} was not found"
    fi
}

help() {
    cat <<HELPEOF
Since the following commit (10 Jun 2020).
https://github.com/archlinux/svntogit-packages/commit/776743d220cbb56e9abca2cc8bcef3a0ab7c8d0a

The root user in the initramfs-image have been locked, without a option to
unlock it by setting a password 😢 This mkinitcpio module is made to add the
option to unlock the root user in the initramfs-image.
Simple create the file "/etc/shadow.initramfs" and make sure that it contains
the root user with a password,
in the same format as the "/etc/shadow" file.

You can either make a symbol link from "/etc/shadow.initramfs" to "/etc/shadow"
and use the same root password as for the rest of your system or create a file
and make the user in the initramfs-image have a different password from the
rest of the system.
HELPEOF
}

# vim: set ft=sh ts=4 sw=4 et: