Imported Upstream version 2.3.7
[platform/upstream/cryptsetup.git] / misc / dracut_90reencrypt / module-setup.sh
1 #!/bin/bash
2
3 check() {
4     [ -x /sbin/cryptsetup-reencrypt ] || return 1
5     return 255
6 }
7
8 depends() {
9     echo dm rootfs-block
10 }
11
12 installkernel() {
13     # requires hostonly='' override so that loop module is pulled in initramfs
14     # even if not loaded in actual kernel. dracut bug?
15     hostonly='' instmods dm_crypt =crypto loop
16 }
17
18 install() {
19     if dracut_module_included crypt; then
20         derror "'reencrypt' can't be installed together with 'crypt'."
21         derror "Add '-o crypt' option to install reencrypt module."
22         return 1
23     fi
24
25     dracut_install cryptsetup-reencrypt
26
27     # moddir variable is assigned in dracut general shell lib
28     # shellcheck disable=SC2154
29     inst_hook cmdline 30 "$moddir/parse-reencrypt.sh"
30     inst_simple "$moddir"/reencrypt.sh /sbin/reencrypt
31     inst_simple "$moddir"/reencrypt-verbose.sh /sbin/cryptsetup-reencrypt-verbose
32 }