Line
Link Here
|
0 |
-- a/common.sh |
0 |
++ b/common.sh |
Lines 172-182
Link Here
|
172 |
done |
172 |
done |
173 |
} |
173 |
} |
174 |
|
174 |
|
175 |
#check_btrfs_mounted $bootsv $bootuuid) |
175 |
#check_btrfs_mounted $bootsv $bootsig) |
176 |
check_btrfs_mounted () { |
176 |
check_btrfs_mounted () { |
177 |
bootsv="$1" |
177 |
bootsv="$1" |
178 |
bootuuid="$2" |
178 |
bootsig="$2" |
179 |
bootdev=$(blkid | grep "$bootuuid" | cut -d ':' -f 1) |
179 |
bootdev=$(blkid | grep "$bootsig" | cut -d ':' -f 1) |
180 |
bindfrom=$(grep " btrfs " /proc/self/mountinfo | |
180 |
bindfrom=$(grep " btrfs " /proc/self/mountinfo | |
181 |
grep " $bootdev " | grep " /$bootsv " | cut -d ' ' -f 5) |
181 |
grep " $bootdev " | grep " /$bootsv " | cut -d ' ' -f 5) |
182 |
printf "%s" "$bindfrom" |
182 |
printf "%s" "$bindfrom" |
183 |
-- a/linux-boot-prober |
183 |
++ b/linux-boot-prober |
Lines 98-107
Link Here
|
98 |
bootsv="$subvol" |
98 |
bootsv="$subvol" |
99 |
elif echo "$bootmnt" | cut -d ' ' -f 3 | grep -q "btrfs"; then |
99 |
elif echo "$bootmnt" | cut -d ' ' -f 3 | grep -q "btrfs"; then |
100 |
# separate btrfs /boot subvolume |
100 |
# separate btrfs /boot subvolume |
101 |
bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | grep "^subvol=" | sed "s/subvol=//" ) |
101 |
bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | grep "\(^\|,\)subvol=" | sed "s/.*subvol=\([^,]*\).*$/\1/") |
102 |
bootuuid=$(echo "$bootmnt" | cut -d ' ' -f 1 | grep "^UUID=" | sed "s/UUID=//" ) |
102 |
bootsig=$(echo "$bootmnt" | cut -d ' ' -f 1 | grep "^\(PART\)\?\(UUID\|LABEL\)=" | sed 's/\(.*=\)\(.*\)/\1"\2"/' ) |
103 |
debug "mounting btrfs $tmpmnt/boot UUID=$bootuuid subvol=$bootsv" |
103 |
debug "mounting btrfs $tmpmnt/boot $bootsig subvol=$bootsv" |
104 |
bindfrom=$(check_btrfs_mounted $bootsv $bootuuid) |
104 |
bindfrom=$(check_btrfs_mounted $bootsv $bootsig) |
105 |
if [ -n "$bindfrom" ]; then |
105 |
if [ -n "$bindfrom" ]; then |
106 |
# already mounted some place |
106 |
# already mounted some place |
107 |
if ! mount -o bind $bindfrom "$tmpmnt/boot" 2>/dev/null; then |
107 |
if ! mount -o bind $bindfrom "$tmpmnt/boot" 2>/dev/null; then |
Lines 111-124
Link Here
|
111 |
rmdir "$tmpmnt" 2>/dev/null |
111 |
rmdir "$tmpmnt" 2>/dev/null |
112 |
exit 1 |
112 |
exit 1 |
113 |
fi |
113 |
fi |
114 |
elif ! mount -o subvol=$bootsv -t btrfs -U $bootuuid "$tmpmnt/boot" 2>/dev/null; then |
114 |
elif ! mount -o subvol=$bootsv -t btrfs $bootsig "$tmpmnt/boot" 2>/dev/null; then |
115 |
warn "error mounting btrfs boot partition subvol=$bootsv, UUID=$bootuuid" |
115 |
warn "error mounting btrfs boot partition subvol=$bootsv, $bootsig" |
116 |
umount "$tmpmnt/boot" 2>/dev/null |
116 |
umount "$tmpmnt/boot" 2>/dev/null |
117 |
umount "$tmpmnt" 2>/dev/null |
117 |
umount "$tmpmnt" 2>/dev/null |
118 |
rmdir "$tmpmnt" 2>/dev/null |
118 |
rmdir "$tmpmnt" 2>/dev/null |
119 |
exit 1 |
119 |
exit 1 |
120 |
fi |
120 |
fi |
121 |
bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " /$bootsv " | cut -d ' ' -f 10) |
121 |
bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " /${bootsv##/} " | cut -d ' ' -f 10) |
122 |
else |
122 |
else |
123 |
# non-btrfs partition or logical volume |
123 |
# non-btrfs partition or logical volume |
124 |
linux_mount_boot $partition $tmpmnt |
124 |
linux_mount_boot $partition $tmpmnt |
125 |
-- a/linux-boot-probes/mounted/common/40grub2 |
125 |
++ b/linux-boot-probes/mounted/common/40grub2 |
Lines 20-26
Link Here
|
20 |
kernel=${kernel#${bsv}} |
20 |
kernel=${kernel#${bsv}} |
21 |
kernelfile=$kernel |
21 |
kernelfile=$kernel |
22 |
initrd=${initrd#${bsv}} |
22 |
initrd=${initrd#${bsv}} |
23 |
if [ "x$GRUB_FS" != "xbtrfs" ]; then |
23 |
if [ "x$GRUB_FS" != "xbtrfs" -o "$partition" != "$bootpart" ]; then |
24 |
# absolute path needed: prepend subvolume if $kernel isn't empty |
24 |
# absolute path needed: prepend subvolume if $kernel isn't empty |
25 |
kernel=${kernel:+${bsv}}${kernel} |
25 |
kernel=${kernel:+${bsv}}${kernel} |
26 |
# handle multiple initrd paths |
26 |
# handle multiple initrd paths |
27 |
-- a/os-probes/common/50mounted-tests |
27 |
++ b/os-probes/common/50mounted-tests |
Lines 85-93
Link Here
|
85 |
exit 1 |
85 |
exit 1 |
86 |
fi |
86 |
fi |
87 |
# besides regular subvols, get ro and snapshot so thet can be excluded |
87 |
# besides regular subvols, get ro and snapshot so thet can be excluded |
88 |
subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9) |
88 |
subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed 's/<FS_TREE>\///') |
89 |
rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9) |
89 |
rosubvols=$(btrfs subvolume list -ra "$tmpmnt" | cut -d ' ' -f 9 | sed 's/<FS_TREE>\///') |
90 |
sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 14) |
90 |
sssubvols=$(btrfs subvolume list -sa "$tmpmnt" | cut -d ' ' -f 14 | sed 's/<FS_TREE>\///') |
91 |
if ! umount "$tmpmnt"; then |
91 |
if ! umount "$tmpmnt"; then |
92 |
warn "failed to umount btrfs volume on $tmpmnt" |
92 |
warn "failed to umount btrfs volume on $tmpmnt" |
93 |
rmdir "$tmpmnt" || true |
93 |
rmdir "$tmpmnt" || true |