Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 302634
Collapse All | Expand All

(-)grub2-orig/util/grub-mkconfig.in (-2 / +2 lines)
Lines 119-126 Link Here
119
fi
119
fi
120
120
121
# Device containing our userland.  Typically used for root= parameter.
121
# Device containing our userland.  Typically used for root= parameter.
122
GRUB_DEVICE="`${grub_probe} --target=device /`"
122
GRUB_DEVICE="`${grub_probe} --target=device /`" || GRUB_DEVICE="`legacy_find_root_device`"
123
GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
123
GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || GRUB_DEVICE_UUID="`legacy_convert_to_uuid ${GRUB_DEVICE}`"
124
124
125
# Device containing our /boot partition.  Usually the same as GRUB_DEVICE.
125
# Device containing our /boot partition.  Usually the same as GRUB_DEVICE.
126
GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
126
GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
(-)grub2-orig/util/grub-mkconfig_lib.in (+62 lines)
Lines 188-190 Link Here
188
  done
188
  done
189
  echo "$a"
189
  echo "$a"
190
}
190
}
191
192
legacy_find_root_device ()
193
{
194
  mount_point=$1
195
196
  # Autodetect current root device
197
  device=
198
  if [ -f /etc/fstab ] ; then
199
    device="`awk '$1!~/^#/{
200
      if ($2 ~ "^/+$") { $2 = "/"; } else { sub("/*$", "", $2); }
201
      if ($2 == "'"$mount_point"'"){
202
        print $1;
203
      }
204
    }' /etc/fstab | tail -n 1`"
205
  fi
206
207
  if [ -n "$device" ] ; then
208
    case "$device" in
209
      LABEL=* | UUID=*)
210
        device="`findfs $device`"
211
	device="`readlink -f "$device"`"
212
      ;;
213
      *)
214
        device=`readlink -f "$device"`
215
      ;;
216
    esac
217
  fi
218
219
  echo $device
220
}
221
222
legacy_convert_to_uuid()
223
{
224
  echo "Cannot determine uuid of root device.  Trying legacy probe method" >&2
225
  local dev; dev="$1"
226
  
227
  convert=false
228
  case "$dev" in
229
    /dev/disk/*)
230
      ;;
231
    /dev/mapper/*)
232
      ;;
233
    /dev/evms/[hs]d[a-z][0-9]*)
234
      convert=:
235
      ;;
236
    /dev/evms/*)
237
      ;;
238
    /dev/md[0-9]*)
239
      ;;
240
    /dev/*)
241
      convert=:
242
      ;;
243
  esac
244
  if $convert; then
245
    if [ -b "$dev" ]; then
246
      uuid="`blkid -o value -s UUID "$dev" || true`"
247
    fi
248
  fi
249
250
  echo "$uuid"
251
}
252

Return to bug 302634