@@ -16,13 +16,25 @@ NVIDIA_MODESET_MODULE_PARAMS=()
1616NVIDIA_PEERMEM_MODULE_PARAMS=()
1717TARGETARCH=${TARGETARCH:? " Missing TARGETARCH env" }
1818KERNEL_MODULE_TYPE=${KERNEL_MODULE_TYPE:- auto}
19+ UBUNTU_PRO_TOKEN=${UBUNTU_PRO_TOKEN:- " " }
1920
2021export DEBIAN_FRONTEND=noninteractive
2122
2223DRIVER_ARCH=${TARGETARCH/ amd64/ x86_64} && DRIVER_ARCH=${DRIVER_ARCH/ arm64/ aarch64}
2324
2425echo " DRIVER_ARCH is $DRIVER_ARCH "
2526
27+ _enable_fips_if_required () {
28+ if [[ -n " ${UBUNTU_PRO_TOKEN} " && ${KERNEL_VERSION} =~ " fips" ]]; then
29+ echo " Ubuntu Pro token and FIPS kernel detected"
30+ apt-get -qq install --no-install-recommends ubuntu-advantage-tools > /dev/null
31+ echo " Attaching Ubuntu Pro token..."
32+ pro attach --no-auto-enable " ${UBUNTU_PRO_TOKEN} "
33+ echo " Enabling FIPS apt repo access..."
34+ pro enable --access-only --assume-yes fips-updates
35+ fi
36+ }
37+
2638_update_package_cache () {
2739 if [ " ${PACKAGE_TAG:- } " != " builtin" ]; then
2840 echo " Updating the package cache..."
@@ -658,6 +670,7 @@ init() {
658670 if _kernel_requires_package; then
659671 _update_ca_certificates
660672 _update_package_cache
673+ _enable_fips_if_required
661674 _resolve_kernel_version || exit 1
662675 _install_prerequisites
663676 _create_driver_package
@@ -726,6 +739,7 @@ update() {
726739 trap " echo 'Caught signal'; exit 1" HUP INT QUIT PIPE TERM
727740
728741 _update_package_cache
742+ _enable_fips_if_required
729743 _resolve_kernel_version || exit 1
730744 _install_prerequisites
731745 if _kernel_requires_package; then
0 commit comments