diff options
author | Andrew Cady <d@cryptonomic.net> | 2021-10-22 15:22:37 -0400 |
---|---|---|
committer | Andrew Cady <d@cryptonomic.net> | 2021-10-23 11:17:15 -0400 |
commit | a19dce5c18f6d6370b58aa3b9dd26550a589fc8c (patch) | |
tree | b8625d617d8ad85e0715b36400411f53d9ad1a75 /tests.makefile |
Minimal Git/SSH Rhizome
Requires Sudo access to configure OpenSSH.
It would be possible to run OpenSSH on a non-default port and not
require root access. That is not implemented.
Diffstat (limited to 'tests.makefile')
-rw-r--r-- | tests.makefile | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests.makefile b/tests.makefile new file mode 100644 index 0000000..b152f01 --- /dev/null +++ b/tests.makefile | |||
@@ -0,0 +1,34 @@ | |||
1 | testuser = testuser | ||
2 | |||
3 | SU = $(SUDO) su | ||
4 | |||
5 | .PHONY: test useradd cleanuser | ||
6 | |||
7 | useradd: | ||
8 | $(SUDO) useradd $(testuser) --shell /bin/bash --create-home | ||
9 | $(SU) - $(testuser) -c 'ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""' | ||
10 | $(SU) - $(testuser) -c 'git config --global user.name $(testuser)' | ||
11 | $(SU) - $(testuser) -c 'git config --global user.email $(testuser)' | ||
12 | |||
13 | test: install $(shell getent passwd $(testuser) >/dev/null || echo useradd) | ||
14 | $(ROOT_INSTALL) -t ~$(testuser) tests.sh | ||
15 | $(SU) - $(testuser) -c ./tests.sh | ||
16 | |||
17 | ifeq ($(testuser),) | ||
18 | $(error testuser not defined) | ||
19 | endif | ||
20 | cleanuser_command = $(SUDO) rm -I -r ~$(testuser) | ||
21 | |||
22 | cleanuser: | ||
23 | : Preparing to run destructive command: | ||
24 | : | ||
25 | : | ||
26 | : $(cleanuser_command) | ||
27 | : | ||
28 | : | ||
29 | : Press ctrl-c to abort. | ||
30 | : | ||
31 | @for n in 5 4 3 2 1; do printf ' %d\r' "$$n"; sleep 1; done | ||
32 | $(cleanuser_command) || true | ||
33 | $(SUDO) userdel testuser || true | ||
34 | |||