# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() { [ "${1%*"$2"}" != "$1" ]; }
-uniq_lines() {
- local -A lines
- while read -r line; do
- if ! [[ ${lines[$line]} ]]; then
- echo "$line"
- lines[$line]=1
- fi
- done
-}
-
# find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
local _dev
local _ret=1
- [[ "${#host_fs_types[@]}" ]] || return 0
+ [[ "${#host_fs_types[@]}" ]] || return 2
+
for _dev in "${!host_fs_types[@]}"; do
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
if ! lvm_internal_dev $2 && "$1" $2; then
_ret=0
fi
- check_vol_slaves "$@" && return 0
+ check_vol_slaves_all "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
fi
local _dev
local _ret=1
- [[ "${host_devs[@]}" ]] || return 0
+ [[ "${host_devs[@]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
local _func="$1"
local _dev
- [[ "${host_devs[@]}" ]] || return 0
+ [[ "${host_devs[@]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
return 1
}
+check_vol_slaves_all() {
+ local _lv _vg _pv
+ for i in /dev/mapper/*; do
+ [[ $i == /dev/mapper/control ]] && continue
+ _lv=$(get_maj_min $i)
+ if [[ $_lv = $2 ]]; then
+ _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
+ # strip space
+ _vg="${_vg//[[:space:]]/}"
+ if [[ $_vg ]]; then
+ for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
+ do
+ check_block_and_slaves_all $1 $(get_maj_min $_pv)
+ done
+ return 0
+ fi
+ fi
+ done
+ return 1
+}
+
+
+
# fs_get_option <filesystem options> <search for option>
# search for a specific option in a bunch of filesystem options
# and return the value
local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
- # If family greater or equal than 0x15
- if [[ $family -ge 21 ]]; then
+ # If family greater than or equal to 0x17
+ if [[ $family -ge 23 ]]; then
+ printf "microcode_amd_fam17h.bin"
+ elif [[ $family -eq 22 ]]; then
+ printf "microcode_amd_fam16h.bin"
+ elif [[ $family -eq 21 ]]; then
printf "microcode_amd_fam15h.bin"
else
printf "microcode_amd.bin"