fix Alpine 3.17 support (close #16)

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2023-02-15 10:20:37 +01:00
parent c66595115f
commit 8659907d62
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF
3 changed files with 16 additions and 2 deletions

View File

@ -121,6 +121,12 @@ func TestSyslinuxCfg(t *testing.T) {
initrd: "/initrd.img", initrd: "/initrd.img",
sysconfig: syslinuxCfgDebian, sysconfig: syslinuxCfgDebian,
}, },
{
image: "alpine:3.16",
kernel: "/boot/vmlinuz-virt",
initrd: "/boot/initramfs-virt",
sysconfig: syslinuxCfgAlpine,
},
{ {
image: "alpine", image: "alpine",
kernel: "/boot/vmlinuz-virt", kernel: "/boot/vmlinuz-virt",

View File

@ -60,6 +60,7 @@ var (
if parts := strings.Split(img, ":"); len(parts) > 1 { if parts := strings.Split(img, ":"); len(parts) > 1 {
img, tag = parts[0], parts[1] img, tag = parts[0], parts[1]
} }
img = fmt.Sprintf("%s:%s", img, tag)
size, err := parseSize(size) size, err := parseSize(size)
if err != nil { if err != nil {
return err return err
@ -75,9 +76,9 @@ var (
if err != nil { if err != nil {
return err return err
} }
found = len(imgs) == 1 && imgs[0] == fmt.Sprintf("%s:%s", img, tag) found = len(imgs) == 1 && imgs[0] == img
if found { if found {
logrus.Infof("using local image %s:%s", img, tag) logrus.Infof("using local image %s", img)
} }
} }
if pull || !found { if pull || !found {

View File

@ -6,7 +6,14 @@ RUN apk update --no-cache && \
apk add \ apk add \
util-linux \ util-linux \
linux-virt \ linux-virt \
{{ if ge .Release.VersionID "3.17" }} \
busybox-openrc \
busybox-mdev-openrc \
busybox-extras-openrc \
busybox-mdev-openrc \
{{ else }}
busybox-initscripts \ busybox-initscripts \
{{ end }}
openrc openrc
RUN for s in bootmisc hostname hwclock modules networking swap sysctl urandom syslog; do rc-update add $s boot; done RUN for s in bootmisc hostname hwclock modules networking swap sysctl urandom syslog; do rc-update add $s boot; done