diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2023-10-11 10:50:04 +0100 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2023-10-14 12:37:20 +0100 |
commit | 9c288f944459f4ce28f053b9018c0d8c1564d16a (patch) | |
tree | 511d0df75dbc6d04000d30010a470c23bb86a177 | |
parent | aa610a94bd80c5d640914cb8656df5e590c2815d (diff) |
install/autodetect: use sed for MODALIAS processing
Currently we do a double-stage processing - once with awk then a second
during expansion, dropping the MODALIAS= prefix.
Just use sed instead, which trivially allows to do both. This will make
a few further changes much easier.
v2:
- ' quote literals
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r-- | install/autodetect | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/install/autodetect b/install/autodetect index 8556856..f143330 100644 --- a/install/autodetect +++ b/install/autodetect @@ -13,8 +13,8 @@ build() { local mods=() mapfile -t mods < <(find /sys/devices -name uevent \ - -exec sort -u {} + | awk -F= '$1 == "MODALIAS" && !_[$0]++') - mapfile -t mods < <(modprobe -S "$KERNELVERSION" -qaR "${mods[@]#MODALIAS=}") + -exec sort -u {} + | sed -n 's/MODALIAS=\(.*\)/\1/p') + mapfile -t mods < <(modprobe -S "$KERNELVERSION" -qaR "${mods[@]}") (( ${#mods[*]} )) && printf "%s\n" "${mods[@]//-/_}" } |