# Test changing the main PID
+# shellcheck source=test/units/util.sh
+. "$(dirname "$0")"/util.sh
+
systemd-analyze log-level debug
# The main service PID should be the parent bash process
# Test that user scope units work as well
-runas() {
- declare userid=$1
- shift
- XDG_RUNTIME_DIR=/run/user/"$(id -u "$userid")" setpriv --reuid="$userid" --init-groups "$@"
-}
-
systemctl start user@4711.service
runas testuser systemd-run --scope --user --unit test-true.scope /bin/true
test "$(systemctl show -P Result test-true.scope)" = success
set -eux
set -o pipefail
-systemd-analyze log-level debug
+# shellcheck source=test/units/util.sh
+. "$(dirname "$0")"/util.sh
-runas() {
- declare userid=$1
- shift
- XDG_RUNTIME_DIR=/run/user/"$(id -u "$userid")" setpriv --reuid="$userid" --init-groups "$@"
-}
+systemd-analyze log-level debug
runas testuser systemd-run --wait --user --unit=test-private-users \
-p PrivateUsers=yes -P echo hello
set -eux
set -o pipefail
-runas() {
- declare userid=$1
- shift
- XDG_RUNTIME_DIR=/run/user/"$(id -u "$userid")" setpriv --reuid="$userid" --init-groups "$@"
-}
+# shellcheck source=test/units/util.sh
+. "$(dirname "$0")"/util.sh
if ! command -v systemd-repart &>/dev/null; then
echo "no systemd-repart" >/skipped
exit 1
esac
}
+
+runas() {
+ local userid="${1:?}"
+ shift
+ XDG_RUNTIME_DIR=/run/user/"$(id -u "$userid")" setpriv --reuid="$userid" --init-groups "$@"
+}