]> git.saurik.com Git - apple/configd.git/blame - configd.tproj/update-mach-services
configd-888.1.2.tar.gz
[apple/configd.git] / configd.tproj / update-mach-services
CommitLineData
78403150
A
1#!/bin/sh
2
942cecd7 3CONFIGD_LAUNCHD_PLIST=${DSTROOT}/System/Library/LaunchDaemons/${1}
78403150
A
4CONFIGD_PLUGINS=/tmp/plugins.$$
5EMBEDDED_PROJECTS=/tmp/projects.$$
6PLUGIN_MACHSERVICES=/tmp/plugin.$$
7
8HAVE_CONFIGD_PLUGINS="MISSING"
9HAVE_IPCONFIGURATION="MISSING"
10
11cp /dev/null ${CONFIGD_PLUGINS}
942cecd7
A
12if [ -d ${DSTROOT}/System/Library/SystemConfiguration ]; then
13 (cd ${DSTROOT}/System/Library/SystemConfiguration ; ls -1d *.bundle >> ${CONFIGD_PLUGINS} 2>/dev/null )
78403150
A
14fi
15
16cp /dev/null ${EMBEDDED_PROJECTS}
17if [ -n "${RC_EMBEDDEDPROJECT_DIR}" -a -d "${RC_EMBEDDEDPROJECT_DIR}" ]; then
18 ( cd ${RC_EMBEDDEDPROJECT_DIR} \
19 ; ls -1d */System/Library/SystemConfiguration 2>/dev/null \
20 | sed -e 's:/System/Library/SystemConfiguration::' \
21 >> ${EMBEDDED_PROJECTS} )
22
23 if [ -s ${EMBEDDED_PROJECTS} ]; then
24 for PROJECT in `cat ${EMBEDDED_PROJECTS}`
25 do
26 ( cd ${RC_EMBEDDEDPROJECT_DIR}/${PROJECT}/System/Library/SystemConfiguration ; ls -1d *.bundle >> ${CONFIGD_PLUGINS} 2>/dev/null )
27 done
28 fi
29fi
30
31if [ -d ${SDKROOT}/System/Library/SystemConfiguration ]; then
32 ( cd ${SDKROOT}/System/Library/SystemConfiguration ; ls -1d *.bundle >> ${CONFIGD_PLUGINS} 2>/dev/null )
33fi
34
35if [ -n "${EXTRA_SYSTEMCONFIGURATION_PLUGIN_DIR}" -a -d "${EXTRA_SYSTEMCONFIGURATION_PLUGIN_DIR}" ]; then
36 ( cd ${EXTRA_SYSTEMCONFIGURATION_PLUGIN_DIR} ; ls -1d *.bundle >> ${CONFIGD_PLUGINS} 2>/dev/null )
37fi
38
39for PLUGIN in `sort -u ${CONFIGD_PLUGINS}`
40do
41 PLUGIN_PLIST=""
42
43# if [ -z "${PLUGIN_PLIST}" ]; then
942cecd7 44 PLUGIN_INF=${DSTROOT}/System/Library/SystemConfiguration/${PLUGIN}/Contents/Info.plist
78403150
A
45 if [ -f ${PLUGIN_INF} ]; then
46 PLUGIN_PLIST=${PLUGIN_INF}
47 fi
48# fi
49
50 if [ -z "${PLUGIN_PLIST}" ]; then
942cecd7 51 PLUGIN_INF=${DSTROOT}/System/Library/SystemConfiguration/${PLUGIN}/Info.plist
78403150
A
52 if [ -f ${PLUGIN_INF} ]; then
53 PLUGIN_PLIST=${PLUGIN_INF}
54 fi
55 fi
56
57 if [ -z "${PLUGIN_PLIST}" -a -s ${EMBEDDED_PROJECTS} ]; then
58 for PROJECT in `cat ${EMBEDDED_PROJECTS}`
59 do
60 PROJECT_INF=${RC_EMBEDDEDPROJECT_DIR}/${PROJECT}/System/Library/SystemConfiguration/${PLUGIN}/Contents/Info.plist
61 if [ -f ${PROJECT_INF} ]; then
62 PLUGIN_PLIST=${PROJECT_INF}
63 break
64 fi
65
66 PROJECT_INF=${RC_EMBEDDEDPROJECT_DIR}/${PROJECT}/System/Library/SystemConfiguration/${PLUGIN}/Info.plist
67 if [ -f ${PROJECT_INF} ]; then
68 PLUGIN_PLIST=${PROJECT_INF}
69 break
70 fi
71 done
72 fi
73
74 if [ -z "${PLUGIN_PLIST}" ]; then
75 PLUGIN_INF=${SDKROOT}/System/Library/SystemConfiguration/${PLUGIN}/Contents/Info.plist
76 if [ -f ${PLUGIN_INF} ]; then
77 PLUGIN_PLIST=${PLUGIN_INF}
78 fi
79 fi
80
81 if [ -z "${PLUGIN_PLIST}" ]; then
82 PLUGIN_INF=${SDKROOT}/System/Library/SystemConfiguration/${PLUGIN}/Info.plist
83 if [ -f ${PLUGIN_INF} ]; then
84 PLUGIN_PLIST=${PLUGIN_INF}
85 fi
86 fi
87
88 if [ -n "${EXTRA_SYSTEMCONFIGURATION_PLUGIN_DIR}" ]; then
89 if [ -z "${PLUGIN_PLIST}" ]; then
90 PLUGIN_INF=${EXTRA_SYSTEMCONFIGURATION_PLUGIN_DIR}/${PLUGIN}/Contents/Info.plist
91 if [ -f ${PLUGIN_INF} ]; then
92 PLUGIN_PLIST=${PLUGIN_INF}
93 fi
94 fi
95
96 if [ -z "${PLUGIN_PLIST}" ]; then
97 PLUGIN_INF=${EXTRA_SYSTEMCONFIGURATION_PLUGIN_DIR}/${PLUGIN}/Info.plist
98 if [ -f ${PLUGIN_INF} ]; then
99 PLUGIN_PLIST=${PLUGIN_INF}
100 fi
101 fi
102 fi
103
104 if [ -z "${PLUGIN_PLIST}" ]; then
105 continue
106 fi
107
108 /usr/libexec/PlistBuddy -c "Print :MachServices" -x ${PLUGIN_PLIST} > ${PLUGIN_MACHSERVICES} 2>/dev/null
109 if [ $? -eq 0 ]; then
110 echo "Merging \"MachServices\" from: ${PLUGIN_INF}"
111 /usr/libexec/PlistBuddy -c "Merge ${PLUGIN_MACHSERVICES} :MachServices" ${CONFIGD_LAUNCHD_PLIST} 2>/dev/null
9de8ab86 112 if [ -n "${MACOSX_DEPLOYMENT_TARGET}" ]; then
78403150 113 /usr/bin/plutil -convert xml1 ${CONFIGD_LAUNCHD_PLIST}
9de8ab86
A
114 else
115 /usr/bin/plutil -convert binary1 ${CONFIGD_LAUNCHD_PLIST}
78403150
A
116 fi
117 fi
118
119 case "${PLUGIN}" in
120 "IPMonitor.bundle" )
121 HAVE_CONFIGD_PLUGINS="OK"
122 ;;
123 "IPConfiguration.bundle" )
124 HAVE_IPCONFIGURATION="OK"
125 ;;
126 esac
127done
128
129rm -f ${PLUGIN_MACHSERVICES} ${CONFIGD_PLUGINS} ${EMBEDDED_PROJECTS}
130
9de8ab86 131MISSING=""
78403150 132if [ "${HAVE_CONFIGD_PLUGINS}" != "OK" ]; then
9de8ab86
A
133 MISSING="configd_plugins"
134elif [ "${HAVE_IPCONFIGURATION}" != "OK" ]; then
135 case "${PLATFORM_NAME}" in
136 *simulator )
137 ;;
138 * )
139 MISSING="bootp"
140 ;;
141 esac
142fi
143
144if [ -n "${MISSING}" ]; then
78403150
A
145 echo ""
146 echo "**************************************************************************************"
9de8ab86 147 echo "* THE BUILD ENVIRONMENT IS MISSING THE ROOT FOR AN ESSENTIAL PROJECT (${MISSING})"
78403150 148 echo "**************************************************************************************"
9de8ab86
A
149 if [ -z "${RC_RELEASE}" ]; then
150 echo "* REMOVING CONFIGD's LAUNCHD .plist FROM INSTALL ROOT"
151 echo "**************************************************************************************"
152 rm -f ${CONFIGD_LAUNCHD_PLIST}
153 else
154 # if B&I or "buildit", configd's launchd .plist is required (and must be viable)
155 exit 1
156 fi
78403150 157fi
9de8ab86 158