]>
Commit | Line | Data |
---|---|---|
bfa1db78 | 1 | #!/bin/bash |
bfa1db78 | 2 | |
13626413 HR |
3 | # called by dracut |
4 | cmdline() { | |
5 | is_dasd() { | |
6 | local _dev=$1 | |
7 | local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD) | |
8 | ||
9 | [ "${_devpath#*/dasd}" == "$_devpath" ] && return 1 | |
10 | _ccw="${_devpath%%/block/*}" | |
11 | echo "rd.dasd=${_ccw##*/}" | |
12 | return 0 | |
13 | } | |
14 | [[ $hostonly ]] || [[ $mount_needs ]] && { | |
05bf3209 HR |
15 | for_each_host_dev_and_slaves_all is_dasd || return 255 |
16 | } | sort | uniq | |
13626413 HR |
17 | } |
18 | ||
bfa1db78 HR |
19 | # called by dracut |
20 | check() { | |
21 | local _arch=$(uname -m) | |
13626413 HR |
22 | local found=0 |
23 | local bdev | |
bfa1db78 | 24 | [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 |
55c763b1 | 25 | require_binaries /usr/lib/udev/collect || return 1 |
13626413 HR |
26 | |
27 | [[ $hostonly ]] || [[ $mount_needs ]] && { | |
28 | for bdev in /sys/block/* ; do | |
29 | case "${bdev##*/}" in | |
30 | dasd*) | |
31 | found=$(($found+1)); | |
32 | break; | |
33 | esac | |
34 | done | |
35 | [ $found -eq 0 ] && return 255 | |
36 | } | |
bfa1db78 HR |
37 | return 0 |
38 | } | |
39 | ||
40 | # called by dracut | |
41 | depends() { | |
42 | echo 'dasd_mod' | |
43 | return 0 | |
44 | } | |
45 | ||
46 | # called by dracut | |
47 | install() { | |
e5bf1cec | 48 | inst_multiple /usr/lib/udev/collect |
bfa1db78 | 49 | inst_hook cmdline 30 "$moddir/parse-dasd.sh" |
13626413 HR |
50 | if [[ $hostonly_cmdline == "yes" ]] ; then |
51 | local _dasd=$(cmdline) | |
52 | [[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf" | |
53 | fi | |
bfa1db78 HR |
54 | if [[ $hostonly ]] ; then |
55 | inst_rules_wildcard 51-dasd-*.rules | |
55c763b1 | 56 | inst_rules_wildcard 41-s390x-dasd-*.rules |
b38b7fef DM |
57 | mark_hostonly /etc/udev/rules.d/51-dasd-*.rules |
58 | mark_hostonly /etc/udev/rules.d/41-s390x-dasd-*.rules | |
bfa1db78 HR |
59 | fi |
60 | inst_rules 59-dasd.rules | |
61 | } |