summaryrefslogtreecommitdiff
path: root/regress/sbin/bioctl/Makefile
blob: 837fa50fc8c846cfeca15a6e23db59b6a9e34975 (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
37
38
39
40
41
#	$OpenBSD: Makefile,v 1.2 2023/08/21 05:10:25 anton Exp $

BIOCTL ?=		/sbin/bioctl

CHUNKFILE =		disk.img
CHUNKDEVFILE =		chunk.txt
VOLDEVFILE =		vol.txt

OLDPW =			oldsecret
NEWPW =			securenew

REGRESS_SETUP_ONCE =	create-chunk

create-chunk:
	dd if=/dev/zero of=${CHUNKFILE} bs=512k count=0 seek=1 status=none
	${SUDO} vnconfig -- ${CHUNKFILE} 1>${CHUNKDEVFILE}
	echo 'RAID *' | ${SUDO} disklabel -wAT- -- "$$(<${CHUNKDEVFILE})"


REGRESS_TARGETS =		scripted-create-volume \
				scripted-change-passphrase
REGRESS_ROOT_TARGETS =		${REGRESS_TARGETS}

scripted-create-volume:
	printf '%s\n' '${OLDPW}' | \
		${SUDO} ${BIOCTL} -s -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \
		grep -o 'sd[0-9]*$$' -- 1>${VOLDEVFILE}

scripted-change-passphrase:
	printf '%s\n%s\n' '${OLDPW}' '${NEWPW}' | \
		${SUDO} ${BIOCTL} -s -P -- "$$(<${VOLDEVFILE})"


CLEANFILES =		*.txt *.img
REGRESS_CLEANUP =	cleanup

cleanup:
	${SUDO} ${BIOCTL} -d -- "$$(<${VOLDEVFILE})" 2>/dev/null
	${SUDO} vnconfig  -u -- "$$(<${CHUNKDEVFILE})" 2>/dev/null

.include <bsd.regress.mk>