xref: /freebsd/usr.sbin/pw/tests/helper_functions.shin (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1# $FreeBSD$
2
3# The pw command
4PW="pw -V ${HOME}"
5RPW="pw -R ${HOME}"
6
7# Workdir to run tests in
8TESTDIR=$(atf_get_srcdir)
9
10# Populate the files pw needs to use into $HOME
11populate_etc_skel() {
12	cp ${TESTDIR}/master.passwd ${HOME} || \
13		atf_fail "Populating master.passwd in ${HOME}"
14	cp ${TESTDIR}/group ${HOME} || atf_fail "Populating group in ${HOME}"
15
16	# Generate the passwd file
17	pwd_mkdb -p -d ${HOME} ${HOME}/master.passwd || \
18		atf_fail "generate passwd from master.passwd"
19}
20
21# Populate the files pw needs to use into $HOME/etc
22populate_root_etc_skel() {
23	mkdir ${HOME}/etc
24	cp ${TESTDIR}/master.passwd ${HOME}/etc || \
25		atf_fail "Populating master.passwd in ${HOME}/etc"
26	cp ${TESTDIR}/group ${HOME}/etc || \
27		atf_fail "Populating group in ${HOME}/etc"
28
29	# Generate the passwd file
30	pwd_mkdb -p -d ${HOME}/etc ${HOME}//etc/master.passwd || \
31		atf_fail "generate passwd from master.passwd"
32}
33