BugLink: https://bugs.launchpad.net/bugs/1844245
Include a systemd service to simplify the process of loading intel_sgx
during the boot if the user decides to do so.
Since intel_sgx will only be available in linux-azure, restrict the
new service with ConditionVirtualization=microsoft.
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Acked-by: Connor Kuehl <connor.kuehl@canonical.com>
Acked-by: Andy Whitcroft <andy.whitcroft@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
--- /dev/null
+[Unit]
+Description=Install SGX kernel module
+DefaultDependencies=false
+ConditionVirtualization=microsoft
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/sbin/modprobe intel_sgx
+ExecStop=/sbin/modprobe -r intel_sgx
+
+[Install]
+WantedBy=multi-user.target
dh_installinit -p$(cloudpkg) -o --name hv-fcopy-daemon
dh_systemd_start -p$(cloudpkg)
endif
+ # Keep intel_sgx service disabled by default, so add it after dh_systemd_enable
+ # and dh_systemd_start are called:
+ dh_installinit -p$(cloudpkg) --no-start --no-enable --name intel-sgx-load-module
endif
endif
dh_installdeb -i