From 2a55d611d1556b519e6731553f1ca249a3c857fd Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sat, 17 Jun 2023 15:25:12 +0000 Subject: [PATCH] fix: avoid fail on non-existing dracut module --- distro/opensuse/opensuse.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/distro/opensuse/opensuse.go b/distro/opensuse/opensuse.go index ffb37c5..470fe67 100644 --- a/distro/opensuse/opensuse.go +++ b/distro/opensuse/opensuse.go @@ -215,11 +215,14 @@ func (suse OpenSUSE) Install(version string, headers bool) (err error) { if !strings.HasPrefix(suse.release, "12") && !strings.HasPrefix(suse.release, "11") { - cmdf("dracut "+ - "-a workaround "+ - "--force-drivers '%s' "+ - "-f /boot/initrd-$(ls /lib/modules) $(ls /lib/modules)", - modules) + format := "dracut " + if strings.HasPrefix(suse.release, "13") { + format += "-a workaround " + } + format += "--force-drivers '%s' " + format += "-f /boot/initrd-$(ls /lib/modules) $(ls /lib/modules)" + + cmdf(format, modules) } else { cmdf("touch /etc/fstab") cmdf("mkinitrd -m '%s'", modules)