Fix using grep for searching binary files, fixes #1172405. Thanks Paul Eggert

for initial patch fixing grep usage in 83haiku
This commit is contained in:
Hedayat Vatankhah 2014-12-24 00:20:39 +03:30
parent a0ac2a8b3f
commit aea4f9e88e
3 changed files with 54 additions and 7 deletions

44
os-prober-grepfix.patch Normal file
View File

@ -0,0 +1,44 @@
Index: b/os-probes/mounted/x86/20microsoft
===================================================================
--- a/os-probes/mounted/x86/20microsoft
+++ b/os-probes/mounted/x86/20microsoft
@@ -31,19 +31,19 @@ if item_in_dir -q bootmgr "$2"; then
for boot in $(item_in_dir boot "$2"); do
bcd=$(item_in_dir bcd "$2/$boot")
if [ -n "$bcd" ]; then
- if grep -qs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then
+ if grep -aqs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then
long="Windows 8 (loader)"
- elif grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then
+ elif grep -aqs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then
long="Windows 7 (loader)"
- elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then
+ elif grep -aqs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then
long="Windows Vista (loader)"
- elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then
+ elif grep -aqs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then
long="Windows Server 2008 R2 (loader)"
- elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then
+ elif grep -aqs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then
long="Windows Server 2008 (loader)"
- elif grep -qs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then
+ elif grep -aqs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then
long="Windows Recovery Environment (loader)"
- elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then
+ elif grep -aqs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then
long="Windows Recovery Environment (loader)"
else
long="Windows Vista (loader)"
Index: b/os-probes/mounted/x86/83haiku
===================================================================
--- a/os-probes/mounted/x86/83haiku
+++ b/os-probes/mounted/x86/83haiku
@@ -13,7 +13,7 @@ case "$type" in
*) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
esac
-if head -c 512 "$partition" | grep -qs "system.haiku_loader"; then
+if head -c 512 "$partition" | grep -aqs "system.haiku_loader"; then
debug "Stage 1 bootloader found"
else
debug "Stage 1 bootloader not found: exiting"

View File

@ -7,8 +7,8 @@ Subject: [PATCH] Don't count our dummy mach_kernel as real MacOS X.
os-probes/mounted/powerpc/20macosx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/os-probes/mounted/powerpc/20macosx b/os-probes/mounted/powerpc/20macosx
index dd4207f..d630fec 100755
Index: b/os-probes/mounted/powerpc/20macosx
===================================================================
--- a/os-probes/mounted/powerpc/20macosx
+++ b/os-probes/mounted/powerpc/20macosx
@@ -21,7 +21,7 @@ esac
@ -16,10 +16,7 @@ index dd4207f..d630fec 100755
# shell will be nasty.
-if [ -e "$2/mach_kernel" ]; then
+if [ -e "$2/mach_kernel" ] && ! dd if="$2/mach_kernel" count=1 bs=5 2>/dev/null | grep -q Dummy ; then
+if [ -e "$2/mach_kernel" ] && ! dd if="$2/mach_kernel" count=1 bs=5 2>/dev/null | grep -aq Dummy ; then
label="$(count_next_label MacOSX)"
result "$1:Mac OS X:$label:macosx"
exit 0
--
1.7.10.1

View File

@ -1,6 +1,6 @@
Name: os-prober
Version: 1.65
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Probes disks on the system for installed operating systems
Group: System Environment/Base
@ -26,6 +26,7 @@ Patch10: os-prober-factor-out-logger.patch
Patch11: os-prober-factored-logger-efi-fix.patch
Patch12: os-prober-umount-fix.patch
Patch13: os-prober-grub2-parsefix.patch
Patch14: os-prober-grepfix.patch
Requires: udev coreutils util-linux
Requires: grep /bin/sed /sbin/modprobe
@ -51,6 +52,7 @@ distributions can be added easily.
%patch11 -p1 -b .factor-out-logger-efi-fix
%patch12 -p1 -b .umount-fix
%patch13 -p1 -b .grub2-parsefix
%patch14 -p1 -b .grepfix
find -type f -exec sed -i -e 's|usr/lib|usr/libexec|g' {} \;
sed -i -e 's|grub-probe|grub2-probe|g' os-probes/common/50mounted-tests \
@ -101,6 +103,10 @@ fi
%{_var}/lib/%{name}
%changelog
* Tue Dec 23 2014 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.65-2
- Fix using grep for searching binary files, fixes #1172405. Thanks Paul Eggert
for initial patch fixing grep usage in 83haiku
* Sun Dec 07 2014 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.65-1
- Using latest upstream version tarball to be consistent with upstream
versioning