mirror of
https://github.com/linka-cloud/d2vm.git
synced 2026-05-12 18:38:15 +00:00
fix: fix centos / rhel family 8+ grub-bios boot
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
+3
-1
@@ -32,6 +32,8 @@ GRUB_TIMEOUT=0
|
|||||||
GRUB_CMDLINE_LINUX_DEFAULT="%s"
|
GRUB_CMDLINE_LINUX_DEFAULT="%s"
|
||||||
GRUB_CMDLINE_LINUX=""
|
GRUB_CMDLINE_LINUX=""
|
||||||
GRUB_TERMINAL=console
|
GRUB_TERMINAL=console
|
||||||
|
GRUB_DISABLE_OS_PROBER=true
|
||||||
|
GRUB_ENABLE_BLSCFG=false
|
||||||
`
|
`
|
||||||
|
|
||||||
type grubCommon struct {
|
type grubCommon struct {
|
||||||
@@ -44,7 +46,7 @@ type grubCommon struct {
|
|||||||
|
|
||||||
func newGrubCommon(c Config, r OSRelease) *grubCommon {
|
func newGrubCommon(c Config, r OSRelease) *grubCommon {
|
||||||
name := "grub"
|
name := "grub"
|
||||||
if r.ID == "centos" {
|
if r.ID == ReleaseCentOS || r.ID == ReleaseAlmaLinux || r.ID == ReleaseRocky {
|
||||||
name = "grub2"
|
name = "grub2"
|
||||||
}
|
}
|
||||||
return &grubCommon{
|
return &grubCommon{
|
||||||
|
|||||||
@@ -36,10 +36,27 @@ RUN dracut --no-hostonly --regenerate-all --force
|
|||||||
|
|
||||||
{{ if .Password }}RUN echo "root:{{ .Password }}" | chpasswd {{ end }}
|
{{ if .Password }}RUN echo "root:{{ .Password }}" | chpasswd {{ end }}
|
||||||
|
|
||||||
{{- if not .Grub }}
|
{{- if .Grub }}
|
||||||
|
RUN set -e; \
|
||||||
|
for linux in /usr/lib/modules/*/vmlinuz; do \
|
||||||
|
[ -e "$linux" ] || continue; \
|
||||||
|
kver="$(basename "$(dirname "$linux")")"; \
|
||||||
|
cp "/usr/lib/modules/${kver}/vmlinuz" "/boot/vmlinuz-${kver}"; \
|
||||||
|
done
|
||||||
|
RUN set -e; \
|
||||||
|
for linux in /boot/*/*/linux; do \
|
||||||
|
[ -e "$linux" ] || continue; \
|
||||||
|
dir="$(dirname "$linux")"; \
|
||||||
|
kver="$(basename "$dir")"; \
|
||||||
|
initrd="${dir}/initrd"; \
|
||||||
|
[ -e "$initrd" ] || continue; \
|
||||||
|
ln -sf "${linux#/boot/}" "/boot/vmlinuz-${kver}"; \
|
||||||
|
ln -sf "${initrd#/boot/}" "/boot/initramfs-${kver}.img"; \
|
||||||
|
done
|
||||||
|
{{- else }}
|
||||||
RUN cd /boot && \
|
RUN cd /boot && \
|
||||||
mv $(find / -name 'vmlinuz*') /boot/vmlinuz && \
|
mv $(find / -name 'vmlinuz*') /boot/vmlinuz && \
|
||||||
mv $(find . -name 'initramfs-*.img' -o -name initrd) /boot/initrd.img
|
mv $(find . -name 'initramfs-*.img' -o -name initrd) /boot/initrd.img
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
RUN yum clean all && \
|
RUN yum clean all && \
|
||||||
|
|||||||
Reference in New Issue
Block a user