blob: d37b0e7598c29c505dd62a87a0170d5da9114ffb (
plain) (
blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# $Id$
install-user-and-group: .FORCE
@if /usr/bin/dscl . -read "/Groups/${RCYNIC_GROUP}" >/dev/null 2>&1; \
then \
echo "You already have a group \"${RCYNIC_GROUP}\", so I will use it."; \
elif gid="$$(/usr/bin/dscl . -list /Groups PrimaryGroupID | /usr/bin/awk 'BEGIN {gid = 501} $$2 >= gid {gid = 1 + $$2} END {print gid}')" && \
/usr/bin/dscl . -create "/Groups/${RCYNIC_GROUP}" && \
/usr/bin/dscl . -create "/Groups/${RCYNIC_GROUP}" RealName "${RCYNIC_GECOS}" && \
/usr/bin/dscl . -create "/Groups/${RCYNIC_GROUP}" PrimaryGroupID "$$gid" && \
/usr/bin/dscl . -create "/Groups/${RCYNIC_GROUP}" GeneratedUID "$$(/usr/bin/uuidgen)" && \
/usr/bin/dscl . -create "/Groups/${RCYNIC_GROUP}" Password "*"; \
then \
echo "Added group \"${RCYNIC_GROUP}\"."; \
else \
echo "Adding group \"${RCYNIC_GROUP}\" failed..."; \
echo "Please create it, then try again."; \
exit 1; \
fi; \
if /usr/bin/dscl . -read "/Users/${RCYNIC_USER}" >/dev/null 2>&1; \
then \
echo "You already have a user \"${RCYNIC_USER}\", so I will use it."; \
elif uid="$$(/usr/bin/dscl . -list /Users UniqueID | /usr/bin/awk 'BEGIN {uid = 501} $$2 >= uid {uid = 1 + $$2} END {print uid}')" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" UserShell "/usr/bin/false" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" RealName "${RCYNIC_GECOS}" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" UniqueID "$$uid" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" PrimaryGroupID "$$gid" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" NFSHomeDirectory "/var/empty" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" GeneratedUID "$$(/usr/bin/uuidgen)" && \
/usr/bin/dscl . -create "/Users/${RCYNIC_USER}" Password "*"; \
then \
echo "Added user \"${RCYNIC_USER}\"."; \
else \
echo "Adding user \"${RCYNIC_USER}\" failed..."; \
echo "Please create it, then try again."; \
exit 1; \
fi
@if /usr/bin/dscl . -read "/Groups/${RPKIRTR_GROUP}" >/dev/null 2>&1; \
then \
echo "You already have a group \"${RPKIRTR_GROUP}\", so I will use it."; \
elif gid="$$(/usr/bin/dscl . -list /Groups PrimaryGroupID | /usr/bin/awk 'BEGIN {gid = 501} $$2 >= gid {gid = 1 + $$2} END {print gid}')" && \
/usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" && \
/usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" RealName "${RPKIRTR_GECOS}" && \
/usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" PrimaryGroupID "$$gid" && \
/usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" GeneratedUID "$$(/usr/bin/uuidgen)" && \
/usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" Password "*"; \
then \
echo "Added group \"${RPKIRTR_GROUP}\"."; \
else \
echo "Adding group \"${RPKIRTR_GROUP}\" failed..."; \
echo "Please create it, then try again."; \
exit 1; \
fi; \
if /usr/bin/dscl . -read "/Users/${RPKIRTR_USER}" >/dev/null 2>&1; \
then \
echo "You already have a user \"${RPKIRTR_USER}\", so I will use it."; \
elif uid="$$(/usr/bin/dscl . -list /Users UniqueID | /usr/bin/awk 'BEGIN {uid = 501} $$2 >= uid {uid = 1 + $$2} END {print uid}')" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" UserShell "/usr/bin/false" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" RealName "${RPKIRTR_GECOS}" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" UniqueID "$$uid" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" PrimaryGroupID "$$gid" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" NFSHomeDirectory "/var/empty" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" GeneratedUID "$$(/usr/bin/uuidgen)" && \
/usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" Password "*"; \
then \
echo "Added user \"${RPKIRTR_USER}\"."; \
else \
echo "Adding user \"${RPKIRTR_USER}\" failed..."; \
echo "Please create it, then try again."; \
exit 1; \
fi
install-shared-libraries: .FORCE
@echo "Copying required shared libraries"
@shared_libraries="${RCYNIC_DIR}/bin/rcynic ${RCYNIC_DIR}/bin/rsync"; \
while true; \
do \
closure="$$(/usr/bin/otool -L $${shared_libraries} | /usr/bin/awk '/:$$/ {next} {print $$1}' | /usr/bin/sort -u)"; \
if test "x$$shared_libraries" = "x$$closure";
then \
break; \
else \
shared_libraries="$$closure"; \
fi; \
done; \
for shared in /usr/lib/dyld $$shared_libraries; \
do \
if /bin/test -r "${RCYNIC_DIR}/$${shared}"; \
then \
echo "You already have a \"${RCYNIC_DIR}/$${shared}\", so I will use it"; \
elif /usr/bin/install -m 555 -o root -g wheel -p "$${shared}" "${RCYNIC_DIR}/$${shared}"; \
then \
echo "Copied $${shared} into ${RCYNIC_DIR}"; \
else \
echo "Unable to copy $${shared} into ${RCYNIC_DIR}"; \
exit 1; \
fi; \
done
install-rc-scripts:
${INSTALL} -o root -g wheel -d ${DESTDIR}/Library/StartupItems/RCynic
${INSTALL} -o root -g wheel -m 555 \
rc-scripts/darwin/RCynic \
rc-scripts/darwin/StartupParameters.plist \
${DESTDIR}/Library/Startup/RCynic
|