diff options
author | Simon Rettberg | 2020-10-07 11:05:30 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-10-07 11:05:30 +0200 |
commit | 8aa8192c774c73a7abe5cc36e48e7f713e5aef82 (patch) | |
tree | b9bc2206d165a9fed0b23af8707970dcdd98e433 /modules/regex.inc | |
parent | Add net module (net_resolve_v4 for now) (diff) | |
download | slx-tools-8aa8192c774c73a7abe5cc36e48e7f713e5aef82.tar.gz slx-tools-8aa8192c774c73a7abe5cc36e48e7f713e5aef82.tar.xz slx-tools-8aa8192c774c73a7abe5cc36e48e7f713e5aef82.zip |
[dev] Implement raw partition scanner (MBR+GPT)
Relying in udev has proven unsuitable time and time again.
Sometimes after switchroot, it loses information about partitions that
was already present in the initramfs. When an MBR partition contains a
filesystem that is larger than the partition, the udev info is missing
the MBR partition type from its output (observed with NTFS at least).
As the kernel doesn't expose the mbr type and gpt type GUID directly in
sysfs, we implement our own crude MBR and GPT parsers. In ash.
Diffstat (limited to 'modules/regex.inc')
-rw-r--r-- | modules/regex.inc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/regex.inc b/modules/regex.inc index 21c3d65..3188b2d 100644 --- a/modules/regex.inc +++ b/modules/regex.inc @@ -1,5 +1,10 @@ #!/bin/ash +# Match $1 against perl regex $2, case sensitive +regex_match() { + printf "%s" "$1" | grep -qP "$2" +} + # Match $1 against perl regex $2, case insensitive regex_imatch() { printf "%s" "$1" | grep -qPi "$2" |