]>
Commit | Line | Data |
---|---|---|
95d2dabc HH |
1 | #!/bin/bash |
2 | # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- | |
3 | # ex: ts=8 sw=4 sts=4 et filetype=sh | |
4 | ||
5 | check() { | |
6 | # If our prerequisites are not met, fail anyways. | |
7 | type -P iscsistart hostname iscsi-iname >/dev/null || return 1 | |
8 | ||
9 | # If hostonly was requested, fail the check if we are not actually | |
10 | # booting from root. | |
11 | ||
12 | . $dracutfunctions | |
13 | ||
14 | [[ $debug ]] && set -x | |
15 | ||
16 | is_iscsi() ( | |
17 | [[ -L /sys/dev/block/$1 ]] || return | |
18 | cd "$(readlink -f /sys/dev/block/$1)" | |
19 | until [[ -d sys || -d iscsi_session ]]; do | |
20 | cd .. | |
21 | done | |
22 | [[ -d iscsi_session ]] | |
23 | ) | |
24 | ||
25 | [[ $hostonly ]] && { | |
26 | rootdev=$(find_root_block_device) | |
27 | if [[ $rootdev ]]; then | |
28 | # root lives on a block device, so we can be more precise about | |
29 | # hostonly checking | |
30 | check_block_and_slaves is_iscsi "$rootdev" || return 1 | |
31 | else | |
32 | return 1 | |
33 | fi | |
34 | } | |
35 | return 0 | |
36 | } | |
37 | ||
38 | depends() { | |
39 | echo network rootfs-block | |
40 | } | |
41 | ||
42 | installkernel() { | |
43 | instmods iscsi_tcp crc32c iscsi_ibft | |
44 | } | |
45 | ||
46 | install() { | |
47 | dracut_install umount | |
48 | inst iscsistart | |
49 | inst hostname | |
50 | inst iscsi-iname | |
51 | inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh" | |
52 | inst "$moddir/iscsiroot" "/sbin/iscsiroot" | |
53 | inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh" | |
54 | } |