From 0fd4a7f30c83cdbdb6fb86bedcc18536c42e27e0 Mon Sep 17 00:00:00 2001 From: Tulip Blossom Date: Tue, 7 Jan 2025 23:41:01 -0300 Subject: [PATCH 1/5] feat: docker and libvirt on the image + hooks for dx groups --- build_scripts/25-dx.sh | 13 ++++++++++ system_files/etc/ublue-os/setup.json | 2 +- .../privileged-setup.hooks.d/20-dx.sh | 25 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh diff --git a/build_scripts/25-dx.sh b/build_scripts/25-dx.sh index efa31d2..492ecf2 100755 --- a/build_scripts/25-dx.sh +++ b/build_scripts/25-dx.sh @@ -10,3 +10,16 @@ dnf config-manager --set-disabled packages.microsoft.com_yumrepos_vscode # TODO: Add the key from https://packages.microsoft.com/keys/microsoft.asc somehow # rpm --import https://packages.microsoft.com/keys/microsoft.asc fails for some reason. dnf -y --enablerepo packages.microsoft.com_yumrepos_vscode --nogpgcheck install code + +dnf config-manager --add-repo "https://download.docker.com/linux/centos/docker-ce.repo" +dnf config-manager --set-disabled docker-ce-stable +dnf -y --enablerepo docker-ce-stable install \ + docker-ce \ + docker-ce-cli \ + containerd.io \ + docker-buildx-plugin \ + docker-compose-plugin && \ + systemctl enable --now docker + + +dnf -y group install "Virtualization Host" diff --git a/system_files/etc/ublue-os/setup.json b/system_files/etc/ublue-os/setup.json index 55bca6f..36dd53a 100644 --- a/system_files/etc/ublue-os/setup.json +++ b/system_files/etc/ublue-os/setup.json @@ -1,4 +1,4 @@ { "check-secureboot": false, - "setup-version": 2, + "setup-version": 3, } diff --git a/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh b/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh new file mode 100644 index 0000000..cce0838 --- /dev/null +++ b/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Function to append a group entry to /etc/group +append_group() { + local group_name="$1" + if ! grep -q "^$group_name:" /etc/group; then + echo "Appending $group_name to /etc/group" + grep "^$group_name:" /usr/lib/group | tee -a /etc/group > /dev/null + fi +} + +# Setup Groups +append_group docker +append_group libvirt + +# We dont have incus on the image yet +# append_group incus-admin +# usermod -aG incus-admin $user + +wheelarray=($(getent group wheel | cut -d ":" -f 4 | tr ',' '\n')) +for user in $wheelarray +do + usermod -aG docker $user + usermod -aG libvirt $user +done From 73c2581f0ad6071b8bc40e5fc3672d57cdad82ae Mon Sep 17 00:00:00 2001 From: Tulip Blossom Date: Tue, 7 Jan 2025 23:44:17 -0300 Subject: [PATCH 2/5] fix: remove --now from service enabiling --- build_scripts/25-dx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/25-dx.sh b/build_scripts/25-dx.sh index 492ecf2..ecfb079 100755 --- a/build_scripts/25-dx.sh +++ b/build_scripts/25-dx.sh @@ -19,7 +19,7 @@ dnf -y --enablerepo docker-ce-stable install \ containerd.io \ docker-buildx-plugin \ docker-compose-plugin && \ - systemctl enable --now docker + systemctl enable docker dnf -y group install "Virtualization Host" From 6c484e9618f0074a4f98285a5c9d946a8253d438 Mon Sep 17 00:00:00 2001 From: Tulip Blossom Date: Tue, 7 Jan 2025 23:53:52 -0300 Subject: [PATCH 3/5] fix: split virtualization group so that we dont get cockpit on the image --- build_scripts/25-dx.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_scripts/25-dx.sh b/build_scripts/25-dx.sh index ecfb079..58f9c78 100755 --- a/build_scripts/25-dx.sh +++ b/build_scripts/25-dx.sh @@ -22,4 +22,5 @@ dnf -y --enablerepo docker-ce-stable install \ systemctl enable docker -dnf -y group install "Virtualization Host" +dnf -y group install "Virtualization Hypervisor" +dnf -y group install "Virtualization Tools" From 533b99ca88421a67cfbd8373a8ac38cf05d37d05 Mon Sep 17 00:00:00 2001 From: Tulip Blossom Date: Wed, 8 Jan 2025 22:20:35 -0300 Subject: [PATCH 4/5] fix: just add docker instead --- build_scripts/25-dx.sh | 7 ++----- .../usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/build_scripts/25-dx.sh b/build_scripts/25-dx.sh index 58f9c78..f1ae85f 100755 --- a/build_scripts/25-dx.sh +++ b/build_scripts/25-dx.sh @@ -18,9 +18,6 @@ dnf -y --enablerepo docker-ce-stable install \ docker-ce-cli \ containerd.io \ docker-buildx-plugin \ - docker-compose-plugin && \ - systemctl enable docker + docker-compose-plugin - -dnf -y group install "Virtualization Hypervisor" -dnf -y group install "Virtualization Tools" +systemctl enable docker diff --git a/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh b/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh index cce0838..87c2c23 100644 --- a/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh +++ b/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh @@ -11,15 +11,15 @@ append_group() { # Setup Groups append_group docker -append_group libvirt # We dont have incus on the image yet # append_group incus-admin +# append_group libvirt +# usermod -aG libvirt $user # usermod -aG incus-admin $user wheelarray=($(getent group wheel | cut -d ":" -f 4 | tr ',' '\n')) for user in $wheelarray do usermod -aG docker $user - usermod -aG libvirt $user done From 25975e83a3a3bd91d690bdba8b46f15e263cbdda Mon Sep 17 00:00:00 2001 From: Tulip Blossom Date: Fri, 10 Jan 2025 15:21:52 -0300 Subject: [PATCH 5/5] fix: make shellcheck and codacy happy + do not include libvirtd --- .../usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) mode change 100644 => 100755 system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh diff --git a/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh b/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh old mode 100644 new mode 100755 index 87c2c23..8edc1df --- a/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh +++ b/system_files/usr/share/ublue-os/privileged-setup.hooks.d/20-dx.sh @@ -14,12 +14,10 @@ append_group docker # We dont have incus on the image yet # append_group incus-admin -# append_group libvirt -# usermod -aG libvirt $user # usermod -aG incus-admin $user -wheelarray=($(getent group wheel | cut -d ":" -f 4 | tr ',' '\n')) -for user in $wheelarray +mapfile -t wheelarray < <(getent group wheel | cut -d ":" -f 4 | tr ',' '\n') +for user in "${wheelarray[@]}" do - usermod -aG docker $user + usermod -aG docker "$user" done