blob: 81c931205b04c9873e5f0e6430023946851572c2 (
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
|
testuser = testuser
SU = $(SUDO) su
.PHONY: test useradd cleanuser
useradd:
$(SUDO) useradd $(testuser) --shell /bin/bash --create-home
$(SU) - $(testuser) -c 'ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ""'
$(SU) - $(testuser) -c 'git config --global user.name $(testuser)'
$(SU) - $(testuser) -c 'git config --global user.email $(testuser)'
test: install $(shell getent passwd $(testuser) >/dev/null || echo useradd)
$(ROOT_INSTALL) -t ~$(testuser) $(SRC)/tests.sh
$(SU) - $(testuser) -c ./tests.sh
ifeq ($(testuser),)
$(error testuser not defined)
endif
cleanuser_command = $(SUDO) rm -I -r ~$(testuser)
cleanuser:
: Preparing to run destructive command:
:
:
: $(cleanuser_command)
:
:
: Press ctrl-c to abort.
:
@for n in 5 4 3 2 1; do printf ' %d\r' "$$n"; sleep 1; done
$(cleanuser_command) || true
$(SUDO) userdel testuser || true
|