Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/dracut/modules..../90mdraid
File: module-setup.sh
#!/bin/bash
[0] Fix | Delete
[1] Fix | Delete
# called by dracut
[2] Fix | Delete
check() {
[3] Fix | Delete
local _rootdev
[4] Fix | Delete
# No mdadm? No mdraid support.
[5] Fix | Delete
require_binaries mdadm expr || return 1
[6] Fix | Delete
[7] Fix | Delete
[[ $hostonly ]] || [[ $mount_needs ]] && {
[8] Fix | Delete
for dev in "${!host_fs_types[@]}"; do
[9] Fix | Delete
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
[10] Fix | Delete
[11] Fix | Delete
DEVPATH=$(get_devpath_block "$dev")
[12] Fix | Delete
[13] Fix | Delete
for holder in "$DEVPATH"/holders/*; do
[14] Fix | Delete
[[ -e "$holder" ]] || continue
[15] Fix | Delete
[[ -e "$holder/md" ]] && return 0
[16] Fix | Delete
break
[17] Fix | Delete
done
[18] Fix | Delete
[19] Fix | Delete
done
[20] Fix | Delete
return 255
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
return 0
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
# called by dracut
[27] Fix | Delete
depends() {
[28] Fix | Delete
echo rootfs-block
[29] Fix | Delete
return 0
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
# called by dracut
[33] Fix | Delete
installkernel() {
[34] Fix | Delete
instmods =drivers/md
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
# called by dracut
[38] Fix | Delete
cmdline() {
[39] Fix | Delete
local _activated dev line UUID
[40] Fix | Delete
declare -A _activated
[41] Fix | Delete
[42] Fix | Delete
for dev in "${!host_fs_types[@]}"; do
[43] Fix | Delete
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
[44] Fix | Delete
[45] Fix | Delete
UUID=$(
[46] Fix | Delete
/sbin/mdadm --examine --export $dev \
[47] Fix | Delete
| while read line || [ -n "$line" ]; do
[48] Fix | Delete
[[ ${line#MD_UUID=} = $line ]] && continue
[49] Fix | Delete
printf "%s" "${line#MD_UUID=} "
[50] Fix | Delete
done
[51] Fix | Delete
)
[52] Fix | Delete
[53] Fix | Delete
[[ -z "$UUID" ]] && continue
[54] Fix | Delete
[55] Fix | Delete
if ! [[ ${_activated[${UUID}]} ]]; then
[56] Fix | Delete
printf "%s" " rd.md.uuid=${UUID}"
[57] Fix | Delete
_activated["${UUID}"]=1
[58] Fix | Delete
fi
[59] Fix | Delete
[60] Fix | Delete
done
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
# called by dracut
[64] Fix | Delete
install() {
[65] Fix | Delete
local rule rule_path
[66] Fix | Delete
inst_multiple cat expr
[67] Fix | Delete
inst_multiple -o mdmon
[68] Fix | Delete
inst $(command -v partx) /sbin/partx
[69] Fix | Delete
inst $(command -v mdadm) /sbin/mdadm
[70] Fix | Delete
[71] Fix | Delete
if [[ $hostonly_cmdline == "yes" ]]; then
[72] Fix | Delete
local _raidconf=$(cmdline)
[73] Fix | Delete
[[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90mdraid.conf"
[74] Fix | Delete
fi
[75] Fix | Delete
[76] Fix | Delete
# <mdadm-3.3 udev rule
[77] Fix | Delete
inst_rules 64-md-raid.rules
[78] Fix | Delete
# >=mdadm-3.3 udev rules
[79] Fix | Delete
inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules
[80] Fix | Delete
# remove incremental assembly from stock rules, so they don't shadow
[81] Fix | Delete
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
[82] Fix | Delete
# when we explicitly don't want certain components to be incrementally
[83] Fix | Delete
# assembled
[84] Fix | Delete
for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
[85] Fix | Delete
rule_path="${initdir}${udevdir}/rules.d/${rule}"
[86] Fix | Delete
[ -f "${rule_path}" ] && sed -i -r \
[87] Fix | Delete
-e '/(RUN|IMPORT\{program\})\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(--export )?(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
[88] Fix | Delete
"${rule_path}"
[89] Fix | Delete
done
[90] Fix | Delete
[91] Fix | Delete
inst_rules "$moddir/65-md-incremental-imsm.rules"
[92] Fix | Delete
[93] Fix | Delete
inst_rules "$moddir/59-persistent-storage-md.rules"
[94] Fix | Delete
prepare_udev_rules 59-persistent-storage-md.rules
[95] Fix | Delete
[96] Fix | Delete
# guard against pre-3.0 mdadm versions, that can't handle containers
[97] Fix | Delete
if ! mdadm -Q -e imsm /dev/null >/dev/null 2>&1; then
[98] Fix | Delete
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
[99] Fix | Delete
fi
[100] Fix | Delete
if ! mdadm -Q -e ddf /dev/null >/dev/null 2>&1; then
[101] Fix | Delete
inst_hook pre-trigger 30 "$moddir/md-noddf.sh"
[102] Fix | Delete
fi
[103] Fix | Delete
[104] Fix | Delete
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
[105] Fix | Delete
if [ -f /etc/mdadm.conf ]; then
[106] Fix | Delete
inst -H /etc/mdadm.conf
[107] Fix | Delete
else
[108] Fix | Delete
[ -f /etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
[109] Fix | Delete
fi
[110] Fix | Delete
if [ -d /etc/mdadm.conf.d ]; then
[111] Fix | Delete
local f
[112] Fix | Delete
inst_dir /etc/mdadm.conf.d
[113] Fix | Delete
for f in /etc/mdadm.conf.d/*.conf; do
[114] Fix | Delete
[ -f "$f" ] || continue
[115] Fix | Delete
inst -H "$f"
[116] Fix | Delete
done
[117] Fix | Delete
fi
[118] Fix | Delete
fi
[119] Fix | Delete
[120] Fix | Delete
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
[121] Fix | Delete
inst_hook pre-trigger 30 "$moddir/parse-md.sh"
[122] Fix | Delete
inst_hook pre-mount 10 "$moddir/mdraid-waitclean.sh"
[123] Fix | Delete
inst_hook cleanup 99 "$moddir/mdraid-needshutdown.sh"
[124] Fix | Delete
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
[125] Fix | Delete
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
[126] Fix | Delete
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
[127] Fix | Delete
if dracut_module_included "systemd"; then
[128] Fix | Delete
if [ -e $systemdsystemunitdir/mdmon@.service ]; then
[129] Fix | Delete
inst_simple $systemdsystemunitdir/mdmon@.service
[130] Fix | Delete
fi
[131] Fix | Delete
if [ -e $systemdsystemunitdir/mdadm-last-resort@.service ]; then
[132] Fix | Delete
inst_simple $systemdsystemunitdir/mdadm-last-resort@.service
[133] Fix | Delete
fi
[134] Fix | Delete
if [ -e $systemdsystemunitdir/mdadm-last-resort@.timer ]; then
[135] Fix | Delete
inst_simple $systemdsystemunitdir/mdadm-last-resort@.timer
[136] Fix | Delete
fi
[137] Fix | Delete
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-grow-continue@.service ]; then
[138] Fix | Delete
inst_simple $systemdsystemunitdir/mdadm-grow-continue@.service
[139] Fix | Delete
fi
[140] Fix | Delete
fi
[141] Fix | Delete
inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
[142] Fix | Delete
dracut_need_initqueue
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function