|
|
|
@ -277,9 +277,38 @@ replace_grub_root_with_label() {
|
|
|
|
|
|
|
|
|
|
# If boot by partuuid has been requested, don't override.
|
|
|
|
|
if [ -f $CHROOT_ROOT/etc/default/grub.d/40-partuuid ] && \
|
|
|
|
|
grep -q ^GRUB_FORCE_PARTUUID= $CHROOT_ROOT/etc/default/grub.d/40-partuuid; then
|
|
|
|
|
grep -q ^GRUB_FORCE_PARTUUID= $CHROOT_ROOT/etc/default/grub.d/40-partuuid.cfg; then
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
sed -i -e "s,root=[^ ]\+,root=LABEL=${fs_label}," \
|
|
|
|
|
"$CHROOT_ROOT/boot/grub/grub.cfg"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# When running update-grub in a chroot on a build host, we don't want it to
|
|
|
|
|
# probe for disks or probe for other installed OSes. Extract common
|
|
|
|
|
# diversion wrappers, so this isn't reinvented differently for each image.
|
|
|
|
|
divert_grub() {
|
|
|
|
|
CHROOT_ROOT="$1"
|
|
|
|
|
|
|
|
|
|
chroot "$CHROOT_ROOT" dpkg-divert --local \
|
|
|
|
|
--rename /usr/sbin/grub-probe
|
|
|
|
|
chroot "$CHROOT_ROOT" touch /usr/sbin/grub-probe
|
|
|
|
|
chroot "$CHROOT_ROOT" chmod +x /usr/sbin/grub-probe
|
|
|
|
|
|
|
|
|
|
chroot "$CHROOT_ROOT" dpkg-divert --local \
|
|
|
|
|
--divert /etc/grub.d/30_os-prober.dpkg-divert \
|
|
|
|
|
--rename /etc/grub.d/30_os-prober
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
undivert_grub() {
|
|
|
|
|
CHROOT_ROOT="$1"
|
|
|
|
|
|
|
|
|
|
chroot "$CHROOT_ROOT" rm /usr/sbin/grub-probe
|
|
|
|
|
chroot "$CHROOT_ROOT" dpkg-divert --remove --local \
|
|
|
|
|
--rename /usr/sbin/grub-probe
|
|
|
|
|
|
|
|
|
|
chroot "$CHROOT_ROOT" dpkg-divert --remove --local \
|
|
|
|
|
--divert /etc/grub.d/30_os-prober.dpkg-divert \
|
|
|
|
|
--rename /etc/grub.d/30_os-prober
|
|
|
|
|
}
|
|
|
|
|