From 61b291d2dc1da921b6313962781b109fdca3c073 Mon Sep 17 00:00:00 2001 From: Gerard Braad Date: Sat, 18 Jan 2025 20:33:20 +0800 Subject: [PATCH] Add user password for bootc --- .github/workflows/build-containers-bootc.yml | 1 + containers/Containerfile-dotfiles | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-containers-bootc.yml b/.github/workflows/build-containers-bootc.yml index eaf942e..0220f15 100644 --- a/.github/workflows/build-containers-bootc.yml +++ b/.github/workflows/build-containers-bootc.yml @@ -27,6 +27,7 @@ jobs: podman build -t ghcr.io/gbraad-devenv/fedora/dotfiles-bootc:41 \ --build-arg=BASE_IMAGE="ghcr.io/gbraad-devenv/fedora/base-bootc" \ --build-arg=BASE_VERSION=41 \ + --build-arg=USER_PASSWD="password" \ -f containers/Containerfile-dotfiles . - name: Run podman build - systemd-bootc run: | diff --git a/containers/Containerfile-dotfiles b/containers/Containerfile-dotfiles index 2249bc9..d1a7c23 100644 --- a/containers/Containerfile-dotfiles +++ b/containers/Containerfile-dotfiles @@ -3,11 +3,16 @@ ARG BASE_VERSION="41" FROM ${BASE_IMAGE}:${BASE_VERSION} +ARG USER_PASSSWD + LABEL org.opencontainers.image.source = "https://github.com/gbraad-devenv/fedora" # Add user with the expected ID (automated setup does not work atm) RUN useradd -l -u 1000 -G wheel -md /var/home/gbraad -s /bin/bash -p gbraad gbraad \ - && sed -i.bkp -e 's/%wheel\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%wheel ALL=NOPASSWD:ALL/g' /etc/sudoers + && sed -i.bkp -e 's/%wheel\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%wheel ALL=NOPASSWD:ALL/g' /etc/sudoers \ + && if [ -n "${USER_PASSWD}" ] ; then \ + echo "gbraad:${USER_PASSWD}" | sudo chpasswd ; \ + fi USER gbraad