diff --git a/Containerfile b/Containerfile index 7d3365b..da6e5dd 100644 --- a/Containerfile +++ b/Containerfile @@ -9,7 +9,12 @@ ARG COREOS_VERSION="${COREOS_VERSION:-stable}" COPY build*.sh /tmp COPY certs /tmp/certs ADD ublue-os-ucore-nvidia.spec \ - /tmp/ublue-os-ucore-nvidia/ublue-os-ucore-nvidia.spec + /tmp/ublue-os-ucore-nvidia/ublue-os-ucore-nvidia.spec +ADD files/usr/lib/systemd/system/ublue-nvctk-cdi.service \ + /tmp/ublue-os-ucore-nvidia/rpmbuild/SOURCES/ublue-nvctk-cdi.service +ADD files/usr/lib/systemd/system-preset/70-ublue-nvctk-cdi.preset \ + /tmp/ublue-os-ucore-nvidia/rpmbuild/SOURCES/70-ublue-nvctk-cdi.preset + RUN /tmp/build-prep.sh diff --git a/files/usr/lib/systemd/system-preset/70-ublue-nvctk-cdi.preset b/files/usr/lib/systemd/system-preset/70-ublue-nvctk-cdi.preset new file mode 100644 index 0000000..0dfb569 --- /dev/null +++ b/files/usr/lib/systemd/system-preset/70-ublue-nvctk-cdi.preset @@ -0,0 +1 @@ +enable ublue-nvctk-cdi.service \ No newline at end of file diff --git a/files/usr/lib/systemd/system/ublue-nvctk-cdi.service b/files/usr/lib/systemd/system/ublue-nvctk-cdi.service new file mode 100644 index 0000000..d6d593f --- /dev/null +++ b/files/usr/lib/systemd/system/ublue-nvctk-cdi.service @@ -0,0 +1,11 @@ +[Unit] +Description=ublue nvidia container toolkit CDI auto-generation +ConditionFileIsExecutable=/usr/bin/nvidia-ctk +After=local-fs.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/ublue-os-ucore-nvidia.spec b/ublue-os-ucore-nvidia.spec index 5ac290e..a79bed8 100644 --- a/ublue-os-ucore-nvidia.spec +++ b/ublue-os-ucore-nvidia.spec @@ -1,5 +1,5 @@ Name: ublue-os-ucore-nvidia -Version: 0.2 +Version: 0.3 Release: 1%{?dist} Summary: Additional files for nvidia driver support on CoreOS @@ -11,6 +11,8 @@ Supplements: mokutil policycoreutils Source0: nvidia-container-toolkit.repo Source1: nvidia-container.pp +Source2: ublue-nvctk-cdi.service +Source3: 70-ublue-nvctk-cdi.preset %description Adds various runtime files for nvidia support on Fedora CoreOS. @@ -22,19 +24,28 @@ Adds various runtime files for nvidia support on Fedora CoreOS. %build install -Dm0644 %{SOURCE0} %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-toolkit.repo install -Dm0644 %{SOURCE1} %{buildroot}%{_datadir}/ublue-os/%{_datadir}/selinux/packages/nvidia-container.pp +install -Dm0644 %{SOURCE2} %{buildroot}%{_datadir}/ublue-os/%{_unitdir}/ublue-nvctk-cdi.service +install -Dm0644 %{SOURCE3} %{buildroot}%{_presetdir}/70-ublue-nvctk-cdi.preset sed -i 's@enabled=1@enabled=0@g' %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-toolkit.repo install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-toolkit.repo %{buildroot}%{_sysconfdir}/yum.repos.d/nvidia-container-toolkit.repo install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_datadir}/selinux/packages/nvidia-container.pp %{buildroot}%{_datadir}/selinux/packages/nvidia-container.pp +install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_unitdir}/ublue-nvctk-cdi.service %{buildroot}%{_unitdir}/ublue-nvctk-cdi.service %files %attr(0644,root,root) %{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-toolkit.repo %attr(0644,root,root) %{_datadir}/ublue-os/%{_datadir}/selinux/packages/nvidia-container.pp +%attr(0644,root,root) %{_datadir}/ublue-os/%{_unitdir}/ublue-nvctk-cdi.service %attr(0644,root,root) %{_sysconfdir}/yum.repos.d/nvidia-container-toolkit.repo %attr(0644,root,root) %{_datadir}/selinux/packages/nvidia-container.pp +%attr(0644,root,root) %{_unitdir}/ublue-nvctk-cdi.service +%attr(0644,root,root) %{_presetdir}/70-ublue-nvctk-cdi.preset %changelog +* Fri Oct 6 2023 Benjamin Sherman - 0.3 +- add ublue-nvctk-cdi service to auto-generate NVIDIA CDI GPU definitions + * Wed Oct 04 2023 Benjamin Sherman - 0.2 - use newer nvidia-container-toolkit repo - repo provides newer toolkit, no longer requires config.toml