dracut-systemd/dracut-initqueue: only start service if really needed
[dracut.git] / modules.d / 95nbd / module-setup.sh
blob3cb6f496399857728bbdacf28ca9b44663c63a93
1 #!/bin/bash
3 # called by dracut
4 check() {
5 local _rootdev
7 # if an nbd device is not somewhere in the chain of devices root is
8 # mounted on, fail the hostonly check.
9 [[ $hostonly ]] || [[ $mount_needs ]] && {
10 is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] ;}
12 _rootdev=$(find_root_block_device)
13 [[ -b /dev/block/$_rootdev ]] || return 1
14 check_block_and_slaves is_nbd "$_rootdev" || return 255
16 require_binaries nbd-client || return 1
18 return 0
21 # called by dracut
22 depends() {
23 # We depend on network modules being loaded
24 echo network rootfs-block
27 # called by dracut
28 installkernel() {
29 instmods nbd
32 # called by dracut
33 install() {
34 inst nbd-client
35 inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
36 inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot"
37 dracut_need_initqueue