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