No empty .Rs/.Re
[netbsd-mini2440.git] / usr.sbin / user / Makefile
blob38041a34db307c6203359ab6f729d349ebb1c622
1 # $NetBSD: Makefile,v 1.11 2008/10/19 22:05:24 apb Exp $
4 WARNS?= 1 # XXX: -Wsign-compare -Wcast-qual
6 .include <bsd.own.mk>
8 CPPFLAGS+= -DEXTENSIONS -DPW_MKDB_ARGC=2
10 PROG= user
11 SRCS+= user.c main.c
12 LINKS+= ${BINDIR}/user ${BINDIR}/useradd
13 LINKS+= ${BINDIR}/user ${BINDIR}/userdel
14 LINKS+= ${BINDIR}/user ${BINDIR}/usermod
15 LINKS+= ${BINDIR}/user ${BINDIR}/group
16 LINKS+= ${BINDIR}/user ${BINDIR}/groupadd
17 LINKS+= ${BINDIR}/user ${BINDIR}/groupdel
18 LINKS+= ${BINDIR}/user ${BINDIR}/groupmod
19 LINKS+= ${BINDIR}/user ${BINDIR}/userinfo
20 LINKS+= ${BINDIR}/user ${BINDIR}/groupinfo
21 LDADD+= -lutil
22 DPADD+= ${LIBUTIL}
23 MAN= user.8 useradd.8 userdel.8 usermod.8 userinfo.8 usermgmt.conf.5
24 MAN+= group.8 groupadd.8 groupdel.8 groupmod.8 groupinfo.8
25 MLINKS= useradd.8 adduser.8
27 # this target checks the built-in default group, and, if it doesn't exist,
28 # creates it
29 default-group:
30 @ln -fs ${.OBJDIR}/user ${.OBJDIR}/group; \
31 defgrp=`${.OBJDIR}/user add -D | \
32 ${TOOL_AWK} '/^group/ { print $$2 }'`; \
33 if ${.OBJDIR}/group info -e $$defgrp; then \
34 defgid=`${.OBJDIR}/group info $$defgrp | \
35 ${TOOL_AWK} '/^gid/ { print $$2 }'`; \
36 else \
37 defgid=99; \
38 while [ $$defgid -gt 0 ]; do \
39 ${.OBJDIR}/group info -e $$defgid || break; \
40 defgid=`expr $$defgid - 1`; \
41 done; \
42 if [ $$defgid -eq 0 ]; then \
43 defgid=100; \
44 while [ $$defgid -lt 60000 ]; do \
45 ${.OBJDIR}/group info -e $$defgid || break; \
46 defgid=`expr $$defgid + 1`; \
47 done; \
48 if [ $$defgid -eq 60000 ]; then \
49 echo "No gids left"; \
50 exit 1; \
51 fi; \
52 fi; \
53 ${.OBJDIR}/group add -g $$defgid $$defgrp; \
54 fi; \
55 echo "Default group is $$defgrp ($$defgid):"; \
56 ${.OBJDIR}/group info $$defgrp
58 .include <bsd.prog.mk>
60 test: ${PROG}
61 @echo "No news is good news"
62 @echo "1. Adding new user"
63 @rm -f useradd
64 @ln -s user useradd
65 -./useradd -m -g=uid test1.1
66 @echo "2. Modifying new user"
67 -./${PROG} mod -l test1.2 test1.1
68 @echo "3. Deleting new user"
69 -./${PROG} del -r test1.2
70 @echo "4. Attempting to add an invalid user name - IGNORE ANY ERROR"
71 -./${PROG} add -m test1%1
72 @echo "5. Bad usage - IGNORE ANY ERROR"
73 -./${PROG} add -m
74 @echo "6. Set range defaults"
75 -./${PROG} add -D -r4000..6000
76 -./${PROG} add -D
77 @echo "7. Get user information"
78 -./${PROG} info root
79 @echo "8. Bad user name - IGNORE ANY ERROR"
80 -./${PROG} info test1%1 || echo "User not found"
81 @echo "All tests completed"