]> git.ipfire.org Git - thirdparty/dracut.git/blobdiff - dracut-functions.sh
Fix task limit in emergency.service (the same change as in dracut-emergency.service...
[thirdparty/dracut.git] / dracut-functions.sh
index 146dbea0583b02377eea2576112e75f0c7167638..642dcf0955318dcf863bcd254d5ca5fa36e34d98 100755 (executable)
@@ -37,16 +37,6 @@ str_starts() { [ "${1#"$2"*}" != "$1" ]; }
 # 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() {
@@ -478,7 +468,8 @@ for_each_host_dev_fs()
     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
@@ -517,7 +508,7 @@ check_block_and_slaves_all() {
     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
@@ -537,7 +528,7 @@ for_each_host_dev_and_slaves_all()
     local _dev
     local _ret=1
 
-    [[ "${host_devs[@]}" ]] || return 0
+    [[ "${host_devs[@]}" ]] || return 2
 
     for _dev in "${host_devs[@]}"; do
         [[ -b "$_dev" ]] || continue
@@ -553,7 +544,7 @@ for_each_host_dev_and_slaves()
     local _func="$1"
     local _dev
 
-    [[ "${host_devs[@]}" ]] || return 0
+    [[ "${host_devs[@]}" ]] || return 2
 
     for _dev in "${host_devs[@]}"; do
         [[ -b "$_dev" ]] || continue
@@ -590,6 +581,29 @@ check_vol_slaves() {
     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
@@ -648,8 +662,12 @@ get_ucode_file ()
     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"