]> git.ipfire.org Git - thirdparty/dracut.git/blame - modules.d/95dasd_rules/parse-dasd.sh
fix(btrfs): do not require module via cmdline when --no-kernel
[thirdparty/dracut.git] / modules.d / 95dasd_rules / parse-dasd.sh
CommitLineData
add1ea88 1#!/bin/bash
bfa1db78 2
ebafbd82 3allow_device() {
bfa1db78 4 local ccw=$1
bfa1db78 5
a19ab291
HH
6 if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then
7 cio_ignore -r "$ccw"
cf9c8c5f 8 fi
bfa1db78
HR
9}
10
a19ab291 11if [[ -f /sys/firmware/ipl/ipl_type ]] && [[ $(< /sys/firmware/ipl/ipl_type) == "ccw" ]]; then
ebafbd82 12 allow_device "$(< /sys/firmware/ipl/device)"
bd355f86
HR
13fi
14
bfa1db78 15for dasd_arg in $(getargs root=) $(getargs resume=); do
a19ab291
HH
16 [[ $dasd_arg =~ /dev/disk/by-path/ccw-* ]] || continue
17
18 ccw_dev="${dasd_arg##*/ccw-}"
ebafbd82 19 allow_device "${ccw_dev%%-*}"
bfa1db78 20done
856d039b
HR
21
22for dasd_arg in $(getargs rd.dasd=); do
a19ab291
HH
23 IFS=',' read -r -a devs <<< "$dasd_arg"
24 declare -p devs
25 for dev in "${devs[@]}"; do
26 case "$dev" in
27 autodetect | probeonly) ;;
28
29 *-*)
30 IFS="-" read -r start end _ <<< "${dev%(ro)}"
31 prefix=${start%.*}
32 start=${start##*.}
33 for rdev in $(seq $((16#$start)) $((16#$end))); do
ebafbd82 34 allow_device "$(printf "%s.%04x" "$prefix" "$rdev")"
a19ab291
HH
35 done
36 ;;
37 *)
38 IFS="." read -r sid ssid chan _ <<< "${dev%(ro)}"
ebafbd82 39 allow_device "$(printf "%01x.%01x.%04x" $((16#$sid)) $((16#$ssid)) $((16#$chan)))"
a19ab291
HH
40 ;;
41 esac
42 done
856d039b 43done