diff options
author | Armin Kuster <akuster808@gmail.com> | 2021-06-27 11:16:02 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2021-06-29 09:31:13 -0700 |
commit | be53d1a4677d085e6a46c7cb5dcda3d0ebb5ea9c (patch) | |
tree | 920b550ee473ad3c24a7b0368e2dbd4750c9f951 /recipes-core/initrdscripts/initramfs-framework-dm | |
parent | 8f313d951ce41cc6b07aff978d9f5625d7c142a2 (diff) | |
download | meta-security-be53d1a4677d085e6a46c7cb5dcda3d0ebb5ea9c.tar.gz |
initramfs-framework: rename files dir
Fixes:
ERROR: initramfs-framework-1.0-r4 do_fetch: Fetcher failure for URL: 'file://dmverity'. Unable to fetch URL from any source.
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'recipes-core/initrdscripts/initramfs-framework-dm')
-rw-r--r-- | recipes-core/initrdscripts/initramfs-framework-dm/dmverity | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/recipes-core/initrdscripts/initramfs-framework-dm/dmverity b/recipes-core/initrdscripts/initramfs-framework-dm/dmverity new file mode 100644 index 0000000..888052c --- /dev/null +++ b/recipes-core/initrdscripts/initramfs-framework-dm/dmverity | |||
@@ -0,0 +1,63 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | dmverity_enabled() { | ||
4 | return 0 | ||
5 | } | ||
6 | |||
7 | dmverity_run() { | ||
8 | DATA_SIZE="__not_set__" | ||
9 | ROOT_HASH="__not_set__" | ||
10 | |||
11 | . /usr/share/misc/dm-verity.env | ||
12 | |||
13 | C=0 | ||
14 | delay=${bootparam_rootdelay:-1} | ||
15 | timeout=${bootparam_roottimeout:-5} | ||
16 | RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})" | ||
17 | while [ ! -b "${RDEV}" ]; do | ||
18 | if [ $(( $C * $delay )) -gt $timeout ]; then | ||
19 | fatal "Root device resolution failed" | ||
20 | exit 1 | ||
21 | fi | ||
22 | |||
23 | case "${bootparam_root}" in | ||
24 | ID=*) | ||
25 | RDEV="$(realpath /dev/disk/by-id/${bootparam_root#ID=})" | ||
26 | ;; | ||
27 | LABEL=*) | ||
28 | RDEV="$(realpath /dev/disk/by-label/${bootparam_root#LABEL=})" | ||
29 | ;; | ||
30 | PARTLABEL=*) | ||
31 | RDEV="$(realpath /dev/disk/by-partlabel/${bootparam_root#PARTLABEL=})" | ||
32 | ;; | ||
33 | PARTUUID=*) | ||
34 | RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})" | ||
35 | ;; | ||
36 | PATH=*) | ||
37 | RDEV="$(realpath /dev/disk/by-path/${bootparam_root#PATH=})" | ||
38 | ;; | ||
39 | UUID=*) | ||
40 | RDEV="$(realpath /dev/disk/by-uuid/${bootparam_root#UUID=})" | ||
41 | ;; | ||
42 | *) | ||
43 | RDEV="${bootparam_root}" | ||
44 | esac | ||
45 | debug "Sleeping for $delay second(s) to wait root to settle..." | ||
46 | sleep $delay | ||
47 | C=$(( $C + 1 )) | ||
48 | |||
49 | done | ||
50 | |||
51 | veritysetup \ | ||
52 | --data-block-size=1024 \ | ||
53 | --hash-offset=${DATA_SIZE} \ | ||
54 | create rootfs \ | ||
55 | ${RDEV} \ | ||
56 | ${RDEV} \ | ||
57 | ${ROOT_HASH} | ||
58 | |||
59 | mount \ | ||
60 | -o ro \ | ||
61 | /dev/mapper/rootfs \ | ||
62 | ${ROOTFS_DIR} || exit 2 | ||
63 | } | ||