From 238d9a51af444988e7c3f3925d18949ac1a8817e Mon Sep 17 00:00:00 2001 From: Adphi Date: Sun, 11 Sep 2022 20:00:48 +0200 Subject: [PATCH] templates: do not set root password if empty Signed-off-by: Adphi --- templates/alpine.Dockerfile | 2 +- templates/centos.Dockerfile | 2 +- templates/debian.Dockerfile | 2 +- templates/ubuntu.Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/alpine.Dockerfile b/templates/alpine.Dockerfile index 24190e8..ecc3de5 100644 --- a/templates/alpine.Dockerfile +++ b/templates/alpine.Dockerfile @@ -12,7 +12,7 @@ RUN apk update --no-cache && \ RUN for s in bootmisc hostname hwclock modules networking swap sysctl urandom syslog; do rc-update add $s boot; done RUN for s in devfs dmesg hwdrivers mdev; do rc-update add $s sysinit; done -RUN echo "root:{{- if .Password}}{{ .Password}}{{- else}}root{{- end}}" | chpasswd +{{ if .Password }}RUN echo "root:{{ .Password }}" | chpasswd {{ end }} {{ if eq .NetworkManager "ifupdown"}} RUN apk add --no-cache ifupdown-ng diff --git a/templates/centos.Dockerfile b/templates/centos.Dockerfile index c0aa0d0..93a9771 100644 --- a/templates/centos.Dockerfile +++ b/templates/centos.Dockerfile @@ -17,4 +17,4 @@ RUN dracut --no-hostonly --regenerate-all --force && \ ln -s $(find . -name 'vmlinuz-*') vmlinuz && \ ln -s $(find . -name 'initramfs-*.img') initrd.img -RUN echo "root:{{- if .Password}}{{ .Password}}{{- else}}root{{- end}}" | chpasswd +{{ if .Password }}RUN echo "root:{{ .Password }}" | chpasswd {{ end }} diff --git a/templates/debian.Dockerfile b/templates/debian.Dockerfile index 7dc25f2..62ccb1d 100644 --- a/templates/debian.Dockerfile +++ b/templates/debian.Dockerfile @@ -16,7 +16,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ RUN systemctl preset-all -RUN echo "root:{{- if .Password}}{{ .Password}}{{- else}}root{{- end}}" | chpasswd +{{ if .Password }}RUN echo "root:{{ .Password }}" | chpasswd {{ end }} {{ if eq .NetworkManager "netplan" }} RUN apt install -y netplan.io diff --git a/templates/ubuntu.Dockerfile b/templates/ubuntu.Dockerfile index b4c3d93..3998a19 100644 --- a/templates/ubuntu.Dockerfile +++ b/templates/ubuntu.Dockerfile @@ -15,7 +15,7 @@ RUN apt-get update -y && \ RUN systemctl preset-all -RUN echo "root:{{- if .Password}}{{ .Password}}{{- else}}root{{- end}}" | chpasswd +{{ if .Password }}RUN echo "root:{{ .Password }}" | chpasswd {{ end }} {{ if eq .NetworkManager "netplan" }} RUN apt install -y netplan.io