diff options
author | librewish | 2021-09-12 20:30:34 +0530 |
---|---|---|
committer | librewish | 2021-09-12 20:30:34 +0530 |
commit | 752ceb29fd23a6c4cffbca9f65adad1cb53f4872 (patch) | |
tree | a41fd50e983356d81f724b91463f8855bae07d9a | |
parent | 5271f23d8ac140f2db82697b645c38a41ccc78ac (diff) | |
download | aur-752ceb29fd23a6c4cffbca9f65adad1cb53f4872.tar.gz |
add patches from opensuse
35 files changed, 1136 insertions, 740 deletions
@@ -1,62 +1,75 @@ pkgbase = os-prober-btrfs pkgdesc = Utility to detect other OSes on a set of drives (with additional patches to detect btrfs systems and other systems) - pkgver = 1.77 + pkgver = 1.79 pkgrel = 1 url = http://joey.kitenet.net/code/os-prober/ - arch = i686 arch = x86_64 license = GPL3 depends = sh provides = os-prober + provides = os-prober-garuda conflicts = os-prober - source = http://http.debian.net/debian/pool/main/o/os-prober/os-prober_1.77.tar.xz - source = os-prober-frugalware.diff - source = os-prober-mdraidfix.patch + conflicts = os-prober-garuda + replaces = os-prober-garuda + source = http://http.debian.net/debian/pool/main/o/os-prober/os-prober_1.79.tar.xz + source = os-prober-newnsdirfix.patch + source = os-prober-1.49-fix-grub2.cfg-parsing.patch + source = os-prober-1.49-grub2-mount.patch + source = os-prober-probe-MD-devices.patch + source = os-prober-linux-secure-boot.patch source = os-prober-btrfsfix.patch - source = os-prober-bootpart-name-fix.patch - source = os-prober-mounted-partitions-fix.patch - source = os-prober-factor-out-logger.patch - source = os-prober-factored-logger-efi-fix.patch - source = os-prober-umount-fix.patch - source = os-prober-grub2-parsefix.patch - source = os-prober-haiku-efi.patch - source = os-prober-no-dummy-mach-kernel.patch - source = os-prober-grub2-multiple-images.patch - source = os-prober-grepfix.patch - source = os-prober-gentoo-fix.patch - source = fix-blkid-path.patch - md5sums = cfe55c2414868fb1478a4565887b9de3 - md5sums = 2ae284a2fc6cafb6ec4af0f44d3c3e48 - md5sums = fa2c878cbb8af6b6dc57b6cd966520ec - md5sums = d3ef3f5f108810cc9241084463033470 - md5sums = 672f301022bdb4a2962e9c7f8af05f21 - md5sums = 3c15707f9abbf2867d44886a77dbf74a - md5sums = 7e4c8f98ff7763472bc46adb4f9119c2 - md5sums = 1a09f769d1e966c773b8885a9b0be44e - md5sums = 69e5e23a35a2756fcb9d649d0ae2eea5 - md5sums = b81bdf05173269ccce91c9a81ce4bfe8 - md5sums = d1ba57816ae6f610249857065e8b0f03 - md5sums = a77ee9b3eaef6a2d54318415d6ef04db - md5sums = 2ac73c1c9f3ff32c4c5670f5fbda9f0d - md5sums = ed3242f992b525a4af0a9df9af51e334 - md5sums = ec05aaa35c83ab669291e8895c252cc8 - md5sums = 20dc42ef9b69f79b920380cd95191ed3 - sha256sums = 8d8ea4afbe1aeef3c8b73f74a0fb37b06185e21a6abc78f80fc2160009cf705f - sha256sums = 9a6c22c91ea5955d665bc20d85d899f6721875a6216862d59a1b7f3f4241fd02 - sha256sums = 092b0caef6fff45560531c0735e9449cb05a677e2296d72b5a0b4fb568fa4476 - sha256sums = c9738e0e6aa0ca79d84726288b9bbd0ca3a5220cd08136280492d8f9454c932c - sha256sums = c3d094f02b8a00026af10fdfe2ea9286cd1af6a1e25afcc82f3b234bdb64b86f - sha256sums = 7a9c4a0f5bba4053b1bbf1640c854aee83f526fd086c94bc7691e1d3cb28afb7 - sha256sums = b5c41ac1bc1a4544dd2d9efdcf190d6e5c2f0822b6d0e5fc8f7e6e5222da1d8d - sha256sums = 08bf632e4716a3a63bd8f20e729c540754b676b23f4f82ff9156c448910c6f94 - sha256sums = 81a5ce0c5e784480dff7520bdfada8f80dfe96b101e14e41bca2d0992e863e68 - sha256sums = afc201d4d71525b73ffa365f7c667148e007836567be4c8ec25ea661d43b43f8 - sha256sums = cc7182f0924a298b607abfcf61da6934654d6d52256e419df71effcef153fc66 - sha256sums = 1369453105d858a7b3de833bab4bcc615ac6b72fac8a104519c2fbfcce33d837 - sha256sums = 07b919c7559ce6c5a8d8907d752366fc97ccf40b7ad54cbb2de904a9dd373efd - sha256sums = a9331117892dd9876b346d941969f70da96d54ce122d7a5ff40d9efe36aded42 - sha256sums = 02741e0edbc46327501be5d74977ff2bffa5ddaffe6a55a689e38ce4b8372444 - sha256sums = 87bbb0f69ebb47f5136291d6851967fba791db4f27d8883b35fc5be1653ff7a6 + source = os-prober-accept-ESP-on-IMSM.patch + source = os-prober-dont-load-all-fs-module-and-dont-test-mount.patch + source = os-prober-fix-btrfs-subvol-mounted-tests.patch + source = os-prober-skip-part-on-multipath.patch + source = Improve-btrfs-handling-on-os-probing-for-grub2.patch + source = os-prober-btrfs-absolute-subvol.patch + source = os-prober-40grub-check-grub2.patch + source = os-prober-btrfs-snapshot-detection.patch + source = os-prober-btrfs-always-detect-default.patch + source = os-prober-05efi-blkid.patch + source = os-prober-multiple-initrd.patch + source = os-prober-make-btrfsprogs-optional.patch + source = os-prober-disable-debug.patch + md5sums = 08d3bfff00f1f7c068ce509656728eba + md5sums = 25472f3c6f27681df6e01ff275a7b571 + md5sums = 282040a02e5150736234511d9986f4ac + md5sums = 12cc212f04ac0768de9a1525df12e86e + md5sums = 5532000280ed1ded65e417c90c552c1b + md5sums = 7b396da508fd8c810b25680a0fd48f51 + md5sums = 4570445b02760c8f8580f935ee32d3ca + md5sums = d59438eb023d066b134b5c07cf45bf0f + md5sums = 2c8ee5d22864a274f4f8f755108137bf + md5sums = 014191f41eb52859160303e8ae439a6c + md5sums = 675816cc8c78600be13e7d25d9077374 + md5sums = ad9bc064acd5300e87c5420e2a431bee + md5sums = cd8fb7fb7e796a23224debad5a65245f + md5sums = 56df8e39093ea36ec7cbed7d3cfe4ce5 + md5sums = 60d1b370c3910f01dc38f933069bc315 + md5sums = 79e62f50656ac80eaab99189e23d886b + md5sums = dc1f6d454794807b6a98f4146789c0aa + md5sums = e3c5edc2b078880ab0dfbf15731549f3 + md5sums = 03d733433697d5f0e4fddc506b89575e + md5sums = ab664f2e22a098f83b42c06babd9ab20 + sha256sums = abe6317d078c4e51e322e62036b6df4a698bfe80c5be110a08894841179810ee + sha256sums = 9301e3bbb7964a962f43ebe54dea77f56c1dffb91d99e23f306faefd8667c30a + sha256sums = 71222cbe521abb676a0441a7e58cd58161b992d1e19e34eb0ee951c6b891e474 + sha256sums = 754a8ac582dc0d8d882bb4c75d1216d2a2ec892848cd5cef353183d932d7026f + sha256sums = 7969ba7066cdd00ad21fdb9d84bf57955adcfc9b844b6955a0b5cb28eafe304a + sha256sums = d66bbed46770f30198c181e6be3168ea288150800098e59874bba78dd0997ace + sha256sums = 66ed152fd58e6cfaf9a4b656140587f3344ade4d79a8979c9e45b10f435f41df + sha256sums = 595feaab34a49445030926d2adc6b472a513441bbb9c780c89425ae7ce97e97b + sha256sums = 4b1b27b466a206e44c3059e637026d4d0e1ce12a5bf30888f5896d29ceaa530a + sha256sums = ded9ecced92c7c91a56598e3ac1ff197e79cc08395190e9a62725b9c45603734 + sha256sums = 7cb99753a4c552f6d764591a8a372bf3ecfb25b2dc888316e8e7840ca208aa16 + sha256sums = fcd2764c95a5f919e9d50c018d090f7c5b7dce801f899083fca2bcd0dc20ee12 + sha256sums = 015f9e7c5d38df39928164d6537c3699da7d815bc91a582832714bbbbe56d49f + sha256sums = ed70c45f0170cbe674beba1f8b7f943a9304e5c6d1843d959ceed9239740a763 + sha256sums = 987396baafea006467498cca8bc9d4926b8efe7b553462b9f14b1616992dd03d + sha256sums = 795b2fe197bd9a5df873eb794a42a3e42de487b758fe6076fb356d1779844334 + sha256sums = 41cd45207f55f9b7871e05fb2068d9b3f38bd70abea9af5458a046b42dad621d + sha256sums = 509c4e97621f930e59e21ff63b462831df1f6da0750afed27693aa4be0f1abff + sha256sums = 23ddae7702ad49696a6a2b6c53a844f159d1972d9b420d9ea691fcf9c796de1d + sha256sums = fa9394bdf5298847474e55c528fa5e4fe25611239c5ca9594d572b22baa4d28c pkgname = os-prober-btrfs - diff --git a/Improve-btrfs-handling-on-os-probing-for-grub2.patch b/Improve-btrfs-handling-on-os-probing-for-grub2.patch new file mode 100644 index 000000000000..4e79674f9662 --- /dev/null +++ b/Improve-btrfs-handling-on-os-probing-for-grub2.patch @@ -0,0 +1,94 @@ +From: Egbert Eich <eich@suse.de> +Date: Fri May 29 08:55:21 2015 +0200 +Subject: Improve btrfs handling on os-probing for grub2 +Patch-mainline: never + +References: bsc#892364 +Signed-off-by: Egbert Eich <eich@suse.com> + +Currently probing of a grub2 config file is broken if +the root/boot fs is btrfs. This is due to a patch picked +from Fedora which attempts to determine the location of +the kernel and probe for it. +This code has meanwhile changed on Fedora, however the +new version works no better than the old one. +It is possible that this code works under very special +circumstances of the Fedora system, however it is by no +means valid. +Our goal is to +a. determine the location of the kernel in the mounted fs + regardless whether the grub2 config specifies an absolute + or relative path to the kernel file. +b. Prepend the correct prefix if grub2_btrfs expects an + absolute path (either because the current grub2 fs isn't + btrfs or absolute path addressing is explicitely requested). +c. Attempt to handle the location of the kernel file correctly + if this lives on a separate btrfs subvolume. + (Currently this only works if the path to this subvolume is + identical to the fs path). + +Signed-off-by: Egbert Eich <eich@suse.de> + +v2: +a. Fix missing linux16/initrd16 parsing in entry result +b. Fix kernelfile path if separate boot partition on btrfs + +Signed-off-by: Michael Chang <mchang@suse.com> +--- + linux-boot-probes/mounted/common/40grub2 | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2 +=================================================================== +--- os-prober-1.61.orig/linux-boot-probes/mounted/common/40grub2 ++++ os-prober-1.61/linux-boot-probes/mounted/common/40grub2 +@@ -14,9 +14,19 @@ bootsv="$6" + found_item=0 + + entry_result () { +- if [ "x$type" = "xbtrfs" -a "$rootsv" = "$bootsv" ]; then +- # trim off the leading subvol +- kernelfile=$(echo "$kernel" | cut -d '/' -f 2- | cut -d '/' -f 2-) ++ if [ "x$type" = "xbtrfs" ]; then ++ bsv=${bootsv:+/}${bootsv} ++ # if path is not relative to subvolume make it relative ++ kernel=${kernel#${bsv}} ++ kernelfile=$kernel ++ initrd=${initrd#${bsv}} ++ if [ "x$GRUB_FS" != "xbtrfs" -o "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" != "xtrue" ]; then ++ # absolute path needed: prepend subvolume if $kernel isn't empty ++ kernel=${kernel:+${bsv}}${kernel} ++ initrd=${initrd:+${bsv}}${initrd} ++ fi ++ # assumed: rootsv != bootsv if rootsv isn't ancestor of bootsv ++ [ "$partition" != "$bootpart" -o "$rootsv" != "$bootsv" ] && kernelfile="/boot${kernelfile}" + else + kernelfile=$kernel + fi +@@ -81,7 +91,7 @@ parse_grub_menu () { + ignore_item=1 + fi + ;; +- linux|linuxefi) ++ linux|linuxefi|linux16) + # Hack alert: sed off any (hdn,n) but + # assume the kernel is on the same + # partition. +@@ -90,14 +100,14 @@ parse_grub_menu () { + parameters="$@" + # Systems with a separate /boot will not have + # the path to the kernel in grub.cfg. +- if [ "$partition" != "$bootpart" ]; then ++ if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then + kernel="/boot$kernel" + fi + ;; +- initrd|initrdefi) ++ initrd|initrdefi|initrd16) + initrd="$(echo "$2" | sed 's/(.*)//')" + # Initrd same. +- if [ "$partition" != "$bootpart" ]; then ++ if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then + initrd="/boot$initrd" + fi + ;; @@ -1,113 +1,126 @@ # Maintainer: Librewish <librewish@gail.com> -# Contributor: Bernhard Landauer <oberon@manjaro.org> +# Contributor: Levente Polyak <anthraxx[at]archlinux[dot]org> # Contributor: Timothy Redaelli <timothy.redaelli@gmail.com> # Contributor: darkcoder <mario_vazq@hotmail.com> pkgname=os-prober-btrfs _pkgname=os-prober -pkgver=1.77 +pkgver=1.79 pkgrel=1 pkgdesc="Utility to detect other OSes on a set of drives (with additional patches to detect btrfs systems and other systems)" url="http://joey.kitenet.net/code/os-prober/" -arch=('i686' 'x86_64') +arch=('x86_64') license=('GPL3') depends=('sh') -provides=('os-prober') -conflicts=('os-prober') +provides=('os-prober' 'os-prober-garuda') +conflicts=('os-prober' 'os-prober-garuda') +replaces=('os-prober-garuda') source=(http://http.debian.net/debian/pool/main/o/${_pkgname}/${_pkgname}_${pkgver}.tar.xz - os-prober-frugalware.diff - os-prober-mdraidfix.patch - os-prober-btrfsfix.patch - os-prober-bootpart-name-fix.patch - os-prober-mounted-partitions-fix.patch - os-prober-factor-out-logger.patch - os-prober-factored-logger-efi-fix.patch - os-prober-umount-fix.patch - os-prober-grub2-parsefix.patch - os-prober-haiku-efi.patch - os-prober-no-dummy-mach-kernel.patch - os-prober-grub2-multiple-images.patch - os-prober-grepfix.patch - os-prober-gentoo-fix.patch - fix-blkid-path.patch) -md5sums=('cfe55c2414868fb1478a4565887b9de3' - '2ae284a2fc6cafb6ec4af0f44d3c3e48' - 'fa2c878cbb8af6b6dc57b6cd966520ec' - 'd3ef3f5f108810cc9241084463033470' - '672f301022bdb4a2962e9c7f8af05f21' - '3c15707f9abbf2867d44886a77dbf74a' - '7e4c8f98ff7763472bc46adb4f9119c2' - '1a09f769d1e966c773b8885a9b0be44e' - '69e5e23a35a2756fcb9d649d0ae2eea5' - 'b81bdf05173269ccce91c9a81ce4bfe8' - 'd1ba57816ae6f610249857065e8b0f03' - 'a77ee9b3eaef6a2d54318415d6ef04db' - '2ac73c1c9f3ff32c4c5670f5fbda9f0d' - 'ed3242f992b525a4af0a9df9af51e334' - 'ec05aaa35c83ab669291e8895c252cc8' - '20dc42ef9b69f79b920380cd95191ed3') -sha256sums=('8d8ea4afbe1aeef3c8b73f74a0fb37b06185e21a6abc78f80fc2160009cf705f' - '9a6c22c91ea5955d665bc20d85d899f6721875a6216862d59a1b7f3f4241fd02' - '092b0caef6fff45560531c0735e9449cb05a677e2296d72b5a0b4fb568fa4476' - 'c9738e0e6aa0ca79d84726288b9bbd0ca3a5220cd08136280492d8f9454c932c' - 'c3d094f02b8a00026af10fdfe2ea9286cd1af6a1e25afcc82f3b234bdb64b86f' - '7a9c4a0f5bba4053b1bbf1640c854aee83f526fd086c94bc7691e1d3cb28afb7' - 'b5c41ac1bc1a4544dd2d9efdcf190d6e5c2f0822b6d0e5fc8f7e6e5222da1d8d' - '08bf632e4716a3a63bd8f20e729c540754b676b23f4f82ff9156c448910c6f94' - '81a5ce0c5e784480dff7520bdfada8f80dfe96b101e14e41bca2d0992e863e68' - 'afc201d4d71525b73ffa365f7c667148e007836567be4c8ec25ea661d43b43f8' - 'cc7182f0924a298b607abfcf61da6934654d6d52256e419df71effcef153fc66' - '1369453105d858a7b3de833bab4bcc615ac6b72fac8a104519c2fbfcce33d837' - '07b919c7559ce6c5a8d8907d752366fc97ccf40b7ad54cbb2de904a9dd373efd' - 'a9331117892dd9876b346d941969f70da96d54ce122d7a5ff40d9efe36aded42' - '02741e0edbc46327501be5d74977ff2bffa5ddaffe6a55a689e38ce4b8372444' - '87bbb0f69ebb47f5136291d6851967fba791db4f27d8883b35fc5be1653ff7a6') + os-prober-newnsdirfix.patch + os-prober-1.49-fix-grub2.cfg-parsing.patch + os-prober-1.49-grub2-mount.patch + os-prober-probe-MD-devices.patch + os-prober-linux-secure-boot.patch + os-prober-btrfsfix.patch + os-prober-accept-ESP-on-IMSM.patch + os-prober-dont-load-all-fs-module-and-dont-test-mount.patch + os-prober-fix-btrfs-subvol-mounted-tests.patch + os-prober-skip-part-on-multipath.patch + Improve-btrfs-handling-on-os-probing-for-grub2.patch + os-prober-btrfs-absolute-subvol.patch + os-prober-40grub-check-grub2.patch + os-prober-btrfs-snapshot-detection.patch + os-prober-btrfs-always-detect-default.patch + os-prober-05efi-blkid.patch + os-prober-multiple-initrd.patch + os-prober-make-btrfsprogs-optional.patch + os-prober-disable-debug.patch) +md5sums=('08d3bfff00f1f7c068ce509656728eba' + '25472f3c6f27681df6e01ff275a7b571' + '282040a02e5150736234511d9986f4ac' + '12cc212f04ac0768de9a1525df12e86e' + '5532000280ed1ded65e417c90c552c1b' + '7b396da508fd8c810b25680a0fd48f51' + '4570445b02760c8f8580f935ee32d3ca' + 'd59438eb023d066b134b5c07cf45bf0f' + '2c8ee5d22864a274f4f8f755108137bf' + '014191f41eb52859160303e8ae439a6c' + '675816cc8c78600be13e7d25d9077374' + 'ad9bc064acd5300e87c5420e2a431bee' + 'cd8fb7fb7e796a23224debad5a65245f' + '56df8e39093ea36ec7cbed7d3cfe4ce5' + '60d1b370c3910f01dc38f933069bc315' + '79e62f50656ac80eaab99189e23d886b' + 'dc1f6d454794807b6a98f4146789c0aa' + 'e3c5edc2b078880ab0dfbf15731549f3' + '03d733433697d5f0e4fddc506b89575e' + 'ab664f2e22a098f83b42c06babd9ab20') +sha256sums=('abe6317d078c4e51e322e62036b6df4a698bfe80c5be110a08894841179810ee' + '9301e3bbb7964a962f43ebe54dea77f56c1dffb91d99e23f306faefd8667c30a' + '71222cbe521abb676a0441a7e58cd58161b992d1e19e34eb0ee951c6b891e474' + '754a8ac582dc0d8d882bb4c75d1216d2a2ec892848cd5cef353183d932d7026f' + '7969ba7066cdd00ad21fdb9d84bf57955adcfc9b844b6955a0b5cb28eafe304a' + 'd66bbed46770f30198c181e6be3168ea288150800098e59874bba78dd0997ace' + '66ed152fd58e6cfaf9a4b656140587f3344ade4d79a8979c9e45b10f435f41df' + '595feaab34a49445030926d2adc6b472a513441bbb9c780c89425ae7ce97e97b' + '4b1b27b466a206e44c3059e637026d4d0e1ce12a5bf30888f5896d29ceaa530a' + 'ded9ecced92c7c91a56598e3ac1ff197e79cc08395190e9a62725b9c45603734' + '7cb99753a4c552f6d764591a8a372bf3ecfb25b2dc888316e8e7840ca208aa16' + 'fcd2764c95a5f919e9d50c018d090f7c5b7dce801f899083fca2bcd0dc20ee12' + '015f9e7c5d38df39928164d6537c3699da7d815bc91a582832714bbbbe56d49f' + 'ed70c45f0170cbe674beba1f8b7f943a9304e5c6d1843d959ceed9239740a763' + '987396baafea006467498cca8bc9d4926b8efe7b553462b9f14b1616992dd03d' + '795b2fe197bd9a5df873eb794a42a3e42de487b758fe6076fb356d1779844334' + '41cd45207f55f9b7871e05fb2068d9b3f38bd70abea9af5458a046b42dad621d' + '509c4e97621f930e59e21ff63b462831df1f6da0750afed27693aa4be0f1abff' + '23ddae7702ad49696a6a2b6c53a844f159d1972d9b420d9ea691fcf9c796de1d' + 'fa9394bdf5298847474e55c528fa5e4fe25611239c5ca9594d572b22baa4d28c') prepare() { - cd "$_pkgname-$pkgver" + cd ${_pkgname} - patch -p1 -i "$srcdir"/os-prober-frugalware.diff - patch -p1 -i "$srcdir"/os-prober-mdraidfix.patch + patch -p1 -i "$srcdir"/os-prober-newnsdirfix.patch + patch -p1 -i "$srcdir"/os-prober-1.49-fix-grub2.cfg-parsing.patch + patch -p1 -i "$srcdir"/os-prober-1.49-grub2-mount.patch + patch -p1 -i "$srcdir"/os-prober-probe-MD-devices.patch + patch -p1 -i "$srcdir"/os-prober-linux-secure-boot.patch patch -p1 -i "$srcdir"/os-prober-btrfsfix.patch - patch -p1 -i "$srcdir"/os-prober-bootpart-name-fix.patch - patch -p1 -i "$srcdir"/os-prober-mounted-partitions-fix.patch - patch -p1 -i "$srcdir"/os-prober-factor-out-logger.patch - patch -p1 -i "$srcdir"/os-prober-factored-logger-efi-fix.patch - patch -p1 -i "$srcdir"/os-prober-umount-fix.patch - patch -p1 -i "$srcdir"/os-prober-grub2-parsefix.patch - patch -p1 -i "$srcdir"/os-prober-grub2-multiple-images.patch - patch -p1 -i "$srcdir"/os-prober-grepfix.patch - patch -p1 -i "$srcdir"/os-prober-gentoo-fix.patch - patch -p1 -i "$srcdir"/fix-blkid-path.patch - patch -p1 -i "$srcdir"/os-prober-haiku-efi.patch - patch -p1 -i "$srcdir"/os-prober-no-dummy-mach-kernel.patch + patch -p1 -i "$srcdir"/os-prober-accept-ESP-on-IMSM.patch + patch -p1 -i "$srcdir"/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch + patch -p1 -i "$srcdir"/os-prober-fix-btrfs-subvol-mounted-tests.patch + patch -p1 -i "$srcdir"/os-prober-skip-part-on-multipath.patch + patch -p1 -i "$srcdir"/Improve-btrfs-handling-on-os-probing-for-grub2.patch + patch -p1 -i "$srcdir"/os-prober-btrfs-absolute-subvol.patch + patch -p1 -i "$srcdir"/os-prober-40grub-check-grub2.patch + patch -p1 -i "$srcdir"/os-prober-btrfs-snapshot-detection.patch + patch -p1 -i "$srcdir"/os-prober-btrfs-always-detect-default.patch + patch -p1 -i "$srcdir"/os-prober-05efi-blkid.patch + patch -p1 -i "$srcdir"/os-prober-multiple-initrd.patch + patch -p1 -i "$srcdir"/os-prober-make-btrfsprogs-optional.patch + patch -p1 -i "$srcdir"/os-prober-disable-debug.patch # adjust lib dir to allow detection of 64-bit distros sed -i -e "s:/lib/ld\*\.so\*:/lib*/ld*.so*:g" os-probes/mounted/common/90linux-distro - rm -f Makefile } build() { - cd "$_pkgname-$pkgver" - + cd ${_pkgname} make newns } package() { - cd "$_pkgname-$pkgver" + cd ${_pkgname} - install -Dm755 linux-boot-prober "$pkgdir"/usr/bin/linux-boot-prober - install -Dm755 os-prober "$pkgdir"/usr/bin/os-prober - install -Dm755 newns "$pkgdir"/usr/lib/os-prober/newns - install -Dm755 common.sh $pkgdir/usr/share/os-prober/common.sh + install -Dm 755 os-prober linux-boot-prober -t "${pkgdir}/usr/bin" + install -Dm 755 newns -t "${pkgdir}/usr/lib/os-prober" + install -Dm 755 common.sh -t "${pkgdir}/usr/share/os-prober" for dir in os-probes os-probes/mounted os-probes/init linux-boot-probes linux-boot-probes/mounted; do - install -dm755 "$pkgdir/usr/lib/$dir" - install -m755 -t "$pkgdir/usr/lib/$dir" "$dir"/common/* - [[ -d "$dir"/x86 ]] && cp -r "$dir"/x86/* "$pkgdir/usr/lib/$dir" + install -dm 755 "${pkgdir}/usr/lib/${dir}" + install -m 755 -t "${pkgdir}/usr/lib/${dir}" "${dir}"/common/* + [[ -d "${dir}"/x86 ]] && cp -r "${dir}"/x86/* "${pkgdir}/usr/lib/${dir}" done - install -Dm755 os-probes/mounted/powerpc/20macosx "$pkgdir"/usr/lib/os-probes/mounted/20macosx - - install -dm755 "$pkgdir"/var/lib/os-prober + install -Dm 755 os-probes/mounted/powerpc/20macosx "${pkgdir}"/usr/lib/os-probes/mounted/20macosx + install -dm 755 "${pkgdir}"/var/lib/os-prober } diff --git a/fix-blkid-path.patch b/fix-blkid-path.patch deleted file mode 100644 index f623f13863c1..000000000000 --- a/fix-blkid-path.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- os-prober-1.77/common.sh 2018-08-10 21:23:18.000000000 +0200 -+++ os-prober-1.77.new/common.sh 2019-05-13 11:35:39.198711136 +0200 -@@ -116,18 +116,18 @@ - fstype=$(lsblk --nodeps --noheading --output FSTYPE -- "$1" || true) - [ -z "$fstype" ] || { echo "$fstype"; return; } - fi -- if type blkid >/dev/null 2>&1; then -- fstype=$(blkid -o value -s TYPE "$1" 2>/dev/null || true) -+ if type /sbin/blkid >/dev/null 2>&1; then -+ fstype=$(/sbin/blkid -o value -s TYPE "$1" 2>/dev/null || true) - [ -z "$fstype" ] || { echo "$fstype"; return; } - fi - echo "NOT-DETECTED" - } - - is_dos_extended_partition() { -- if type blkid >/dev/null 2>&1; then -+ if type /sbin/blkid >/dev/null 2>&1; then - local output - -- output="$(blkid -o export $1)" -+ output="$(/sbin/blkid -o export $1)" - - # old blkid (util-linux << 2.24) errors out on extended p. - if [ "$?" = "2" ]; then -@@ -178,9 +178,9 @@ - - find_label () { - local output -- if type blkid >/dev/null 2>&1; then -+ if type /sbin/blkid >/dev/null 2>&1; then - # Hopefully everyone has blkid by now -- output="$(blkid -o device -t LABEL="$1")" || return 1 -+ output="$(/sbin/blkid -o device -t LABEL="$1")" || return 1 - echo "$output" | head -n1 - elif [ -h "/dev/disk/by-label/$1" ]; then - # Last-ditch fallback -@@ -192,9 +192,9 @@ - - find_uuid () { - local output -- if type blkid >/dev/null 2>&1; then -+ if type /sbin/blkid >/dev/null 2>&1; then - # Hopefully everyone has blkid by now -- output="$(blkid -o device -t UUID="$1")" || return 1 -+ output="$(/sbin/blkid -o device -t UUID="$1")" || return 1 - echo "$output" | head -n1 - elif [ -h "/dev/disk/by-uuid/$1" ]; then - # Last-ditch fallback diff --git a/os-prober-05efi-blkid.patch b/os-prober-05efi-blkid.patch new file mode 100644 index 000000000000..be8a6677870d --- /dev/null +++ b/os-prober-05efi-blkid.patch @@ -0,0 +1,18 @@ +Index: os-prober/os-probes/mounted/x86/05efi +=================================================================== +--- os-prober.orig/os-probes/mounted/x86/05efi ++++ os-prober/os-probes/mounted/x86/05efi +@@ -46,6 +46,13 @@ if type udevinfo > /dev/null 2>&1; then + fi + fi + ++ # udev may not work in chroot as its db may not be there, bailout that by blkid (bsc#1076779) ++ if [ -z "$ID_PART_ENTRY_TYPE" -a -z "$ID_PART_ENTRY_SCHEME" ] && ++ type blkid > /dev/null 2>&1; then ++ debug "fallback to blkid" ++ eval "$(blkid -p -o udev "$partition" | grep -E '^(ID_PART_ENTRY_(TYPE|SCHEME))=')" ++ fi ++ + debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME" + debug "$partition partition type is $ID_PART_ENTRY_TYPE" + diff --git a/os-prober-1.49-fix-grub2.cfg-parsing.patch b/os-prober-1.49-fix-grub2.cfg-parsing.patch new file mode 100644 index 000000000000..afd0ff55cd8d --- /dev/null +++ b/os-prober-1.49-fix-grub2.cfg-parsing.patch @@ -0,0 +1,55 @@ +From: Andrey Borzenkov <arvidjaar@gmail.com> +Subject: fix parsing GRUB2 grub.cfg +References: bnc#796919 + +Fix several problems in parsing of grub.cfg by +linux-boot-probes/mounted/40grub2 + +1. Look for /boot/grub2-efi/grub.cfg as well (openSUSE 12.2) + +2. It checked for literal "(on /dev/.*)" to filter out menu entries +added by another os-prober on target system. But grub.cfg now includes +TRANSLATED strings, so this check will fail if grub.cfg was created in +non-English locale. Use menu entry ID to check whether entry was added +by os-prober (it always starts with osprober-). Suggested by Vladimir +Serbienko. +Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2 +=================================================================== +--- os-prober-1.61.orig/linux-boot-probes/mounted/common/40grub2 ++++ os-prober-1.61/linux-boot-probes/mounted/common/40grub2 +@@ -43,6 +43,13 @@ parse_grub_menu () { + menuentry) + entry_result + shift 1 ++ # Currently GRUB2 puts translated strings ++ # in grub.cfg, so checking for verbatim ++ # (on /dev/.*) will fail if target grub.cfg ++ # was created in non-English locale. Extract ++ # menu entry ID and check if it starts with ++ # "osprober-" ++ id="$(echo "$line" | sed -n 's/^.*[[:space:]]\+\(\$menuentry_id_option\|--id\)[[:space:]]\+\([^[:space:]]\+\).*$/\2/p')" + # The double-quoted string is the title. + # Make sure to look at the text of the line + # before 'set' mangled it. +@@ -58,9 +65,9 @@ parse_grub_menu () { + fi + if [ -z "$title" ]; then + ignore_item=1 +- elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then ++ elif echo "$title" | grep -q '(on /dev/[^)]*)$' || echo "$id" | grep -q "^\([\"']\|\)osprober-"; then + log "Skipping entry '$title':" +- log "appears to be an automatic reference taken from another menu.lst" ++ log "appears to be an automatic reference taken from another grub.cfg" + ignore_item=1 + fi + ;; +@@ -98,6 +105,9 @@ if [ -e "$mpoint/boot/grub/grub.cfg" ] & + [ "$mpoint/boot/grub/grub.cfg" -nt "$mpoint/boot/grub/menu.lst" ]); then + debug "parsing grub.cfg" + parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg" ++elif [ -e "$mpoint/boot/grub2-efi/grub.cfg" ]; then ++ debug "parsing grub.cfg" ++ parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2-efi/grub.cfg" + elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then + debug "parsing grub.cfg" + parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg" diff --git a/os-prober-1.49-grub2-mount.patch b/os-prober-1.49-grub2-mount.patch new file mode 100644 index 000000000000..3d5d8bd74570 --- /dev/null +++ b/os-prober-1.49-grub2-mount.patch @@ -0,0 +1,68 @@ +Index: os-prober-1.76/common.sh +=================================================================== +--- os-prober-1.76.orig/common.sh ++++ os-prober-1.76/common.sh +@@ -279,8 +279,8 @@ linux_mount_boot () { + debug "found boot partition $1 for linux system on $partition, but cannot map to existing device" + else + debug "found boot partition $bootpart for linux system on $partition" +- if type grub-mount >/dev/null 2>&1 && \ +- grub-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then ++ if type grub2-mount >/dev/null 2>&1 && \ ++ grub2-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then + mounted=1 + fi + fi +Index: os-prober-1.76/linux-boot-probes/common/50mounted-tests +=================================================================== +--- os-prober-1.76.orig/linux-boot-probes/common/50mounted-tests ++++ os-prober-1.76/linux-boot-probes/common/50mounted-tests +@@ -48,11 +48,11 @@ if [ ! -d "$tmpmnt" ]; then + fi + + mounted= +-if type grub-mount >/dev/null 2>&1 && \ +- type grub-probe >/dev/null 2>&1 && \ +- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then ++if type grub2-mount >/dev/null 2>&1 && \ ++ type grub2-probe >/dev/null 2>&1 && \ ++ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then + mounted=1 +- type="$(grub-probe -d "$partition" -t fs)" ++ type="$(grub2-probe -d "$partition" -t fs)" + [ "$type" ] || type=fuseblk + fi + +Index: os-prober-1.76/os-probes/common/50mounted-tests +=================================================================== +--- os-prober-1.76.orig/os-probes/common/50mounted-tests ++++ os-prober-1.76/os-probes/common/50mounted-tests +@@ -58,11 +58,11 @@ if [ ! -d "$tmpmnt" ]; then + fi + + mounted= +-if type grub-mount >/dev/null 2>&1 && \ +- type grub-probe >/dev/null 2>&1 && \ +- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then ++if type grub2-mount >/dev/null 2>&1 && \ ++ type grub2-probe >/dev/null 2>&1 && \ ++ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then + mounted=1 +- type="$(grub-probe -d "$partition" -t fs)" || true ++ type="$(grub2-probe -d "$partition" -t fs)" || true + if [ "$type" ]; then + debug "mounted using GRUB $type filesystem driver" + else +Index: os-prober-1.76/os-probes/init/common/10filesystems +=================================================================== +--- os-prober-1.76.orig/os-probes/init/common/10filesystems ++++ os-prober-1.76/os-probes/init/common/10filesystems +@@ -3,7 +3,7 @@ + set +e # ignore errors from modprobe + + FILESYSTEMS='ext2 ext3 ext4 xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs' +-# fuse is needed to make grub-mount work. ++# fuse is needed to make grub2-mount work. + FILESYSTEMS="$FILESYSTEMS fuse" + # The Ubuntu kernel udebs put a number of filesystem modules in + # fs-{core,secondary}-modules. It's fairly cheap to check for these too. diff --git a/os-prober-40grub-check-grub2.patch b/os-prober-40grub-check-grub2.patch new file mode 100644 index 000000000000..6df6f3b1af3f --- /dev/null +++ b/os-prober-40grub-check-grub2.patch @@ -0,0 +1,19 @@ +From: Andrei Borzenkov <arvidjaar@gmail.com> +Subject: Also skip legacy grub if grub2 is found + +Check for grub.cfg also in /boot/grub2, not only in /boot/grub. +Index: os-prober/linux-boot-probes/mounted/x86/40grub +=================================================================== +--- os-prober.orig/linux-boot-probes/mounted/x86/40grub ++++ os-prober/linux-boot-probes/mounted/x86/40grub +@@ -95,7 +95,9 @@ fi + + if [ "$grubconf" ] && \ + ([ ! -e "$mpoint/boot/grub/grub.cfg" ] || \ +- [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]); then ++ [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]) && \ ++ ([ ! -e "$mpoint/boot/grub2/grub.cfg" ] || \ ++ [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub2/grub.cfg" ]); then + debug "parsing $grubconf" + parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/$grubconf" + fi diff --git a/os-prober-accept-ESP-on-IMSM.patch b/os-prober-accept-ESP-on-IMSM.patch new file mode 100644 index 000000000000..71004bc8c078 --- /dev/null +++ b/os-prober-accept-ESP-on-IMSM.patch @@ -0,0 +1,33 @@ +Index: os-prober-1.76/os-probes/mounted/x86/05efi +=================================================================== +--- os-prober-1.76.orig/os-probes/mounted/x86/05efi ++++ os-prober-1.76/os-probes/mounted/x86/05efi +@@ -28,13 +28,24 @@ if type udevadm > /dev/null 2>&1; then + fi + + if type udevinfo > /dev/null 2>&1; then +- # Skip virtual devices ++ eval "$(udevinfo -q property -n "$partition" | grep -E '^(MD_CONTAINER|ID_PART_ENTRY_(TYPE|SCHEME))=')" ++ debug "$partition container is '$MD_CONTAINER'" ++ ++ # Skip virtual devices unless they are known SW-RAID + if udevinfo -q path -n $partition | grep -q /virtual/; then +- debug "$1 is virtual device: exiting" +- exit 1 ++ # Check for Intel Matrix array ++ if [ -n "$MD_CONTAINER" ]; then ++ eval "$(udevinfo -q property -n "$MD_CONTAINER" | grep -E '^MD_METADATA=')" ++ debug "$MD_CONTAINER metadata is '$MD_METADATA'" ++ fi ++ if [ "$MD_METADATA" = imsm ]; then ++ debug "$partition is on IMSM array" ++ else ++ debug "$1 is virtual device: exiting" ++ exit 1 ++ fi + fi + +- eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')" + debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME" + debug "$partition partition type is $ID_PART_ENTRY_TYPE" + diff --git a/os-prober-bootpart-name-fix.patch b/os-prober-bootpart-name-fix.patch deleted file mode 100644 index 40a909da3f46..000000000000 --- a/os-prober-bootpart-name-fix.patch +++ /dev/null @@ -1,29 +0,0 @@ -Index: os-prober/common.sh -=================================================================== ---- os-prober.orig/common.sh -+++ os-prober/common.sh -@@ -269,7 +269,7 @@ linux_mount_boot () { - if [ "$bindfrom" != "$tmpmnt/boot" ]; then - if mount --bind "$bindfrom" "$tmpmnt/boot"; then - mounted=1 -- bootpart="$1" -+ bootpart="$tmppart" - else - debug "failed to bind-mount $bindfrom onto $tmpmnt/boot" - fi -@@ -277,6 +277,15 @@ linux_mount_boot () { - fi - if [ "$mounted" ]; then - : -+ elif [ -e "$tmppart" ]; then -+ bootpart="$tmppart" -+ boottomnt="$tmppart" -+ elif [ -e "$tmpmnt/$tmppart" ]; then -+ bootpart="$tmppart" -+ boottomnt="$tmpmnt/$tmppart" -+ elif [ -e "/target/$tmppart" ]; then -+ bootpart="$tmppart" -+ boottomnt="/target/$tmppart" - elif [ -e "$1" ]; then - bootpart="$1" - boottomnt="$1" diff --git a/os-prober-btrfs-absolute-subvol.patch b/os-prober-btrfs-absolute-subvol.patch new file mode 100644 index 000000000000..db245d022b3e --- /dev/null +++ b/os-prober-btrfs-absolute-subvol.patch @@ -0,0 +1,42 @@ +Index: os-prober/os-probes/common/50mounted-tests +=================================================================== +--- os-prober.orig/os-probes/common/50mounted-tests ++++ os-prober/os-probes/common/50mounted-tests +@@ -72,9 +72,7 @@ mounted= + + if [ "$types" = btrfs ]; then + partition="$BTRFSDEV" +-fi +- +-if type grub2-mount >/dev/null 2>&1 && \ ++elif type grub2-mount >/dev/null 2>&1 && \ + type grub2-probe >/dev/null 2>&1 && \ + grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then + mounted=1 +@@ -110,7 +108,11 @@ if [ "$mounted" ]; then + fi + done + fi +-do_unmount ++ ++if [ "$types" != "btrfs" ]; then ++ do_unmount ++ exit 1 ++fi + + # all btrfs processing here. Handle both unmounted and + # mounted subvolumes. +@@ -125,9 +127,9 @@ if [ "$types" = btrfs ]; then + exit 1 + fi + # besides regular subvols, get ro and snapshot so thet can be excluded +- subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9) +- rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9) +- sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 14) ++ subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) ++ rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) ++ sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!) + if ! umount "$tmpmnt"; then + warn "failed to umount btrfs volume on $tmpmnt" + rmdir "$tmpmnt" || true + diff --git a/os-prober-btrfs-always-detect-default.patch b/os-prober-btrfs-always-detect-default.patch new file mode 100644 index 000000000000..c96495484ed7 --- /dev/null +++ b/os-prober-btrfs-always-detect-default.patch @@ -0,0 +1,132 @@ +Index: os-prober/linux-boot-prober +=================================================================== +--- os-prober.orig/linux-boot-prober ++++ os-prober/linux-boot-prober +@@ -67,7 +67,12 @@ if [ "$type" = btrfs ]; then + fi + if [ -z "$mpoint" ]; then + # mount the btrfs root +- if ! mount -o subvol=$subvol -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then ++ ++ if [ -n "$subvol" ]; then ++ opts="-o subvol=$subvol" ++ fi ++ ++ if ! mount $opts -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then + warn "error mounting btrfs subvol=$subvol UUID=$UUID" + umount "$tmpmnt/boot" 2>/dev/null + umount "$tmpmnt" 2>/dev/null +Index: os-prober/os-probes/common/50mounted-tests +=================================================================== +--- os-prober.orig/os-probes/common/50mounted-tests ++++ os-prober/os-probes/common/50mounted-tests +@@ -114,6 +114,47 @@ if [ "$types" != "btrfs" ]; then + exit 1 + fi + ++probe_subvol () ++{ ++ local subvol=$1 ++ local partition=$2 ++ local UUID=$3 ++ local tmpmnt=$4 ++ ++ mounted= ++ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)" ++ ret=1 ++ ++ if [ -n "$subvol" ]; then ++ opts="-o subvol=$subvol" ++ fi ++ ++ if [ -n "$mpoint" ]; then ++ if [ "x$mpoint" = "x/" ]; then ++ continue # this is the root for the running system ++ fi ++ mounted=1 ++ else ++ # again, do not mount btrfs ro ++ mount -t btrfs $opts -U "$UUID" "$tmpmnt" ++ mpoint="$tmpmnt" ++ fi ++ test="/usr/lib/os-probes/mounted/90linux-distro" ++ if [ -f "$test" ] && [ -x "$test" ]; then ++ debug "running subtest $test" ++ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then ++ debug "os found by subtest $test on subvol $subvol" ++ ret=0 ++ fi ++ fi ++ if [ -z "$mounted" ]; then ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount $tmpmnt" ++ fi ++ fi ++ return $ret ++} ++ + # all btrfs processing here. Handle both unmounted and + # mounted subvolumes. + if [ "$types" = btrfs ]; then +@@ -136,45 +177,23 @@ if [ "$types" = btrfs ]; then + rmdir "$tmpmnt" || true + exit 1 + fi +- if [ -z "$subvols" ]; then +- debug "no subvols found on btrfs volume $UUID" +- exit 1 +- fi ++ + found= +- for subvol in $subvols; do +- debug "begin btrfs processing for $UUID subvol=$subvol" +- if [ "$subvol" != "$defaultvol" ]; then +- if echo "$rosubvols" | grep -q -x "$subvol"; then +- continue +- fi +- if echo "$sssubvols" | grep -q -x "$subvol"; then +- continue +- fi +- fi +- mounted= +- mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)" +- if [ -n "$mpoint" ]; then +- if [ "x$mpoint" = "x/" ]; then +- continue # this is the root for the running system +- fi +- mounted=1 +- else +- # again, do not mount btrfs ro +- mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt" +- mpoint="$tmpmnt" +- fi +- test="/usr/lib/os-probes/mounted/90linux-distro" +- if [ -f "$test" ] && [ -x "$test" ]; then +- debug "running subtest $test" +- if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then +- debug "os found by subtest $test on subvol $subvol" +- found=1 +- fi ++ # Always probe subvol or root set as default ++ if probe_subvol "$defaultvol" "$partition" "$UUID" "$tmpmnt"; then ++ found=1 ++ fi ++ ++ # Probe any other OS on subvol ++ for subvol in $subvols; do ++ if echo "$rosubvols" | grep -q -x "$subvol" || ++ echo "$sssubvols" | grep -q -x "$subvol" || ++ echo "$defaultvol" | grep -q -x "$subvol"; then ++ continue + fi +- if [ -z "$mounted" ]; then +- if ! umount "$tmpmnt"; then +- warn "failed to umount $tmpmnt" +- fi ++ debug "begin btrfs processing for $UUID subvol=$subvol" ++ if probe_subvol "$subvol" "$partition" "$UUID" "$tmpmnt"; then ++ found=1 + fi + done + rmdir "$tmpmnt" || true + diff --git a/os-prober-btrfs-snapshot-detection.patch b/os-prober-btrfs-snapshot-detection.patch new file mode 100644 index 000000000000..e68637e35252 --- /dev/null +++ b/os-prober-btrfs-snapshot-detection.patch @@ -0,0 +1,32 @@ +Index: os-prober/os-probes/common/50mounted-tests +=================================================================== +--- os-prober.orig/os-probes/common/50mounted-tests ++++ os-prober/os-probes/common/50mounted-tests +@@ -115,6 +115,7 @@ if [ "$types" = btrfs ]; then + subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) + rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) + sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!) ++ defaultvol=$(btrfs subvolume get-default "$tmpmnt" | cut -d ' ' -f 9) + if ! umount "$tmpmnt"; then + warn "failed to umount btrfs volume on $tmpmnt" + rmdir "$tmpmnt" || true +@@ -127,11 +128,13 @@ if [ "$types" = btrfs ]; then + found= + for subvol in $subvols; do + debug "begin btrfs processing for $UUID subvol=$subvol" +- if echo "$rosubvols" | grep -q -x "$subvol"; then +- continue +- fi +- if echo "$sssubvols" | grep -q -x "$subvol"; then +- continue ++ if [ "$subvol" != "$defaultvol" ]; then ++ if echo "$rosubvols" | grep -q -x "$subvol"; then ++ continue ++ fi ++ if echo "$sssubvols" | grep -q -x "$subvol"; then ++ continue ++ fi + fi + mounted= + mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)" + diff --git a/os-prober-btrfsfix.patch b/os-prober-btrfsfix.patch index 1047d249f929..d7179debaa51 100644 --- a/os-prober-btrfsfix.patch +++ b/os-prober-btrfsfix.patch @@ -1,11 +1,11 @@ -diff --git a/common.sh b/common.sh -index c2c5f46..8fb3c5f 100644 ---- a/common.sh -+++ b/common.sh +Index: os-prober/common.sh +=================================================================== +--- os-prober.orig/common.sh ++++ os-prober/common.sh @@ -155,6 +155,7 @@ parse_proc_mounts () { done } - + +# add forth parameter to pickup btrfs subvol info parsefstab () { while read -r line; do @@ -20,7 +20,7 @@ index c2c5f46..8fb3c5f 100644 esac done } - + +#check_btrfs_mounted $bootsv $bootuuid) +check_btrfs_mounted () { + bootsv="$1" @@ -34,12 +34,12 @@ index c2c5f46..8fb3c5f 100644 unescape_mount () { printf %s "$1" | \ sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g' -diff --git a/linux-boot-prober b/linux-boot-prober -index e32dc84..2a60fa2 100755 ---- a/linux-boot-prober -+++ b/linux-boot-prober +Index: os-prober/linux-boot-prober +=================================================================== +--- os-prober.orig/linux-boot-prober ++++ os-prober/linux-boot-prober @@ -5,16 +5,143 @@ set -e - + newns "$@" require_tmpdir +ERR="n" @@ -53,9 +53,9 @@ index e32dc84..2a60fa2 100755 +bootmnt= +bootsv= +bootuuid= - + grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true - + -partition="$1" +if [ -z "$1" ]; then + ERR=y @@ -75,14 +75,14 @@ index e32dc84..2a60fa2 100755 + partition="$1" + type=other +fi - + -if [ -z "$partition" ]; then +if [ "x$ERR" != xn ]; then echo "usage: linux-boot-prober partition" >&2 -+ echo " linux-boot-prober btrfs UUID=<> subvol=<>" >&2 ++ echo " linux-boot-prober partition | btrfs UUID=<> subvol=<>" >&2 exit 1 fi - + +if [ "$type" = btrfs ]; then + # handle all of the btrfs stuff here + if [ ! -e "/proc/self/mountinfo" ]; then @@ -184,24 +184,14 @@ index e32dc84..2a60fa2 100755 if ! mapped="$(mapdevfs "$partition")"; then log "Device '$partition' does not exist; skipping" continue -@@ -22,8 +149,8 @@ fi - - if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then - for test in /usr/lib/linux-boot-probes/*; do -- debug "running $test" - if [ -x $test ] && [ -f $test ]; then -+ debug "running $test" - if $test "$partition"; then - debug "linux detected by $test" - break -diff --git a/linux-boot-probes/mounted/common/40grub2 b/linux-boot-probes/mounted/common/40grub2 -index 885614e..db5cbfd 100755 ---- a/linux-boot-probes/mounted/common/40grub2 -+++ b/linux-boot-probes/mounted/common/40grub2 -@@ -2,17 +2,30 @@ +Index: os-prober/linux-boot-probes/mounted/common/40grub2 +=================================================================== +--- os-prober.orig/linux-boot-probes/mounted/common/40grub2 ++++ os-prober/linux-boot-probes/mounted/common/40grub2 +@@ -2,17 +2,27 @@ . /usr/share/os-prober/common.sh set -e - + +# add support for btrfs with no separate /boot +# that is, rootsv = bootsv partition="$1" @@ -210,16 +200,13 @@ index 885614e..db5cbfd 100755 type="$4" +rootsv="$5" +bootsv="$6" - + found_item=0 - + entry_result () { -+ if [ "x$type" = "xbtrfs" -a "$partition" = "$bootpart" ]; then ++ if [ "x$type" = "xbtrfs" -a "$rootsv" = "$bootsv" ]; then + # trim off the leading subvol + kernelfile=$(echo "$kernel" | cut -d '/' -f 2- | cut -d '/' -f 2-) -+ if [ "x$rootsv" != "x$bootsv" ]; then -+ kernelfile="/boot/$kernelfile" -+ fi + else + kernelfile=$kernel + fi @@ -230,37 +217,33 @@ index 885614e..db5cbfd 100755 result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" found_item=1 fi -diff --git a/os-prober b/os-prober -index 8852887..482c3c2 100755 ---- a/os-prober -+++ b/os-prober -@@ -76,9 +76,12 @@ partitions () { - - # Also detect OSes on LVM volumes (assumes LVM is active) - if type lvs >/dev/null 2>&1; then -- echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name | -+ echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name 2>/dev/null | +Index: os-prober/os-prober +=================================================================== +--- os-prober.orig/os-prober ++++ os-prober/os-prober +@@ -79,6 +79,9 @@ partitions () { + echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name | sed "s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")" fi + + # now lets make sure we got all of the btrfs partitions and disks -+ blkid | grep 'TYPE="btrfs"' | cut -d ':' -f 1 ++ blkid | grep btrfs | cut -d ':' -f 1 } - + parse_proc_swaps () { -@@ -136,6 +139,8 @@ if [ -f /proc/mdstat ] ; then - grep "^md" /proc/mdstat | cut -d: -f2- | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true +@@ -137,6 +140,8 @@ if [ -f /proc/mdstat ] ; then + grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true fi - + +: >"$OS_PROBER_TMP/btrfs-vols" + for partition in $(partitions); do if ! mapped="$(mapdevfs "$partition")"; then log "Device '$partition' does not exist; skipping" -@@ -154,7 +159,26 @@ for partition in $(partitions); do +@@ -155,7 +160,26 @@ for partition in $(partitions); do continue fi - + - if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then + # do btrfs processing here; both mounted and unmounted will + # be handled by 50mounted-tests so we can do a subvol only once. @@ -277,7 +260,7 @@ index 8852887..482c3c2 100755 + debug "running $test on btrfs $partition" + if "$test" btrfs "$uuid" "$partition"; then + debug "os detected by $test" -+ continue ++ continue + fi + fi + @@ -285,59 +268,34 @@ index 8852887..482c3c2 100755 for test in /usr/lib/os-probes/*; do if [ -f "$test" ] && [ -x "$test" ]; then debug "running $test on $partition" -diff --git a/os-probes/common/50mounted-tests b/os-probes/common/50mounted-tests -index 2951ef9..e33eb82 100755 ---- a/os-probes/common/50mounted-tests -+++ b/os-probes/common/50mounted-tests -@@ -19,19 +19,31 @@ do_unmount() { +Index: os-prober/os-probes/common/50mounted-tests +=================================================================== +--- os-prober.orig/os-probes/common/50mounted-tests ++++ os-prober/os-probes/common/50mounted-tests +@@ -19,7 +19,19 @@ do_unmount() { rmdir "$tmpmnt" || true } - + -types="$(fs_type "$partition")" +if [ "x$1" = xbtrfs ]; then -+ types=btrfs -+ if [ -z "$2" -o -z "$3" ]; then -+ debug "missing btrfs parameters, exiting" -+ exit 1 -+ fi -+ UUID="$2" -+ BTRFSDEV="$3" ++ types=btrfs ++ if [ -z "$2" -o -z "$3" ]; then ++ debug "missing btrfs parameters, exiting" ++ exit 1 ++ fi ++ UUID="$2" ++ BTRFSDEV="$3" +else -+ partition="$1" -+ types="$(fs_type "$partition")" || types=NOT-DETECTED ++ partition="$1" ++ types="$(fs_type "$partition")" +fi + if [ "$types" = NOT-DETECTED ]; then debug "$1 type not recognised; skipping" -- exit 0 -+ exit 1 - elif [ "$types" = swap ]; then - debug "$1 is a swap partition; skipping" -- exit 0 -+ exit 1 - elif [ "$types" = crypto_LUKS ]; then - debug "$1 is a LUKS partition; skipping" -- exit 0 -+ exit 1 - elif [ "$types" = LVM2_member ]; then - debug "$1 is an LVM member; skipping" -- exit 0 -+ exit 1 - elif [ "$types" = ntfs ]; then - if type ntfs-3g >/dev/null 2>&1; then - types='ntfs-3g ntfs' -@@ -40,7 +52,7 @@ elif [ -z "$types" ]; then - if type cryptsetup >/dev/null 2>&1 && \ - cryptsetup luksDump "$partition" >/dev/null 2>&1; then - debug "$1 is a LUKS partition; skipping" -- exit 0 -+ exit 1 - fi - for type in $(grep -v nodev /proc/filesystems); do - # hfsplus filesystems are mountable as hfs. Try hfs last so -@@ -63,6 +75,108 @@ if [ ! -d "$tmpmnt" ]; then + exit 0 +@@ -66,6 +78,76 @@ if [ ! -d "$tmpmnt" ]; then fi - + mounted= + +# all btrfs processing here. Handle both unmounted and @@ -362,77 +320,45 @@ index 2951ef9..e33eb82 100755 + rmdir "$tmpmnt" || true + exit 1 + fi -+ ++ if [ -z "$subvols" ]; then ++ debug "no subvols found on btrfs volume $UUID" ++ exit 1 ++ fi + found= -+ mounted= -+ -+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | cut -d ' ' -f 5)" -+ if [ -n "$mpoint" -a "x$mpoint" = "x/" ]; then -+ debug "This is the root for the running system" #running system must be done elsewhere -+ else -+ #partition was not root of running system, so lets look for bootable subvols -+ if [ -n "$mpoint" ] ; then -+ mounted=1 #partition was already mounted,so lets not unmount it when done -+ else -+ # again, do not mount btrfs ro -+ mount -t btrfs -U "$UUID" "$tmpmnt" -+ mpoint="$tmpmnt" -+ fi -+ -+ test="/usr/lib/os-probes/mounted/90linux-distro" -+ if [ -f "$test" ] && [ -x "$test" ]; then -+ debug "running subtest $test" -+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID"; then -+ debug "os found by subtest $test on $partition" -+ found=1 ++ for subvol in $subvols; do ++ debug "begin btrfs processing for $UUID subvol=$subvol" ++ if echo "$rosubvols" | grep -q -x "$subvol"; then ++ continue + fi -+ fi -+ if [ -z "$mounted" ]; then -+ if ! umount "$tmpmnt"; then -+ warn "failed to umount $tmpmnt" ++ if echo "$sssubvols" | grep -q -x "$subvol"; then ++ continue + fi -+ fi -+ fi -+ -+ if [ -z "$subvols" ]; then -+ debug "no subvols found on btrfs volume $UUID" -+ else -+ found= -+ for subvol in $subvols; do -+ debug "begin btrfs processing for $UUID subvol=$subvol" -+ if echo "$rosubvols" | grep -q -x "$subvol"; then -+ continue ++ mounted= ++ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)" ++ if [ -n "$mpoint" ]; then ++ if [ "x$mpoint" = "x/" ]; then ++ continue # this is the root for the running system + fi -+ if echo "$sssubvols" | grep -q -x "$subvol"; then -+ continue -+ fi -+ mounted= -+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)" -+ if [ -n "$mpoint" ]; then -+ if [ "x$mpoint" = "x/" ]; then -+ continue # this is the root for the running system -+ fi -+ mounted=1 -+ else -+ # again, do not mount btrfs ro -+ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt" -+ mpoint="$tmpmnt" -+ fi -+ test="/usr/lib/os-probes/mounted/90linux-distro" -+ if [ -f "$test" ] && [ -x "$test" ]; then -+ debug "running subtest $test" -+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then -+ debug "os found by subtest $test on subvol $subvol" -+ found=1 -+ fi ++ mounted=1 ++ else ++ # again, do not mount btrfs ro ++ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt" ++ mpoint="$tmpmnt" ++ fi ++ test="/usr/lib/os-probes/mounted/90linux-distro" ++ if [ -f "$test" ] && [ -x "$test" ]; then ++ debug "running subtest $test" ++ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then ++ debug "os found by subtest $test on subvol $subvol" ++ found=1 + fi -+ if [ -z "$mounted" ]; then -+ if ! umount "$tmpmnt"; then -+ warn "failed to umount $tmpmnt" -+ fi ++ fi ++ if [ -z "$mounted" ]; then ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount $tmpmnt" + fi -+ done -+ fi ++ fi ++ done + rmdir "$tmpmnt" || true + if [ "$found" ]; then + exit 0 @@ -441,25 +367,25 @@ index 2951ef9..e33eb82 100755 + fi +fi + - if type grub-mount >/dev/null 2>&1 && \ - type grub-probe >/dev/null 2>&1 && \ - grub-mount "$partition" "$tmpmnt" 2>/dev/null; then -diff --git a/os-probes/mounted/common/90linux-distro b/os-probes/mounted/common/90linux-distro -index badfbb1..9bc5154 100755 ---- a/os-probes/mounted/common/90linux-distro -+++ b/os-probes/mounted/common/90linux-distro + if type grub2-mount >/dev/null 2>&1 && \ + type grub2-probe >/dev/null 2>&1 && \ + grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then +Index: os-prober/os-probes/mounted/common/90linux-distro +=================================================================== +--- os-prober.orig/os-probes/mounted/common/90linux-distro ++++ os-prober/os-probes/mounted/common/90linux-distro @@ -7,6 +7,8 @@ set -e partition="$1" dir="$2" type="$3" +uuid="$4" +subvol="$5" - + # This test is inaccurate, but given separate / and /boot partitions and the # fact that only some architectures have ld-linux.so, I can't see anything -@@ -143,7 +145,11 @@ if (ls "$dir"/lib*/ld*.so* && [ -d "$dir/boot" ] || ls "$dir"/usr/lib*/ld*.so*) +@@ -143,7 +145,11 @@ if (ls "$dir"/lib*/ld*.so* && [ -d "$dir fi - + label="$(count_next_label "$short")" - result "$partition:$long:$label:linux" + if [ "x$type" = "xbtrfs" -a "x$uuid" != "x" -a "x$subvol" != "x" ]; then @@ -470,3 +396,24 @@ index badfbb1..9bc5154 100755 exit 0 else exit 1 +Index: os-prober/README.btrfs +=================================================================== +--- /dev/null ++++ os-prober/README.btrfs +@@ -0,0 +1,15 @@ ++BTRFS is a new filesystem which combines the filesystem with logical volume ++management (subvolumes). For further information, see: ++ https://btrfs.wiki.kernel.org/index.php/Main_Page ++ https://btrfs.wiki.kernel.org/index.php/FAQ ++ ++In order to support BTRFS, a number of changes were necessary to os-prober, ++os-probes/common/50mounted-tests, os-probes/mounted/common/90linux-distro, ++linux-boot-prober, and linux-boot-probes/common/50mounted-tests. ++ ++The biggest impact will be to grub2 where there is additional information ++output by os-prober and where, if a BTRFS subvolume is being used for root, ++the parameters for linux-boot-prober have changed. ++ ++Sun 30 Dec 2012 11:49:52 AM EST Gene Czarcinski <gene@czarc.net> ++ + diff --git a/os-prober-disable-debug.patch b/os-prober-disable-debug.patch new file mode 100644 index 000000000000..9811f6287600 --- /dev/null +++ b/os-prober-disable-debug.patch @@ -0,0 +1,14 @@ +Index: os-prober-1.79/common.sh +=================================================================== +--- os-prober-1.79.orig/common.sh ++++ os-prober-1.79/common.sh +@@ -66,7 +66,7 @@ warn() { + } + + debug() { +- if [ -z "$OS_PROBER_DISABLE_DEBUG" ]; then ++ if [ "x${OS_PROBER_ENABLE_DEBUG}" = xyes ] || [ "x${OS_PROBER_ENABLE_DEBUG}" = xy ]; then + log "debug: $@" + fi + } + diff --git a/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch b/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch new file mode 100644 index 000000000000..62443f7fbe4e --- /dev/null +++ b/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch @@ -0,0 +1,93 @@ +Index: os-prober-1.76/os-probes/common/50mounted-tests +=================================================================== +--- os-prober-1.76.orig/os-probes/common/50mounted-tests ++++ os-prober-1.76/os-probes/common/50mounted-tests +@@ -49,19 +49,13 @@ elif [ -z "$types" ]; then + debug "$1 is a LUKS partition; skipping" + exit 0 + fi +- for type in $(grep -v nodev /proc/filesystems); do +- # hfsplus filesystems are mountable as hfs. Try hfs last so +- # that we can tell the difference. +- if [ "$type" = hfs ]; then +- delaytypes="${delaytypes:+$delaytypes }$type" +- elif [ "$type" = fuseblk ]; then +- if type ntfs-3g >/dev/null 2>&1; then +- types="${types:+$types }ntfs-3g" +- fi +- else +- types="${types:+$types }$type" +- fi +- done ++ ++ # Simply skip such partition is better than trying to detect ++ # it by blinded test mounts with all kinds of kernel file system, ++ # that would lead to unwanted consequence like kernel oops and ++ # risk to corrupt your system and data. ++ debug "$1 is a partition without file system; skipping" ++ exit 0 + fi + + tmpmnt=/var/lib/os-prober/mount +Index: os-prober-1.76/os-probes/init/common/10filesystems +=================================================================== +--- os-prober-1.76.orig/os-probes/init/common/10filesystems ++++ os-prober-1.76/os-probes/init/common/10filesystems +@@ -1,39 +1,19 @@ + #!/bin/sh + # Make sure filesystems are available. +-set +e # ignore errors from modprobe +- +-FILESYSTEMS='ext2 ext3 ext4 xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs' +-# fuse is needed to make grub2-mount work. +-FILESYSTEMS="$FILESYSTEMS fuse" +-# The Ubuntu kernel udebs put a number of filesystem modules in +-# fs-{core,secondary}-modules. It's fairly cheap to check for these too. +-FILESYSTEMS="$FILESYSTEMS fs-core fs-secondary" +- +-if [ ! -e /var/lib/os-prober/modules ]; then +- # Check for anna-install to make it easier to use os-prober outside +- # d-i. +- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then +- for fs in $FILESYSTEMS; do +- ANNA_QUIET=1 DEBIAN_FRONTEND=none \ +- log-output -t os-prober \ +- anna-install "$fs-modules" || true +- done +- depmod -a >/dev/null 2>&1 || true +- fi +- +- for fs in $FILESYSTEMS; do +- case "$fs" in +- fs-*) +- ;; +- *) +- modprobe "$fs" 2>/dev/null | logger -t os-prober +- ;; +- esac +- done +- +- # We only want to keep this state inside d-i, so this is as good a +- # check as any. +- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then +- touch /var/lib/os-prober/modules +- fi +-fi ++set -e ++ ++# Make sure fuse is available for grub2-mount ++# As long as we use grub2-mount, we use grub2's own file system modules ++# to mount the partitiion and the operation don't require kernel support ++# other than fuse. ++if ! cat /proc/filesystems | grep nodev | cut -f2 | grep -qw fuse; then ++ modprobe fuse 2>&1 | logger -t os-prober ++fi ++# Regarding file systems not supported by grub2, or systems simply don't ++# have grub2-mount, will use linux 'mount' utility. This will require ++# kernel file system module to work, but still we don't need to modprobe ++# all of them before mount, because mount() syscall will take care of it ++# by __request_module the needed kernel module and we should leave it do ++# that for us in order to have only needed modules get loaded. ++# ++# Still if you want any kernel module loaded, add them here. + diff --git a/os-prober-factor-out-logger.patch b/os-prober-factor-out-logger.patch deleted file mode 100644 index 52cb7ceabb0c..000000000000 --- a/os-prober-factor-out-logger.patch +++ /dev/null @@ -1,107 +0,0 @@ -Index: os-prober/common.sh -=================================================================== ---- os-prober.orig/common.sh -+++ os-prober/common.sh -@@ -62,10 +62,14 @@ cache_progname() { - esac - } - --log() { -- cache_progname -- logger -t "$progname" "$@" --} -+# fd_logger: bind value now, possibly after assigning default. -+eval ' -+ log() { -+ cache_progname -+ echo "$progname: $@" 1>&'${fd_logger:=9}' -+ } -+' -+export fd_logger # so subshells inherit current value by default - - error() { - log "error: $@" -@@ -81,10 +85,14 @@ debug() { - fi - } - --result () { -- log "result:" "$@" -- echo "$@" --} -+# fd_result: bind value now, possibly after assigning default. -+eval ' -+ result() { -+ log "result:" "$@" -+ echo "$@" 1>&'${fd_result:=1}' -+ } -+' -+export fd_result # so subshells inherit current value by default - - # shim to make it easier to use os-prober outside d-i - if ! type mapdevfs >/dev/null 2>&1; then -Index: os-prober/linux-boot-prober -=================================================================== ---- os-prober.orig/linux-boot-prober -+++ os-prober/linux-boot-prober -@@ -1,4 +1,12 @@ - #!/bin/sh -+ -+# dash shell does not have "{varname}>&1" feature that bash shell has -+# for auto-assignment of new filedescriptors. -+# It is cumbersome to write the 'eval' to use our own variables in redirections. -+# Therefore use fixed numbers. -+export fd_result=3 # file descriptor for external results -+export fd_logger=9 # file descriptor for input to logger -+ - . /usr/share/os-prober/common.sh - - set -e -@@ -19,6 +27,7 @@ bootuuid= - - grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true - -+( ( - if [ -z "$1" ]; then - ERR=y - elif [ "$1" = btrfs -a -z "$2" ]; then -@@ -186,3 +195,5 @@ else - fi - fi - fi -+) 9>&1 | logger 1>&- # fd_logger -+) 3>&1 # fd_result -Index: os-prober/os-prober -=================================================================== ---- os-prober.orig/os-prober -+++ os-prober/os-prober -@@ -1,7 +1,14 @@ - #!/bin/sh - set -e - --. /usr/share/os-prober/common.sh -+# dash shell does not have "{varname}>&1" feature that bash shell has -+# for auto-assignment of new filedescriptors. -+# It is cumbersome to write the 'eval' to use our own variables in redirections. -+# Therefore use fixed numbers. -+export fd_result=3 # file descriptor for external results -+export fd_logger=9 # file descriptor for input to logger -+ -+ . /usr/share/os-prober/common.sh - - newns "$@" - require_tmpdir -@@ -136,6 +143,7 @@ fi - - : >"$OS_PROBER_TMP/btrfs-vols" - -+( ( - for partition in $(partitions); do - if ! mapped="$(mapdevfs "$partition")"; then - log "Device '$partition' does not exist; skipping" -@@ -200,3 +208,5 @@ for partition in $(partitions); do - fi - fi - done -+) 9>&1 | logger 1>&- # fd_logger -+) 3>&1 # fd_result diff --git a/os-prober-factored-logger-efi-fix.patch b/os-prober-factored-logger-efi-fix.patch deleted file mode 100644 index 5c66fa00bb8d..000000000000 --- a/os-prober-factored-logger-efi-fix.patch +++ /dev/null @@ -1,16 +0,0 @@ -Index: os-prober/os-probes/mounted/x86/05efi -=================================================================== ---- os-prober.orig/os-probes/mounted/x86/05efi -+++ os-prober/os-probes/mounted/x86/05efi -@@ -59,7 +59,11 @@ ret=1 - for test in /usr/lib/os-probes/mounted/efi/*; do - debug "running subtest $test" - if [ -f "$test" ] && [ -x "$test" ]; then -+ # we need results of subtest in stdout -+ orig_fd_res=$fd_result -+ export fd_result=1 - entry=$("$test" "$mpoint/$efi") -+ export fd_result=$orig_fd_res - if [ -n "$entry" ]; then - debug "bootloader $entry found by subtest $test" - ret=0 diff --git a/os-prober-fix-btrfs-subvol-mounted-tests.patch b/os-prober-fix-btrfs-subvol-mounted-tests.patch new file mode 100644 index 000000000000..0b87a30f0416 --- /dev/null +++ b/os-prober-fix-btrfs-subvol-mounted-tests.patch @@ -0,0 +1,85 @@ +Index: os-prober-1.76/os-probes/common/50mounted-tests +=================================================================== +--- os-prober-1.76.orig/os-probes/common/50mounted-tests ++++ os-prober-1.76/os-probes/common/50mounted-tests +@@ -65,10 +65,40 @@ fi + + mounted= + ++if [ "$types" = btrfs ]; then ++ partition="$BTRFSDEV" ++fi ++ ++if type grub2-mount >/dev/null 2>&1 && \ ++ type grub2-probe >/dev/null 2>&1 && \ ++ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then ++ mounted=1 ++ type="$(grub2-probe -d "$partition" -t fs)" || true ++ if [ "$type" ]; then ++ debug "mounted using GRUB $type filesystem driver" ++ else ++ debug "mounted using GRUB, but unknown filesystem?" ++ type=fuseblk ++ fi ++fi ++ ++if [ "$mounted" ]; then ++ for test in /usr/lib/os-probes/mounted/*; do ++ debug "running subtest $test" ++ if [ -f "$test" ] && [ -x "$test" ]; then ++ if "$test" "$partition" "$tmpmnt" "$type"; then ++ debug "os found by subtest $test" ++ do_unmount ++ exit 0 ++ fi ++ fi ++ done ++fi ++do_unmount ++ + # all btrfs processing here. Handle both unmounted and + # mounted subvolumes. + if [ "$types" = btrfs ]; then +- partition="$BTRFSDEV" + debug "begin btrfs processing for $UUID" + # note that the btrfs volume must not be mounted ro + if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then +@@ -129,37 +159,8 @@ if [ "$types" = btrfs ]; then + rmdir "$tmpmnt" || true + if [ "$found" ]; then + exit 0 +- else +- exit 1 +- fi +-fi +- +-if type grub2-mount >/dev/null 2>&1 && \ +- type grub2-probe >/dev/null 2>&1 && \ +- grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then +- mounted=1 +- type="$(grub2-probe -d "$partition" -t fs)" || true +- if [ "$type" ]; then +- debug "mounted using GRUB $type filesystem driver" +- else +- debug "mounted using GRUB, but unknown filesystem?" +- type=fuseblk + fi + fi + +-if [ "$mounted" ]; then +- for test in /usr/lib/os-probes/mounted/*; do +- debug "running subtest $test" +- if [ -f "$test" ] && [ -x "$test" ]; then +- if "$test" "$partition" "$tmpmnt" "$type"; then +- debug "os found by subtest $test" +- do_unmount +- exit 0 +- fi +- fi +- done +-fi +-do_unmount +- + # No tests found anything. + exit 1 + diff --git a/os-prober-frugalware.diff b/os-prober-frugalware.diff deleted file mode 100644 index b1c99e4b9d09..000000000000 --- a/os-prober-frugalware.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/os-probes/mounted/common/90linux-distro b/os-probes/mounted/common/90linux-distro -index 144320f..d5158cf 100755 ---- a/os-probes/mounted/common/90linux-distro -+++ b/os-probes/mounted/common/90linux-distro -@@ -111,7 +111,7 @@ if ls "$dir"/lib*/ld*.so* >/dev/null 2>/dev/null; then - long="Caldera OpenLinux" - elif [ -e "$dir/etc/frugalware-release" ]; then - short="Frugalware Linux" -- long="$(cat "$dir/etc/frugalware-release")" -+ long="$(cat $dir/etc/frugalware-release) - $(ls $dir/boot/vmlinuz-*|sed -n 's|.*vmlinuz-||;$ p')" - elif [ -e "$dir/etc/kdemar-release" ]; then - short="K-DEMar" - long="$(printf "K-DEMar GNU/Linux (%s)\n" "$(cat "$dir/etc/kdemar-release")")" diff --git a/os-prober-gentoo-fix.patch b/os-prober-gentoo-fix.patch deleted file mode 100644 index 8545db25de8c..000000000000 --- a/os-prober-gentoo-fix.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: os-prober/linux-boot-probes/mounted/common/90fallback -=================================================================== ---- os-prober.orig/linux-boot-probes/mounted/common/90fallback -+++ os-prober/linux-boot-probes/mounted/common/90fallback -@@ -33,7 +33,7 @@ for kernpat in /vmlinuz /vmlinux /boot/v - # Dracut initramfses are named differently again. - initrdname3=$(echo "$kernfile" | sed "s/vmlinu[zx]/initramfs\*/" | sed 's/$/.img/') - # And Gentoo's also -- initrdname4=$(echo "$kernfile" | sed "s/kernel/initramfs\*/") -+ initrdname4=$(echo "$kernfile" | sed "s/kernel\|vmlinu[zx]/initramfs\*/") - foundinitrd=0 - for initrd in $(eval ls "$initrdname" "$initrdname1" "$initrdname2" "$initrdname3" "$initrdname4" 2>/dev/null); do - if [ "$initrd" != "$kernfile" ] && [ -f "$initrd" ] && [ ! -L "$initrd" ]; then diff --git a/os-prober-grepfix.patch b/os-prober-grepfix.patch deleted file mode 100644 index 4dadd4f57bab..000000000000 --- a/os-prober-grepfix.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: os-prober/os-probes/mounted/x86/83haiku -=================================================================== ---- os-prober.orig/os-probes/mounted/x86/83haiku -+++ os-prober/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" diff --git a/os-prober-grub2-multiple-images.patch b/os-prober-grub2-multiple-images.patch deleted file mode 100644 index fe2debfe22cf..000000000000 --- a/os-prober-grub2-multiple-images.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff -rupN os-prober.old/linux-boot-probes/mounted/common/40grub2 os-prober/linux-boot-probes/mounted/common/40grub2 ---- os-prober.old/linux-boot-probes/mounted/common/40grub2 2015-07-30 15:47:15.487062200 +0200 -+++ os-prober/linux-boot-probes/mounted/common/40grub2 2015-07-30 15:53:39.593770984 +0200 -@@ -78,10 +78,10 @@ parse_grub_menu () { - fi - ;; - initrd*) -- initrd="$(echo "$2" | sed 's/(.*)//')" -- # Initrd same. - if [ "$partition" != "$bootpart" ]; then -- initrd="/boot$initrd" -+ initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s|/|/boot/|g;s/(.*)//')" -+ else -+ initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s/(.*)//')" - fi - ;; - "}") -diff -rupN os-prober.old/linux-boot-probes/mounted/x86/40grub os-prober/linux-boot-probes/mounted/x86/40grub ---- os-prober.old/linux-boot-probes/mounted/x86/40grub 2015-07-30 15:47:15.487062200 +0200 -+++ os-prober/linux-boot-probes/mounted/x86/40grub 2015-07-30 15:57:00.508864273 +0200 -@@ -66,10 +66,10 @@ parse_grub_menu () { - initrd) - # Hack alert take 2: sed off any (hdn,n) - # See #566102 -- initrd="$(echo "$2" | sed 's/(.*)//')" -- # Initrd same. - if [ "$partition" != "$bootpart" ]; then -- initrd="/boot$initrd" -+ initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s|/|/boot/|g;s/(.*)//')" -+ else -+ initrd="$(echo "$line" | sed 's/initrd//;s/\t//;s/(.*)//')" - fi - ;; - boot) diff --git a/os-prober-grub2-parsefix.patch b/os-prober-grub2-parsefix.patch deleted file mode 100644 index 0ef8bdafacce..000000000000 --- a/os-prober-grub2-parsefix.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: os-prober-1.58/linux-boot-probes/mounted/common/40grub2 -=================================================================== ---- os-prober-1.58.orig/linux-boot-probes/mounted/common/40grub2 -+++ os-prober-1.58/linux-boot-probes/mounted/common/40grub2 -@@ -77,7 +77,7 @@ parse_grub_menu () { - ignore_item=1 - fi - ;; -- linux) -+ linux*) - # Hack alert: sed off any (hdn,n) but - # assume the kernel is on the same - # partition. -@@ -90,7 +90,7 @@ parse_grub_menu () { - kernel="/boot$kernel" - fi - ;; -- initrd) -+ initrd*) - initrd="$(echo "$2" | sed 's/(.*)//')" - # Initrd same. - if [ "$partition" != "$bootpart" ]; then diff --git a/os-prober-haiku-efi.patch b/os-prober-haiku-efi.patch deleted file mode 100644 index 1c85a8d9af62..000000000000 --- a/os-prober-haiku-efi.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/os-probes/mounted/x86/83haiku b/os-probes/mounted/x86/83haiku -index 6de7a1d..4bbe71b 100755 ---- a/os-probes/mounted/x86/83haiku -+++ b/os-probes/mounted/x86/83haiku -@@ -7,6 +7,12 @@ partition="$1" - mpoint="$2" - type="$3" - -+# This script looks for legacy BIOS bootloaders only. Skip if running UEFI -+if [ -d /sys/firmware/efi ] && [ ! -f /var/lib/partman/ignore_uefi ]; then -+ debug "Skipping legacy bootloaders on UEFI system" -+ exit 1 -+fi -+ - # Weed out stuff that doesn't apply to us - case "$type" in - befs|befs_be) debug "$partition is a BeFS partition" ;; -diff --git a/os-probes/mounted/x86/efi/30haiku b/os-probes/mounted/x86/efi/30haiku -new file mode 100755 -index 0000000..25687a5 ---- /dev/null -+++ b/os-probes/mounted/x86/efi/30haiku -@@ -0,0 +1,25 @@ -+#!/bin/sh -+# Detects Haiku on BeFS partitions. -+ -+. /usr/share/os-prober/common.sh -+ -+efi="$1" -+ -+found= -+for boot in $(item_in_dir boot "$efi"); do -+ haikuefi=$(item_in_dir haikux64.efi "$efi/$boot") -+ if [ -n "$haikuefi" ]; then -+ long="Haiku EFI Boot Mgr" -+ short=Haiku -+ path="$boot/$haikuefi" -+ found=true -+ break -+ fi -+done -+ -+ -+if [ -n "$found" ]; then -+ label="$(count_next_label "$short")" -+ result "${path}:${long}:${label}" -+fi -+exit 0 diff --git a/os-prober-linux-secure-boot.patch b/os-prober-linux-secure-boot.patch new file mode 100644 index 000000000000..664f21c5d170 --- /dev/null +++ b/os-prober-linux-secure-boot.patch @@ -0,0 +1,30 @@ +From: Andrey Borzenkov <arvidjaar@gmail.com> +Subject: detect linuxefi/initrdefi secure bootloaders too +Reference: bnc#810912 + +Recognize initrdefi and linuxefi too. Whether linux/initrd or +linuxefi/initrdefi will be emitted is controlled by SECURE_BOOT +setting in /etc/sysconfig/bootloader. +Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2 +=================================================================== +--- os-prober-1.61.orig/linux-boot-probes/mounted/common/40grub2 ++++ os-prober-1.61/linux-boot-probes/mounted/common/40grub2 +@@ -71,7 +71,7 @@ parse_grub_menu () { + ignore_item=1 + fi + ;; +- linux) ++ linux|linuxefi) + # Hack alert: sed off any (hdn,n) but + # assume the kernel is on the same + # partition. +@@ -84,7 +84,7 @@ parse_grub_menu () { + kernel="/boot$kernel" + fi + ;; +- initrd) ++ initrd|initrdefi) + initrd="$(echo "$2" | sed 's/(.*)//')" + # Initrd same. + if [ "$partition" != "$bootpart" ]; then + diff --git a/os-prober-make-btrfsprogs-optional.patch b/os-prober-make-btrfsprogs-optional.patch new file mode 100644 index 000000000000..057edc29e780 --- /dev/null +++ b/os-prober-make-btrfsprogs-optional.patch @@ -0,0 +1,31 @@ +ndex: os-prober-1.76/os-probes/common/50mounted-tests +=================================================================== +--- os-prober-1.76.orig/os-probes/common/50mounted-tests ++++ os-prober-1.76/os-probes/common/50mounted-tests +@@ -151,11 +151,20 @@ if [ "$types" = btrfs ]; then + rmdir "$tmpmnt" || true + exit 1 + fi +- # besides regular subvols, get ro and snapshot so thet can be excluded +- subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) +- rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) +- sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!) +- defaultvol=$(btrfs subvolume get-default "$tmpmnt" | cut -d ' ' -f 9) ++ ++ if type btrfs >/dev/null 2>&1; then ++ # besides regular subvols, get ro and snapshot so thet can be excluded ++ subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) ++ rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!) ++ sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!) ++ defaultvol=$(btrfs subvolume get-default "$tmpmnt" | cut -d ' ' -f 9) ++ else ++ subvols="" ++ rosubvols="" ++ sssubvols="" ++ defaultvol="" ++ fi ++ + if ! umount "$tmpmnt"; then + warn "failed to umount btrfs volume on $tmpmnt" + rmdir "$tmpmnt" || true + diff --git a/os-prober-mdraidfix.patch b/os-prober-mdraidfix.patch deleted file mode 100644 index 33a432dea5bc..000000000000 --- a/os-prober-mdraidfix.patch +++ /dev/null @@ -1,25 +0,0 @@ -Index: os-prober/os-prober -=================================================================== ---- os-prober.orig/os-prober -+++ os-prober/os-prober -@@ -64,6 +64,11 @@ partitions () { - exit 0 - fi - -+ # Add MD RAID devices -+ if [ -f /proc/mdstat ] ; then -+ awk '/^md/ {printf "/dev/"$1"\n"}' /proc/mdstat -+ fi -+ - # Also detect OSes on LVM volumes (assumes LVM is active) - if type lvs >/dev/null 2>&1; then - echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name | -@@ -123,7 +128,7 @@ if [ -f /proc/swaps ]; then - fi - : >"$OS_PROBER_TMP/raided-map" - if [ -f /proc/mdstat ] ; then -- grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true -+ grep "^md" /proc/mdstat | cut -d: -f2- | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true - fi - - for partition in $(partitions); do diff --git a/os-prober-mounted-partitions-fix.patch b/os-prober-mounted-partitions-fix.patch deleted file mode 100644 index aecfc9f971c8..000000000000 --- a/os-prober-mounted-partitions-fix.patch +++ /dev/null @@ -1,26 +0,0 @@ -Index: os-prober/common.sh -=================================================================== ---- os-prober.orig/common.sh -+++ os-prober/common.sh -@@ -146,7 +146,7 @@ parse_proc_mounts () { - set -f - set -- $line - set +f -- printf '%s %s %s\n' "$(mapdevfs "$1")" "$2" "$3" -+ printf '%s %s %s %s\n' "$(mapdevfs "$1")" "$2" "$3" "$1" - done - } - -Index: os-prober/linux-boot-prober -=================================================================== ---- os-prober.orig/linux-boot-prober -+++ os-prober/linux-boot-prober -@@ -167,7 +167,7 @@ else - bootpart="${mountboot%% *}" - bootmounted="${mountboot#* }" - else -- bootpart="$partition" -+ bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)" - bootmounted=0 - fi - for test in /usr/lib/linux-boot-probes/mounted/*; do diff --git a/os-prober-multiple-initrd.patch b/os-prober-multiple-initrd.patch new file mode 100644 index 000000000000..e390bc259d42 --- /dev/null +++ b/os-prober-multiple-initrd.patch @@ -0,0 +1,33 @@ +Index: os-prober/linux-boot-probes/mounted/common/40grub2 +=================================================================== +--- os-prober.orig/linux-boot-probes/mounted/common/40grub2 ++++ os-prober/linux-boot-probes/mounted/common/40grub2 +@@ -19,11 +19,11 @@ entry_result () { + # if path is not relative to subvolume make it relative + kernel=${kernel#${bsv}} + kernelfile=$kernel +- initrd=${initrd#${bsv}} ++ initrd=`echo $initrd | sed -e "s!^${bsv}!!" -e "s!\\(\\s\\)${bsv}!\\1!g"` + if [ "x$GRUB_FS" != "xbtrfs" -o "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" != "xtrue" ]; then + # absolute path needed: prepend subvolume if $kernel isn't empty + kernel=${kernel:+${bsv}}${kernel} +- initrd=${initrd:+${bsv}}${initrd} ++ initrd=`echo $initrd | sed -e "s!\\(\\S\\+\\)!${bsv}\\1!g"` + fi + # assumed: rootsv != bootsv if rootsv isn't ancestor of bootsv + [ "$partition" != "$bootpart" -o "$rootsv" != "$bootsv" ] && kernelfile="/boot${kernelfile}" +@@ -105,10 +105,11 @@ parse_grub_menu () { + fi + ;; + initrd|initrdefi|initrd16) +- initrd="$(echo "$2" | sed 's/(.*)//')" ++ shift ++ initrd="$(echo "$@" | sed 's/(\S*)//g')" + # Initrd same. + if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then +- initrd="/boot$initrd" ++ initrd=`echo $initrd | sed -e 's!\(\S\+\)!/boot\1!g'` + fi + ;; + "}") + diff --git a/os-prober-newnsdirfix.patch b/os-prober-newnsdirfix.patch new file mode 100644 index 000000000000..ccd60c323ef1 --- /dev/null +++ b/os-prober-newnsdirfix.patch @@ -0,0 +1,10 @@ +diff -up os-prober-1.46/common.sh.newnsmove os-prober-1.46/common.sh +--- os-prober-1.46/common.sh.newnsmove 2011-04-10 05:30:57.000000000 +0430 ++++ os-prober-1.46/common.sh 2011-05-04 04:08:09.603020037 +0430 +@@ -1,5 +1,5 @@ + newns () { +- [ "$OS_PROBER_NEWNS" ] || exec /usr/lib/os-prober/newns "$0" "$@" ++ [ "$OS_PROBER_NEWNS" ] || exec /usr/lib/newns "$0" "$@" + } + + cleanup_tmpdir=false diff --git a/os-prober-no-dummy-mach-kernel.patch b/os-prober-no-dummy-mach-kernel.patch deleted file mode 100644 index b9e1254150e4..000000000000 --- a/os-prober-no-dummy-mach-kernel.patch +++ /dev/null @@ -1,22 +0,0 @@ -From f71f7eb5c492720c24033901ef8c6c420e188ff2 Mon Sep 17 00:00:00 2001 -From: Peter Jones <pjones@redhat.com> -Date: Thu, 10 May 2012 14:47:35 -0400 -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(-) - -Index: b/os-probes/mounted/powerpc/20macosx -=================================================================== ---- a/os-probes/mounted/powerpc/20macosx -+++ b/os-probes/mounted/powerpc/20macosx -@@ -21,7 +21,7 @@ esac - # but I don't think it exists on Mac OS <= 9, and it's XML so parsing in - # 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 -aq Dummy ; then - label="$(count_next_label MacOSX)" - result "$1:Mac OS X:$label:macosx" - exit 0 diff --git a/os-prober-probe-MD-devices.patch b/os-prober-probe-MD-devices.patch new file mode 100644 index 000000000000..28a5dc355713 --- /dev/null +++ b/os-prober-probe-MD-devices.patch @@ -0,0 +1,26 @@ +Index: os-prober-1.61/os-prober +=================================================================== +--- os-prober-1.61.orig/os-prober ++++ os-prober-1.61/os-prober +@@ -39,6 +39,11 @@ partitions () { + fi + done + ++ # Add Linux MD unpartioned devices. Linux MD partitions are already covered above ++ [ -f /proc/mdstat ] && grep '^md' /proc/mdstat | while read md line; do ++ [ -e "/dev/$md" ] && echo "/dev/$md" ++ done ++ + # Add Serial ATA RAID devices + if type dmraid >/dev/null 2>&1 && \ + dmraid -s -c >/dev/null 2>&1; then +@@ -79,7 +84,8 @@ parse_proc_mdstat () { + udevadm info "$@" + } + fi +- while read line; do ++ # Only add MD slaves to the list ++ while read md line; do + for word in $line; do + dev="${word%%\[*}" + # TODO: factor this out to something in di-utils if diff --git a/os-prober-skip-part-on-multipath.patch b/os-prober-skip-part-on-multipath.patch new file mode 100644 index 000000000000..8f126b785f88 --- /dev/null +++ b/os-prober-skip-part-on-multipath.patch @@ -0,0 +1,43 @@ +Index: os-prober-1.61/os-prober +=================================================================== +--- os-prober-1.61.orig/os-prober ++++ os-prober-1.61/os-prober +@@ -23,6 +23,28 @@ + fi + return 1 + } ++mp_disks="UNDEF" ++on_multipath () { ++ type multipath >/dev/null 2>&1 || return 1 ++ local parent="${1%/*}" ++ local device="${parent##*/}" ++ ++ if [ "$mp_disks" = "UNDEF" ]; then ++ mp_disks=`multipath -d -l | sed -n -e 's/^.\+[0-9]\+:[0-9]\+:[0-9]\+:[0-9]\+ \([^ ]\+\) .*/\1/p'` ++ fi ++ ++ if [ -z "$mp_disks" ]; then ++ return 1 ++ fi ++ ++ for i in $mp_disks; do ++ if [ "$device" = "$i" ]; then ++ debug "$1: part of multipath disk $i" ++ return 0 ++ fi ++ done ++ return 1 ++} + + partitions () { + os_name="$(uname -s)" +@@ -31,7 +54,7 @@ partitions () { + # Serial ATA RAID disk. + for part in /sys/block/*/*[0-9]; do + if [ -f "$part/start" ] && \ +- [ ! -f "$part/whole_disk" ] && ! on_sataraid $part; then ++ [ ! -f "$part/whole_disk" ] && ! on_sataraid $part && ! on_multipath $part; then + name="$(echo "${part##*/}" | sed 's,[!.],/,g')" + if [ -e "/dev/$name" ]; then + echo "/dev/$name" + diff --git a/os-prober-umount-fix.patch b/os-prober-umount-fix.patch deleted file mode 100644 index 6e7937c161b9..000000000000 --- a/os-prober-umount-fix.patch +++ /dev/null @@ -1,18 +0,0 @@ -Index: os-prober/common.sh -=================================================================== ---- os-prober.orig/common.sh -+++ os-prober/common.sh -@@ -336,3 +336,13 @@ linux_mount_boot () { - - mountboot="$bootpart $mounted" - } -+ -+umount_exec=$(which umount) -+umount() { -+ if ! $umount_exec $@ 2> /dev/null; then -+ error "umount error, retrying after 1 sec" -+ sleep 1 -+ $umount_exec $@ -+ fi -+} -+ |