PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB`#!/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 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 ( ( 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 [ "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/libexec/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 fi if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then for test in /usr/libexec/linux-boot-probes/*; do if [ -x $test ] && [ -f $test ]; then debug "running $test" if $test "$partition"; then debug "linux detected by $test" break fi fi done else mpoint=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2) mpoint="$(unescape_mount "$mpoint")" if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" != "/" ]; then type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 3) if ! grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then linux_mount_boot "$partition" "$mpoint" bootpart="${mountboot%% *}" bootmounted="${mountboot#* }" else bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)" bootmounted=0 fi for test in /usr/libexec/linux-boot-probes/mounted/*; do if [ -f $test ] && [ -x $test ]; then debug "running $test on mounted $partition" if $test "$partition" "$bootpart" "$mpoint" "$type"; then debug "$test succeeded" break fi fi done if [ "$bootmounted" = 1 ]; then if ! umount "$mpoint/boot"; then warn "failed to umount $mpoint/boot" fi fi fi fi ) 9>&1 | logger 1>&- # fd_logger ) 3>&1 # fd_result