feat(arch-nspawn): Use a unique scope name instead of --keep-unit

`--keep-unit` is really only for use in services like
`systemd-nspawn@.service`.

The parameter was added in commit 000ea6c7bb because
systemd-nspawn defaults the name of the machine (and thus the generated
scope) to the name of the working directory, which is not unique. Thus
spawning a container from `archbuild/extra-x86_64/foo` while
`archbuild/testing-x86_64/foo` is already running would fail.

We can avoid the unit conflict by giving the container a unique machine
name. Creating a scope also allows us to place the container in a slice
hierarchy for resource control.
This commit is contained in:
Jan Alexander Steffens (heftig) 2023-06-29 01:12:41 +02:00 committed by Levente Polyak
parent 1b25190176
commit 5f4fd52e38
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,8 @@ nspawn_args=(
--directory="$working_dir"
--setenv="PATH=/usr/local/sbin:/usr/local/bin:/usr/bin"
--register=no
--keep-unit
--slice="devtools-$(systemd-escape "${SUDO_USER:-$USER}")"
--machine="arch-nspawn-$$"
--as-pid2
)