diff options
author | Librewish | 2020-10-25 15:57:24 +0530 |
---|---|---|
committer | Librewish | 2020-10-25 15:57:24 +0530 |
commit | 5271f23d8ac140f2db82697b645c38a41ccc78ac (patch) | |
tree | c6b82c2b8538c1bdf9de3f43e4d1e88bb0fb4f61 | |
download | aur-5271f23d8ac140f2db82697b645c38a41ccc78ac.tar.gz |
update
-rw-r--r-- | .SRCINFO | 62 | ||||
-rw-r--r-- | PKGBUILD | 113 | ||||
-rw-r--r-- | fix-blkid-path.patch | 49 | ||||
-rw-r--r-- | os-prober-bootpart-name-fix.patch | 29 | ||||
-rw-r--r-- | os-prober-btrfsfix.patch | 472 | ||||
-rw-r--r-- | os-prober-factor-out-logger.patch | 107 | ||||
-rw-r--r-- | os-prober-factored-logger-efi-fix.patch | 16 | ||||
-rw-r--r-- | os-prober-frugalware.diff | 13 | ||||
-rw-r--r-- | os-prober-gentoo-fix.patch | 13 | ||||
-rw-r--r-- | os-prober-grepfix.patch | 13 | ||||
-rw-r--r-- | os-prober-grub2-multiple-images.patch | 34 | ||||
-rw-r--r-- | os-prober-grub2-parsefix.patch | 22 | ||||
-rw-r--r-- | os-prober-haiku-efi.patch | 48 | ||||
-rw-r--r-- | os-prober-mdraidfix.patch | 25 | ||||
-rw-r--r-- | os-prober-mounted-partitions-fix.patch | 26 | ||||
-rw-r--r-- | os-prober-no-dummy-mach-kernel.patch | 22 | ||||
-rw-r--r-- | os-prober-umount-fix.patch | 18 |
17 files changed, 1082 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..6fa53f50510f --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,62 @@ +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 + pkgrel = 1 + url = http://joey.kitenet.net/code/os-prober/ + arch = i686 + arch = x86_64 + license = GPL3 + depends = sh + provides = os-prober + 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 + 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 + +pkgname = os-prober-btrfs + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..21179bf295eb --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,113 @@ +# Maintainer: Librewish <librewish@gail.com> +# Contributor: Bernhard Landauer <oberon@manjaro.org> +# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com> +# Contributor: darkcoder <mario_vazq@hotmail.com> +pkgname=os-prober-btrfs +_pkgname=os-prober +pkgver=1.77 +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') +license=('GPL3') +depends=('sh') +provides=('os-prober') +conflicts=('os-prober') +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') + +prepare() { + cd "$_pkgname-$pkgver" + + patch -p1 -i "$srcdir"/os-prober-frugalware.diff + patch -p1 -i "$srcdir"/os-prober-mdraidfix.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 + + # 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" + + make newns +} + +package() { + cd "$_pkgname-$pkgver" + + 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 + + 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" + done + + install -Dm755 os-probes/mounted/powerpc/20macosx "$pkgdir"/usr/lib/os-probes/mounted/20macosx + + install -dm755 "$pkgdir"/var/lib/os-prober +} diff --git a/fix-blkid-path.patch b/fix-blkid-path.patch new file mode 100644 index 000000000000..f623f13863c1 --- /dev/null +++ b/fix-blkid-path.patch @@ -0,0 +1,49 @@ +--- 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-bootpart-name-fix.patch b/os-prober-bootpart-name-fix.patch new file mode 100644 index 000000000000..40a909da3f46 --- /dev/null +++ b/os-prober-bootpart-name-fix.patch @@ -0,0 +1,29 @@ +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-btrfsfix.patch b/os-prober-btrfsfix.patch new file mode 100644 index 000000000000..1047d249f929 --- /dev/null +++ b/os-prober-btrfsfix.patch @@ -0,0 +1,472 @@ +diff --git a/common.sh b/common.sh +index c2c5f46..8fb3c5f 100644 +--- a/common.sh ++++ b/common.sh +@@ -155,6 +155,7 @@ parse_proc_mounts () { + done + } + ++# add forth parameter to pickup btrfs subvol info + parsefstab () { + while read -r line; do + case "$line" in +@@ -165,12 +166,22 @@ parsefstab () { + set -f + set -- $line + set +f +- printf '%s %s %s\n' "$1" "$2" "$3" ++ printf '%s %s %s %s\n' "$1" "$2" "$3" "$4" + ;; + esac + done + } + ++#check_btrfs_mounted $bootsv $bootuuid) ++check_btrfs_mounted () { ++ bootsv="$1" ++ bootuuid="$2" ++ bootdev=$(blkid | grep "$bootuuid" | cut -d ':' -f 1) ++ bindfrom=$(grep " btrfs " /proc/self/mountinfo | ++ grep " $bootdev " | grep " /$bootsv " | cut -d ' ' -f 5) ++ printf "%s" "$bindfrom" ++} ++ + 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 +@@ -5,16 +5,143 @@ set -e + + newns "$@" + require_tmpdir ++ERR="n" ++ ++tmpmnt=/var/lib/os-prober/mount ++if [ ! -d "$tmpmnt" ]; then ++ mkdir "$tmpmnt" ++fi ++ ++mounted= ++bootmnt= ++bootsv= ++bootuuid= + + grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true + +-partition="$1" ++if [ -z "$1" ]; then ++ ERR=y ++elif [ "$1" = btrfs -a -z "$2" ]; then ++ ERR=y ++elif [ "$1" = btrfs -a -z "$3" ]; then ++ ERR=y ++elif [ "$1" = btrfs ]; then ++ type=btrfs ++ echo "$2" | grep -q "^UUID=" || ERR=y ++ echo "$3" | grep -q "^subvol=" || ERR=y ++ export "$2" ++ export "$3" ++ partition=$(blkid | grep "$UUID" | cut -d ':' -f 1 | tr '\n' ' ' | cut -d ' ' -f 1) ++ debug "btrfs: partition=$partition, UUID=$UUID, subvol=$subvol" ++else ++ 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 + exit 1 + fi + ++if [ "$type" = btrfs ]; then ++ # handle all of the btrfs stuff here ++ if [ ! -e "/proc/self/mountinfo" ]; then ++ warn "/proc/self/mountinfo does not exist, exiting" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ mpoint=$(grep "btrfs" /proc/self/mountinfo | grep " /$subvol " | grep " $partition " | cut -d ' ' -f 5) ++ if [ "$mpoint" = "/" ]; then ++ warn "specifying active root not valid, exiting" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ if [ "$mpoint" = "$tmpmnt" ]; then ++ warn "btrfs subvol=$subvool, UUID=$UUID, already mounted on $tmpmnt **ERROR**" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ if [ -z "$mpoint" ]; then ++ # mount the btrfs root ++ if ! mount -o subvol=$subvol -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 ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ else ++ # bind-mount ++ if ! mount -o bind "$mpoint" "$tmpmnt" 2>/dev/null; then ++ warn "error mounting btrfs bindfrom=$mpoint subvol=$subvol UUID=$UUID" ++ umount "$tmpmnt/boot" 2>/dev/null ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ fi ++ debug "mounted btrfs $partition, subvol=$subvol on $tmpmnt" ++ if [ ! -e "$tmpmnt/etc/fstab" ]; then ++ warn "btrfs subvol=$subvol not root" ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true ++ if [ -z "$bootmnt" ]; then ++ # /boot is part of the root ++ bootpart="$partition" ++ bootsv="$subvol" ++ elif echo "$bootmnt" | cut -d ' ' -f 3 | grep -q "btrfs"; then ++ # separate btrfs /boot subvolume ++ bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | grep "^subvol=" | sed "s/subvol=//" ) ++ bootuuid=$(echo "$bootmnt" | cut -d ' ' -f 1 | grep "^UUID=" | sed "s/UUID=//" ) ++ debug "mounting btrfs $tmpmnt/boot UUID=$bootuuid subvol=$bootsv" ++ bindfrom=$(check_btrfs_mounted $bootsv $bootuuid) ++ if [ -n "$bindfrom" ]; then ++ # already mounted some place ++ if ! mount -o bind $bindfrom "$tmpmnt/boot" 2>/dev/null; then ++ warn "error bind mounting btrfs boot subvol=$bootsv, from=$bindfrom" ++ umount "$tmpmnt/boot" 2>/dev/null ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ elif ! mount -o subvol=$bootsv -t btrfs -U $bootuuid "$tmpmnt/boot" 2>/dev/null; then ++ warn "error mounting btrfs boot partition subvol=$bootsv, UUID=$bootuuid" ++ umount "$tmpmnt/boot" 2>/dev/null ++ umount "$tmpmnt" 2>/dev/null ++ rmdir "$tmpmnt" 2>/dev/null ++ exit 1 ++ fi ++ bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " /$bootsv " | cut -d ' ' -f 10) ++ else ++ # non-btrfs partition or logical volume ++ linux_mount_boot $partition $tmpmnt ++ bootpart="${mountboot%% *}" ++ bootsv= ++ fi ++ ++ test="/usr/lib/linux-boot-probes/mounted/40grub2" ++ if [ -f $test ] && [ -x $test ]; then ++ debug "running $test $partition $bootpart $tmpmnt $type $subvol $bootsv" ++ if $test "$partition" "$bootpart" "$tmpmnt" "$type" "$subvol" "$bootsv"; then ++ debug "$test succeeded" ++ fi ++ fi ++ umount "$tmpmnt/boot" 2>/dev/null || true ++ if ! umount "$tmpmnt" 2>/dev/null; then ++ warn "problem umount $tmpmnt" ++ fi ++ rmdir "$tmpmnt" 2>/dev/null || true ++ ++ exit 0 ++fi ++ + 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 @@ + . /usr/share/os-prober/common.sh + set -e + ++# add support for btrfs with no separate /boot ++# that is, rootsv = bootsv + partition="$1" + bootpart="$2" + mpoint="$3" + type="$4" ++rootsv="$5" ++bootsv="$6" + + found_item=0 + + entry_result () { ++ if [ "x$type" = "xbtrfs" -a "$partition" = "$bootpart" ]; 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 + if [ "$ignore_item" = 0 ] && \ + [ -n "$kernel" ] && \ +- [ -e "$mpoint/$kernel" ]; then ++ [ -e "$mpoint/$kernelfile" ]; then + 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 | + 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 + } + + 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 + 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 + 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. ++ type=$(blkid -o value -s TYPE $mapped || true) ++ if [ "$type" = btrfs ]; then ++ uuid=$(blkid -o value -s UUID $mapped) ++ if grep -q "^$uuid" "$OS_PROBER_TMP/btrfs-vols" ; then ++ continue ++ fi ++ debug "btrfs volume uuid=$uuid partition=$partition" ++ echo "$uuid" >>"$OS_PROBER_TMP/btrfs-vols" ++ test="/usr/lib/os-probes/50mounted-tests" ++ if [ -f "$test" ] && [ -x "$test" ]; then ++ debug "running $test on btrfs $partition" ++ if "$test" btrfs "$uuid" "$partition"; then ++ debug "os detected by $test" ++ continue ++ fi ++ fi ++ ++ elif ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then + 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() { + 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" ++else ++ partition="$1" ++ types="$(fs_type "$partition")" || types=NOT-DETECTED ++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 + fi + + mounted= ++ ++# 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 ++ debug "btrfs volume $UUID mounted" ++ else ++ warn "cannot mount btrfs volume $UUID, exiting" ++ rmdir "$tmpmnt" || true ++ 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) ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount btrfs volume on $tmpmnt" ++ rmdir "$tmpmnt" || true ++ 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 ++ fi ++ fi ++ if [ -z "$mounted" ]; then ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount $tmpmnt" ++ 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 ++ 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 ++ fi ++ if [ -z "$mounted" ]; then ++ if ! umount "$tmpmnt"; then ++ warn "failed to umount $tmpmnt" ++ fi ++ fi ++ done ++ fi ++ rmdir "$tmpmnt" || true ++ if [ "$found" ]; then ++ exit 0 ++ else ++ exit 1 ++ 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 +@@ -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*) + fi + + label="$(count_next_label "$short")" +- result "$partition:$long:$label:linux" ++ if [ "x$type" = "xbtrfs" -a "x$uuid" != "x" -a "x$subvol" != "x" ]; then ++ result "$partition:$long:$label:linux:$type:$uuid:$subvol" ++ else ++ result "$partition:$long:$label:linux" ++ fi + exit 0 + else + exit 1 diff --git a/os-prober-factor-out-logger.patch b/os-prober-factor-out-logger.patch new file mode 100644 index 000000000000..52cb7ceabb0c --- /dev/null +++ b/os-prober-factor-out-logger.patch @@ -0,0 +1,107 @@ +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 new file mode 100644 index 000000000000..5c66fa00bb8d --- /dev/null +++ b/os-prober-factored-logger-efi-fix.patch @@ -0,0 +1,16 @@ +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-frugalware.diff b/os-prober-frugalware.diff new file mode 100644 index 000000000000..b1c99e4b9d09 --- /dev/null +++ b/os-prober-frugalware.diff @@ -0,0 +1,13 @@ +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 new file mode 100644 index 000000000000..8545db25de8c --- /dev/null +++ b/os-prober-gentoo-fix.patch @@ -0,0 +1,13 @@ +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 new file mode 100644 index 000000000000..4dadd4f57bab --- /dev/null +++ b/os-prober-grepfix.patch @@ -0,0 +1,13 @@ +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 new file mode 100644 index 000000000000..fe2debfe22cf --- /dev/null +++ b/os-prober-grub2-multiple-images.patch @@ -0,0 +1,34 @@ +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 new file mode 100644 index 000000000000..0ef8bdafacce --- /dev/null +++ b/os-prober-grub2-parsefix.patch @@ -0,0 +1,22 @@ +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 new file mode 100644 index 000000000000..1c85a8d9af62 --- /dev/null +++ b/os-prober-haiku-efi.patch @@ -0,0 +1,48 @@ +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-mdraidfix.patch b/os-prober-mdraidfix.patch new file mode 100644 index 000000000000..33a432dea5bc --- /dev/null +++ b/os-prober-mdraidfix.patch @@ -0,0 +1,25 @@ +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 new file mode 100644 index 000000000000..aecfc9f971c8 --- /dev/null +++ b/os-prober-mounted-partitions-fix.patch @@ -0,0 +1,26 @@ +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-no-dummy-mach-kernel.patch b/os-prober-no-dummy-mach-kernel.patch new file mode 100644 index 000000000000..b9e1254150e4 --- /dev/null +++ b/os-prober-no-dummy-mach-kernel.patch @@ -0,0 +1,22 @@ +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-umount-fix.patch b/os-prober-umount-fix.patch new file mode 100644 index 000000000000..6e7937c161b9 --- /dev/null +++ b/os-prober-umount-fix.patch @@ -0,0 +1,18 @@ +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 ++} ++ |