Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib/dracut/modules..../90mdraid
File: mdraid_start.sh
#!/bin/sh
[0] Fix | Delete
[1] Fix | Delete
type getargs >/dev/null 2>&1 || . /lib/dracut-lib.sh
[2] Fix | Delete
[3] Fix | Delete
_md_start() {
[4] Fix | Delete
local _udevinfo
[5] Fix | Delete
local _path_s
[6] Fix | Delete
local _path_d
[7] Fix | Delete
local _md="$1"
[8] Fix | Delete
[9] Fix | Delete
_udevinfo="$(udevadm info --query=env --name="${_md}")"
[10] Fix | Delete
strstr "$_udevinfo" "MD_LEVEL=container" && continue
[11] Fix | Delete
strstr "$_udevinfo" "DEVTYPE=partition" && continue
[12] Fix | Delete
[13] Fix | Delete
_path_s="/sys/$(udevadm info -q path -n "${_md}")/md/array_state"
[14] Fix | Delete
[ ! -r "$_path_s" ] && continue
[15] Fix | Delete
[16] Fix | Delete
# inactive ?
[17] Fix | Delete
[ "$(cat "$_path_s")" != "inactive" ] && continue
[18] Fix | Delete
[19] Fix | Delete
mdadm -R "${_md}" 2>&1 | vinfo
[20] Fix | Delete
[21] Fix | Delete
# still inactive ?
[22] Fix | Delete
[ "$(cat "$_path_s")" = "inactive" ] && continue
[23] Fix | Delete
[24] Fix | Delete
_path_d="${_path_s%/*}/degraded"
[25] Fix | Delete
[ ! -r "$_path_d" ] && continue
[26] Fix | Delete
> $hookdir/initqueue/work
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
_md_force_run() {
[30] Fix | Delete
local _md
[31] Fix | Delete
local _UUID
[32] Fix | Delete
local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
[33] Fix | Delete
[ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
[34] Fix | Delete
[35] Fix | Delete
if [ -n "$_MD_UUID" ]; then
[36] Fix | Delete
_MD_UUID=$(str_replace "$_MD_UUID" "-" "")
[37] Fix | Delete
_MD_UUID=$(str_replace "$_MD_UUID" ":" "")
[38] Fix | Delete
[39] Fix | Delete
for _md in /dev/md[0-9_]*; do
[40] Fix | Delete
[ -b "$_md" ] || continue
[41] Fix | Delete
_UUID=$(
[42] Fix | Delete
/sbin/mdadm -D --export "$_md" \
[43] Fix | Delete
| while read line || [ -n "$line" ]; do
[44] Fix | Delete
str_starts "$line" "MD_UUID=" || continue
[45] Fix | Delete
printf "%s" "${line#MD_UUID=}"
[46] Fix | Delete
done
[47] Fix | Delete
)
[48] Fix | Delete
[49] Fix | Delete
[ -z "$_UUID" ] && continue
[50] Fix | Delete
_UUID=$(str_replace "$_UUID" ":" "")
[51] Fix | Delete
[52] Fix | Delete
# check if we should handle this device
[53] Fix | Delete
strstr " $_MD_UUID " " $_UUID " || continue
[54] Fix | Delete
[55] Fix | Delete
_md_start "${_md}"
[56] Fix | Delete
done
[57] Fix | Delete
else
[58] Fix | Delete
# try to force-run anything not running yet
[59] Fix | Delete
for _md in /dev/md[0-9_]*; do
[60] Fix | Delete
[ -b "$_md" ] || continue
[61] Fix | Delete
_md_start "${_md}"
[62] Fix | Delete
done
[63] Fix | Delete
fi
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
_md_force_run
[67] Fix | Delete
[68] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function