summaryrefslogtreecommitdiff
path: root/src/fossil-test@.service
blob: edfb79effd463e10c64c7ced9b0f768fe194523c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[Unit]
Description = Endofossil Test: Clone over SSH using fresh identity

[Service]
Type = oneshot
PrivateUsers = yes
DynamicUser = yes

User = fossil-test-user-%i
RuntimeDirectory = fossil-test-%i

# BindPaths = /run/fossil-test-%i:/.ssh
# Environment = FOSSIL_HOME=/.ssh

BindPaths = /run/fossil-test-%i:/root/.ssh
Environment = HOME=/root FOSSIL_HOME=/root/.ssh

ExecStart = sh -c '[ "$HOME" != /root ] || set -- fakeroot "$@"; "$@"' - sh -exc '\
cd; \
! touch /test.file 2>/dev/null; \
mountpoint -q .ssh || ln -s . .ssh; \
mkdir .ssh/known_hosts.d; \
ssh-keygen -t ed25519 -f .ssh/id_ed25519 -N ""; \
ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -- %i@localhost :; \
ssh -o BatchMode=yes -o StrictHostKeyChecking=yes        -- %i@localhost uptime; \
cd .ssh; \
fossil clone ssh://%i@localhost/fossil-test-instance-1 db~$(date -Ins).fossil; \
fossil clone ssh://%i@localhost/a/b/c/fossil-test-instance-2 db~$(date -Ins).fossil; \
fossil clone ssh://%i@localhost/fossil/db db~$(date -Ins).fossil; \
'
ExecStartPost = +runuser -u '%i' -- sh -exc '\
cd; \
cd src; \
rm -f a/b/c/fossil-test-instance-2.fossil a/b/c/.fossil-remotes/*/fossil-test-instance-2.*; \
rmdir -p a/b/c/.fossil-remotes/* 2>/dev/null ; \
'