There might be other places (such as vendor-supplied preinit scripts)
where we wish to take a DMI name and clean it up in a consistent way,
so make the sed command into a function.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
+sanitize_name_x86() {
+ sed -e '
+ y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;
+ s/[^a-z0-9_-]\+/-/g;
+ s/^-//;
+ s/-$//;
+ ' "$@"
+}
+
do_sysinfo_x86() {
local vendor product file
echo "$vendor $product" > /tmp/sysinfo/model
- sed -e '
- y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;
- s/[^a-z0-9_-]\+/-/g;
- s/^-//;
- s/-$//;
- ' /tmp/sysinfo/model > /tmp/sysinfo/board_name
+ sanitize_name_x86 /tmp/sysinfo/model > /tmp/sysinfo/board_name
}
boot_hook_add preinit_main do_sysinfo_x86