generic-linux-gpu: put systemd unit in lib/systemd
This is where unit files are expected to be, making GPU setup compatible
with things like selinux. Fixes #8438. The `resources/` directory was
kept because it is expected to be used in the future.
(cherry picked from commit a3ac4bb1f8)
This commit is contained in:
parent
82fb7dedaa
commit
2a63d0e9d2
4 changed files with 22 additions and 17 deletions
|
|
@ -39,11 +39,12 @@ in
|
|||
setupScript="$TESTED/home-path/bin/non-nixos-gpu-setup"
|
||||
assertFileExists "$setupScript"
|
||||
|
||||
# Find the resources directory
|
||||
resourcesPath=$(grep -oP '/nix/store/[^/]+-non-nixos-gpu/resources' "$setupScript" | head -1)
|
||||
# Find the service file
|
||||
storePath="$(dirname "$(readlink "''${setupScript}")")"/../
|
||||
servicePath="$storePath/lib/systemd/system/non-nixos-gpu.service"
|
||||
|
||||
# Extract the GPU environment path
|
||||
envPath=$(grep -oP '/nix/store/[^/]+-non-nixos-gpu' "$resourcesPath/non-nixos-gpu.service" | head -1)
|
||||
envPath=$(grep -oP '/nix/store/[^/]+-non-nixos-gpu' "$servicePath" | head -1)
|
||||
|
||||
if [[ -z "$envPath" ]]; then
|
||||
fail "Could not find GPU environment path in service file"
|
||||
|
|
|
|||
|
|
@ -11,19 +11,22 @@
|
|||
assertFileExists "$setupScript"
|
||||
assertFileIsExecutable "$setupScript"
|
||||
|
||||
# Find and check the resources directory
|
||||
resourcesPath=$(grep -oP '/nix/store/[^/]+-non-nixos-gpu/resources' "$setupScript" | head -1)
|
||||
assertDirectoryExists "$resourcesPath"
|
||||
|
||||
# Check that gcroots dir was set
|
||||
cat "$setupScript"
|
||||
assertFileRegex "$setupScript" ' "/custom/state/directory"/gcroots'
|
||||
|
||||
serviceFile="$resourcesPath/non-nixos-gpu.service"
|
||||
assertFileExists "$serviceFile"
|
||||
|
||||
# Check that no placeholders remain
|
||||
assertFileNotRegex "$serviceFile" '@@[^@]\+@@'
|
||||
assertFileNotRegex "$setupScript" '@@[^@]\+@@'
|
||||
|
||||
# Check that expected files are present and free of placeholders
|
||||
storePath="$(dirname "$(readlink "''${setupScript}")")"/../
|
||||
expectedFiles=(
|
||||
lib/systemd/system/non-nixos-gpu.service
|
||||
)
|
||||
|
||||
for f in "''${expectedFiles[@]}"; do
|
||||
assertFileExists "$storePath/$f"
|
||||
assertFileNotRegex "$storePath/$f" '@@[^@]\+@@'
|
||||
done
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue