|
Lines 62-71
fi
Link Here
|
| 62 |
|
62 |
|
| 63 |
mounted= |
63 |
mounted= |
| 64 |
|
64 |
|
| 65 |
# all btrfs processing here. Handle both unmounted and |
|
|
| 66 |
# mounted subvolumes. |
| 67 |
if [ "$types" = btrfs ]; then |
65 |
if [ "$types" = btrfs ]; then |
| 68 |
partition="$BTRFSDEV" |
66 |
partition="$BTRFSDEV" |
|
|
67 |
fi |
| 68 |
|
| 69 |
if type grub2-mount >/dev/null 2>&1 && \ |
| 70 |
type grub2-probe >/dev/null 2>&1 && \ |
| 71 |
grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then |
| 72 |
mounted=1 |
| 73 |
type="$(grub2-probe -d "$partition" -t fs)" || true |
| 74 |
if [ "$type" ]; then |
| 75 |
debug "mounted using GRUB $type filesystem driver" |
| 76 |
else |
| 77 |
debug "mounted using GRUB, but unknown filesystem?" |
| 78 |
type=fuseblk |
| 79 |
fi |
| 80 |
else |
| 81 |
ro_partition "$partition" |
| 82 |
for type in $types $delaytypes; do |
| 83 |
if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then |
| 84 |
debug "mounted as $type filesystem" |
| 85 |
mounted=1 |
| 86 |
break |
| 87 |
fi |
| 88 |
done |
| 89 |
fi |
| 90 |
|
| 91 |
if [ "$mounted" ]; then |
| 92 |
for test in /usr/lib/os-probes/mounted/*; do |
| 93 |
debug "running subtest $test" |
| 94 |
if [ -f "$test" ] && [ -x "$test" ]; then |
| 95 |
if "$test" "$partition" "$tmpmnt" "$type"; then |
| 96 |
debug "os found by subtest $test" |
| 97 |
if ! umount "$tmpmnt"; then |
| 98 |
warn "failed to umount $tmpmnt" |
| 99 |
fi |
| 100 |
rmdir "$tmpmnt" || true |
| 101 |
exit 0 |
| 102 |
fi |
| 103 |
fi |
| 104 |
done |
| 105 |
if ! umount "$tmpmnt"; then |
| 106 |
warn "failed to umount $tmpmnt" |
| 107 |
fi |
| 108 |
fi |
| 109 |
|
| 110 |
# all btrfs subvol processing here. Handle both unmounted and |
| 111 |
# mounted subvolumes. |
| 112 |
if [ "$types" = btrfs ]; then |
| 69 |
debug "begin btrfs processing for $UUID" |
113 |
debug "begin btrfs processing for $UUID" |
| 70 |
# note that the btrfs volume must not be mounted ro |
114 |
# note that the btrfs volume must not be mounted ro |
| 71 |
if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then |
115 |
if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then |
|
Lines 123-174
if [ "$types" = btrfs ]; then
Link Here
|
| 123 |
fi |
167 |
fi |
| 124 |
fi |
168 |
fi |
| 125 |
done |
169 |
done |
| 126 |
rmdir "$tmpmnt" || true |
|
|
| 127 |
if [ "$found" ]; then |
170 |
if [ "$found" ]; then |
|
|
171 |
rmdir "$tmpmnt" || true |
| 128 |
exit 0 |
172 |
exit 0 |
| 129 |
else |
|
|
| 130 |
exit 1 |
| 131 |
fi |
| 132 |
fi |
| 133 |
|
| 134 |
if type grub2-mount >/dev/null 2>&1 && \ |
| 135 |
type grub2-probe >/dev/null 2>&1 && \ |
| 136 |
grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then |
| 137 |
mounted=1 |
| 138 |
type="$(grub2-probe -d "$partition" -t fs)" || true |
| 139 |
if [ "$type" ]; then |
| 140 |
debug "mounted using GRUB $type filesystem driver" |
| 141 |
else |
| 142 |
debug "mounted using GRUB, but unknown filesystem?" |
| 143 |
type=fuseblk |
| 144 |
fi |
| 145 |
else |
| 146 |
ro_partition "$partition" |
| 147 |
for type in $types $delaytypes; do |
| 148 |
if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then |
| 149 |
debug "mounted as $type filesystem" |
| 150 |
mounted=1 |
| 151 |
break |
| 152 |
fi |
| 153 |
done |
| 154 |
fi |
| 155 |
|
| 156 |
if [ "$mounted" ]; then |
| 157 |
for test in /usr/lib/os-probes/mounted/*; do |
| 158 |
debug "running subtest $test" |
| 159 |
if [ -f "$test" ] && [ -x "$test" ]; then |
| 160 |
if "$test" "$partition" "$tmpmnt" "$type"; then |
| 161 |
debug "os found by subtest $test" |
| 162 |
if ! umount "$tmpmnt"; then |
| 163 |
warn "failed to umount $tmpmnt" |
| 164 |
fi |
| 165 |
rmdir "$tmpmnt" || true |
| 166 |
exit 0 |
| 167 |
fi |
| 168 |
fi |
| 169 |
done |
| 170 |
if ! umount "$tmpmnt"; then |
| 171 |
warn "failed to umount $tmpmnt" |
| 172 |
fi |
173 |
fi |
| 173 |
fi |
174 |
fi |
| 174 |
|
175 |
|