Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/dracut/modules..../90lvm
File: module-setup.sh
#!/bin/bash
[0] Fix | Delete
[1] Fix | Delete
# called by dracut
[2] Fix | Delete
check() {
[3] Fix | Delete
# No point trying to support lvm if the binaries are missing
[4] Fix | Delete
require_binaries lvm || return 1
[5] Fix | Delete
[6] Fix | Delete
[[ $hostonly ]] || [[ $mount_needs ]] && {
[7] Fix | Delete
for fs in "${host_fs_types[@]}"; do
[8] Fix | Delete
[[ $fs = LVM*_member ]] && return 0
[9] Fix | Delete
done
[10] Fix | Delete
return 255
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
return 0
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
# called by dracut
[17] Fix | Delete
depends() {
[18] Fix | Delete
# We depend on dm_mod being loaded
[19] Fix | Delete
echo rootfs-block dm
[20] Fix | Delete
return 0
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
# called by dracut
[24] Fix | Delete
cmdline() {
[25] Fix | Delete
local _activated
[26] Fix | Delete
declare -A _activated
[27] Fix | Delete
[28] Fix | Delete
for dev in "${!host_fs_types[@]}"; do
[29] Fix | Delete
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
[30] Fix | Delete
[ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
[31] Fix | Delete
uuid=$(</sys/block/${dev#/dev/}/dm/uuid)
[32] Fix | Delete
[[ "${uuid#LVM-}" == "$uuid" ]] && continue
[33] Fix | Delete
dev=$(</sys/block/${dev#/dev/}/dm/name)
[34] Fix | Delete
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
[35] Fix | Delete
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
[36] Fix | Delete
if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
[37] Fix | Delete
printf " rd.lvm.lv=%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
[38] Fix | Delete
_activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
[39] Fix | Delete
fi
[40] Fix | Delete
done
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
installkernel() {
[44] Fix | Delete
hostonly='' instmods dm-snapshot
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
# called by dracut
[48] Fix | Delete
install() {
[49] Fix | Delete
local _i
[50] Fix | Delete
[51] Fix | Delete
inst lvm
[52] Fix | Delete
[53] Fix | Delete
if [[ $hostonly_cmdline == "yes" ]]; then
[54] Fix | Delete
local _lvmconf=$(cmdline)
[55] Fix | Delete
[[ $_lvmconf ]] && printf "%s\n" "$_lvmconf" >> "${initdir}/etc/cmdline.d/90lvm.conf"
[56] Fix | Delete
fi
[57] Fix | Delete
[58] Fix | Delete
inst_rules "$moddir/64-lvm.rules"
[59] Fix | Delete
[60] Fix | Delete
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
[61] Fix | Delete
if [ -f /etc/lvm/lvm.conf ]; then
[62] Fix | Delete
inst_simple -H /etc/lvm/lvm.conf
[63] Fix | Delete
# FIXME: near-term hack to establish read-only locking;
[64] Fix | Delete
# use command-line lvm.conf editor once it is available
[65] Fix | Delete
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
[66] Fix | Delete
sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' ${initdir}/etc/lvm/lvm.conf
[67] Fix | Delete
fi
[68] Fix | Delete
[69] Fix | Delete
export LVM_SUPPRESS_FD_WARNINGS=1
[70] Fix | Delete
# Also install any files needed for LVM system id support.
[71] Fix | Delete
if [ -f /etc/lvm/lvmlocal.conf ]; then
[72] Fix | Delete
inst_simple -H /etc/lvm/lvmlocal.conf
[73] Fix | Delete
fi
[74] Fix | Delete
eval $(lvm dumpconfig global/system_id_source &>/dev/null)
[75] Fix | Delete
if [ "$system_id_source" == "file" ]; then
[76] Fix | Delete
eval $(lvm dumpconfig global/system_id_file)
[77] Fix | Delete
if [ -f "$system_id_file" ]; then
[78] Fix | Delete
inst_simple -H $system_id_file
[79] Fix | Delete
fi
[80] Fix | Delete
fi
[81] Fix | Delete
unset LVM_SUPPRESS_FD_WARNINGS
[82] Fix | Delete
fi
[83] Fix | Delete
[84] Fix | Delete
if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then
[85] Fix | Delete
mkdir -p "${initdir}/etc/lvm"
[86] Fix | Delete
{
[87] Fix | Delete
echo 'global {'
[88] Fix | Delete
echo 'locking_type = 4'
[89] Fix | Delete
echo 'use_lvmetad = 0'
[90] Fix | Delete
echo '}'
[91] Fix | Delete
} > "${initdir}/etc/lvm/lvm.conf"
[92] Fix | Delete
fi
[93] Fix | Delete
[94] Fix | Delete
inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
[95] Fix | Delete
[96] Fix | Delete
# Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut!
[97] Fix | Delete
if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]]; then
[98] Fix | Delete
if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
[99] Fix | Delete
sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \
[100] Fix | Delete
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
[101] Fix | Delete
sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
[102] Fix | Delete
sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
[103] Fix | Delete
else
[104] Fix | Delete
sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \
[105] Fix | Delete
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
[106] Fix | Delete
fi
[107] Fix | Delete
fi
[108] Fix | Delete
[109] Fix | Delete
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
[110] Fix | Delete
# files, but provides the one below:
[111] Fix | Delete
inst_rules 64-device-mapper.rules
[112] Fix | Delete
# debian udev rules
[113] Fix | Delete
inst_rules 56-lvm.rules 60-persistent-storage-lvm.rules
[114] Fix | Delete
[115] Fix | Delete
inst_script "$moddir/lvm_scan.sh" /sbin/lvm_scan
[116] Fix | Delete
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
[117] Fix | Delete
[118] Fix | Delete
inst_libdir_file "libdevmapper-event-lvm*.so"
[119] Fix | Delete
[120] Fix | Delete
if [[ $hostonly ]] && find_binary lvs &>/dev/null; then
[121] Fix | Delete
for dev in "${!host_fs_types[@]}"; do
[122] Fix | Delete
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
[123] Fix | Delete
dev=$(</sys/block/${dev#/dev/}/dm/name)
[124] Fix | Delete
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
[125] Fix | Delete
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
[126] Fix | Delete
case "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" in
[127] Fix | Delete
*thin*|*cache*|*era*)
[128] Fix | Delete
inst_multiple -o thin_dump thin_restore thin_check thin_repair \
[129] Fix | Delete
cache_dump cache_restore cache_check cache_repair \
[130] Fix | Delete
era_check era_dump era_invalidate era_restore
[131] Fix | Delete
break;;
[132] Fix | Delete
esac
[133] Fix | Delete
done
[134] Fix | Delete
fi
[135] Fix | Delete
[136] Fix | Delete
if ! [[ $hostonly ]]; then
[137] Fix | Delete
inst_multiple -o thin_dump thin_restore thin_check thin_repair \
[138] Fix | Delete
cache_dump cache_restore cache_check cache_repair \
[139] Fix | Delete
era_check era_dump era_invalidate era_restore
[140] Fix | Delete
fi
[141] Fix | Delete
[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