From d8ee37833e25b22996adad2a0fe7026e24657e6b Mon Sep 17 00:00:00 2001 From: Adphi Date: Fri, 23 Aug 2024 14:57:10 +0200 Subject: [PATCH] add ubuntu 16.04 support Signed-off-by: Adphi --- dockerfile.go | 6 +++++- templates/ubuntu.Dockerfile | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dockerfile.go b/dockerfile.go index cf8f3f3..2ffd251 100644 --- a/dockerfile.go +++ b/dockerfile.go @@ -91,7 +91,11 @@ func NewDockerfile(release OSRelease, img, password string, networkManager Netwo net = NetworkManagerIfupdown2 case ReleaseUbuntu: d.tmpl = ubuntuDockerfileTemplate - net = NetworkManagerNetplan + if release.VersionID < "18.04" { + net = NetworkManagerIfupdown2 + } else { + net = NetworkManagerNetplan + } case ReleaseAlpine: d.tmpl = alpineDockerfileTemplate net = NetworkManagerIfupdown2 diff --git a/templates/ubuntu.Dockerfile b/templates/ubuntu.Dockerfile index 24c9f7a..1589379 100644 --- a/templates/ubuntu.Dockerfile +++ b/templates/ubuntu.Dockerfile @@ -25,7 +25,9 @@ RUN ARCH="$([ "$(uname -m)" = "x86_64" ] && echo amd64 || echo arm64)"; \ iputils-ping && \ find /boot -type l -exec rm {} \; +{{ if gt .Release.VersionID "16.04" }} RUN systemctl preset-all +{{ end }} {{ if .Password }}RUN echo "root:{{ .Password }}" | chpasswd {{ end }}