]> git.saurik.com Git - apple/configd.git/blame - get-mobility-info
configd-888.1.2.tar.gz
[apple/configd.git] / get-mobility-info
CommitLineData
dbf6a266 1#!/bin/sh
b7ffbc6a 2# Copyright (c) 2004-2015 Apple Inc.
edebe297 3#
dbf6a266
A
4# get-mobility-info
5#
6# Collect system & network configuration information.
7#
8
dbf6a266
A
9PATH=/bin:/usr/bin:/sbin:/usr/sbin
10
085a2e6a
A
11#
12# Disclaimer
13#
14cat <<_END_OF_DISCLAIMER
15
16This diagnostic tool generates files that allow Apple to investigate issues
17with your computer and help Apple to improve its products. The generated files
18may contain some of your personal information, which may include, but not be
19limited to, the serial number or similar unique number for your device, your
20user name, or your computer name. The information is used by Apple in
21accordance with its privacy policy (www.apple.com/privacy) and is not shared
22with any third party. By enabling this diagnostic tool and sending a copy of
78403150 23the generated files to Apple, you are consenting to Apple's use of the content
085a2e6a
A
24of such files.
25
26_END_OF_DISCLAIMER
27
28/bin/echo "Press 'Enter' to continue."
29read reply
30
31#
32# Setup
33#
dbf6a266
A
34PRIV=""
35if [ ${EUID} -ne 0 ]; then
36 PRIV="sudo"
37fi
38
5e9ce69e
A
39if [ -x /usr/bin/tail ]; then
40 TAIL_2000="/usr/bin/tail -n 2000"
41 TAIL_25000="/usr/bin/tail -n 25000"
42else
43 TAIL_2000="/bin/cat"
44 TAIL_25000="/bin/cat"
45fi
46
9de8ab86 47OUT="mobility-info-`date +'%Y.%m.%d.%H%M%S'`"
edebe297
A
48OUTDIR="/var/tmp"
49if [ -d ~/Desktop ]; then
50 OUTDIR=~/Desktop
a40a14f8 51elif [ "`readlink /tmp`" = "private/var/tmp" ]; then
5e9ce69e 52 OUTDIR=/Library/Logs/CrashReporter
a40a14f8 53 mkdir -p ${OUTDIR}
edebe297
A
54fi
55
56umask 077
57
58WORKDIR=`mktemp -d -q "/tmp/${OUT}"`
59if [ $? -ne 0 ]; then
60 echo "Could not create snapshot directory"
61 exit 1
62fi
63
a40a14f8
A
64GZ_EXT=""
65GZ_OPT=""
66if [ -x /usr/bin/gzip ]; then
67 GZ_EXT=".gz"
68 GZ_OPT="-z"
69fi
70
71ARCHIVE=`mktemp -q "${OUTDIR}/${OUT}.tar${GZ_EXT}"`
edebe297
A
72if [ $? -ne 0 ]; then
73 echo "Could not create snapshot archive"
74 rm -rf "${WORKDIR}"
75 exit 1
76fi
77
78cd "${WORKDIR}"
dbf6a266 79
17d3ee29
A
80echo ""
81echo "Please wait, collecting information and statistics"
82echo ""
83
5e9ce69e 84#
9de8ab86 85# get-network-info
5e9ce69e 86#
9de8ab86
A
87if [ -x /System/Library/Frameworks/SystemConfiguration.framework/Resources/get-network-info ]; then
88 /System/Library/Frameworks/SystemConfiguration.framework/Resources/get-network-info -s -c "${WORKDIR}"
89elif [ -x /System/Library/Frameworks/SystemConfiguration.framework/get-network-info ]; then
90 /System/Library/Frameworks/SystemConfiguration.framework/get-network-info -s -c "${WORKDIR}"
91elif [ -x /System/Library/PrivateFrameworks/SystemConfiguration.framework/get-network-info ]; then
92 /System/Library/PrivateFrameworks/SystemConfiguration.framework/get-network-info -s -c "${WORKDIR}"
5e9ce69e
A
93fi
94
dbf6a266
A
95#
96# processes
97#
5e9ce69e
A
98if [ -x /bin/ps ]; then
99 /bin/ps axlww > ps 2>&1
100fi
dbf6a266 101
edebe297
A
102#
103# AirPort info
104#
105if [ -x /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport ]; then
106 /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --getinfo \
107 > airport 2>&1
108fi
109
5e9ce69e
A
110#
111# collect wifi dump
112#
78403150 113if [ -x /usr/bin/wdutil -a -x /bin/ls ]; then
5e9ce69e
A
114 ${PRIV} /usr/bin/wdutil dump
115 mkdir -p "wifi_dump"
116 /bin/ls -1 /private/tmp/wifi-* 2>/dev/null \
117 | while read log
118 do
119 if [ -f "${log}" ]; then
120 b="`basename ${log}`"
121 ${PRIV} cat "${log}" > "wifi_dump/${b}" 2>&1
122 fi
123 done
124fi
125
dbf6a266
A
126#
127# OS info
128#
129if [ -e /System/Library/CoreServices/SystemVersion.plist ]; then
130 cat /System/Library/CoreServices/SystemVersion.plist \
edebe297 131 > SystemVersion.plist 2>&1
dbf6a266 132fi
dbf6a266
A
133
134#
135# IOKit info
136#
5e9ce69e
A
137if [ -x /usr/sbin/ioreg ]; then
138 /usr/sbin/ioreg -i -l -w 0 > ioreg 2>&1
139 /usr/sbin/ioreg -i -l -p IODeviceTree -w 0 >> ioreg 2>&1
140fi
edebe297 141
17d3ee29
A
142#
143# Power Management info
144#
5e9ce69e
A
145if [ -x /usr/bin/pmset ]; then
146 echo "#" > pmset
147 echo "# pmset -g everything" >> pmset
148 echo "#" >> pmset
149 /usr/bin/pmset -g everything 2>/dev/null | ${TAIL_25000} >> pmset
150fi
17d3ee29 151
dbf6a266
A
152#
153# Host configuration
154#
5e9ce69e
A
155if [ -x /usr/bin/hostinfo ]; then
156 /usr/bin/hostinfo > hostinfo 2>&1
157fi
dbf6a266 158if [ -e /etc/hostconfig ]; then
edebe297 159 cat /etc/hostconfig > etc.hostconfig 2>&1
dbf6a266
A
160fi
161
dbf6a266
A
162#
163# System / network preferences
164#
165for f in \
dbf6a266
A
166 /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist \
167 /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist \
a40a14f8 168 /Library/Preferences/SystemConfiguration/com.apple.wifi.plist \
a40a14f8 169 /Library/Preferences/com.apple.alf.plist \
dbf6a266 170 /Library/Preferences/com.apple.sharing.firewall.plist \
6bb65964 171 /Library/Preferences/com.apple.wwand.plist \
dbf6a266
A
172
173do
edebe297
A
174 if [ -e "${f}" ]; then
175 b="`basename ${f}`"
176 cat "${f}" > "${b}" 2>&1
dbf6a266
A
177 fi
178done
179
9de8ab86
A
180#
181# Install log
182#
183if [ -e /var/log/install.log ]; then
184 cat /var/log/install.log > install.log 2>&1
185fi
186
5e9ce69e
A
187#
188# System / network preferences (from other volumes)
189#
9de8ab86 190mount -t hfs | grep "/Volumes/" | sed -e 's:^.* on /Volumes/::' -e 's: ([^(]*$::' \
5e9ce69e
A
191| while read volume
192do
193 V_PATH="/Volumes/${volume}"
78403150
A
194 if [ -h "${V_PATH}" ]; then
195 # if the path is a symlink
196 continue
197 fi
9de8ab86 198
5e9ce69e
A
199 for f in \
200 /Library/Preferences/SystemConfiguration/Networkinterfaces.plist \
201 /Library/Preferences/SystemConfiguration/preferences.plist \
202
203 do
204 if [ -f "${V_PATH}/${f}" ]; then
205 mkdir -p "OtherPreferences/${volume}"
206 b="`basename ${f}`"
207 cat "${V_PATH}/${f}" > "OtherPreferences/${volume}/${b}" 2>&1
208 fi
209 done
210done
211
6bb65964
A
212#
213# InternetSharing
214#
215if [ -e /etc/bootpd.plist ]; then
216 cat /etc/bootpd.plist > bootpd.plist 2>&1
17d3ee29 217 cat /etc/com.apple.named.proxy.conf > com.apple.named.proxy.conf 2>/dev/null
6bb65964
A
218elif [ -e /Library/Preferences/SystemConfiguration/bootpd.plist ]; then
219 cat /Library/Preferences/SystemConfiguration/bootpd.plist > bootpd.plist 2>&1
17d3ee29 220 cat /Library/Preferences/SystemConfiguration/com.apple.named.proxy.conf > com.apple.named.proxy.conf 2>/dev/null
6bb65964
A
221fi
222
dbf6a266
A
223#
224# mounted filesystems
225#
edebe297 226mount > mounted-filesystems 2>&1
dbf6a266 227
5e9ce69e 228${PRIV} cat /etc/hosts > etc.hosts 2>/dev/null
dbf6a266
A
229
230#
231# kernel extensions statistic
232#
edebe297 233if [ -x /usr/sbin/kextstat ]; then
5e9ce69e 234 /usr/sbin/kextstat > kextstat 2>&1
dbf6a266
A
235fi
236
6bb65964
A
237if [ -x /sbin/pfctl ]; then
238 echo "#" > pf
239 echo "# pfctl -s all" >> pf
240 echo "#" >> pf
5e9ce69e 241 ${PRIV} /sbin/pfctl -s all >> pf 2>&1
6bb65964
A
242 echo "==============================" >> pf
243 echo "#" >> pf
244 echo "# pfctl -s References" >> pf
245 echo "#" >> pf
5e9ce69e 246 ${PRIV} /sbin/pfctl -s References >> pf 2>&1
17d3ee29 247 for ANCHOR in `${PRIV} pfctl -s Anchors -v 2>/dev/null`
6bb65964
A
248 do
249 echo "==============================" >> pf
250 echo "#" >> pf
251 echo "# pfctl -a ${ANCHOR} -s all" >> pf
252 echo "#" >> pf
5e9ce69e 253 ${PRIV} /sbin/pfctl -a ${ANCHOR} -s all >> pf 2>&1
6bb65964
A
254 done
255fi
edebe297 256
78403150
A
257#
258# mach port info
259#
260if [ -x /usr/local/bin/lsmp ]; then
261 ${PRIV} /usr/local/bin/lsmp -a -v > lsmp 2>&1
262fi
263
264#
265# open files
266#
6bb65964 267if [ -x /usr/sbin/lsof ]; then
9de8ab86
A
268 ${PRIV} /usr/sbin/lsof -n -O -P -T q > lsof 2>&1 &
269 LSOF_PID=$!
270 # Init a watchdog for lsof
271 (
272 WAIT_TIME=5
273 while [ $WAIT_TIME -gt 0 ]
274 do
275 ${PRIV} kill -0 ${LSOF_PID} 2>/dev/null
276 if [ $? -eq 0 ]; then
277 sleep 1
278 # lsof is gathering data..
279 WAIT_TIME=$((WAIT_TIME-1))
280 continue
281 fi
282
283 # lsof completed gathering data
284 break
285 done
286
287 if [ $WAIT_TIME -eq 0 ]; then
288 # lsof timed out
289 ${PRIV} kill ${LSOF_PID} 2>/dev/null
290 fi
291 ) &
78403150
A
292fi
293
294#
295# [lib]dispatch info
296#
297if [ -x /usr/local/bin/ddt ]; then
298 /bin/echo -n "" > dispatch-info
299 for BIN in \
300 configd \
9de8ab86 301 discoveryd \
78403150
A
302
303 do
304 echo "#" >> dispatch-info
305 echo "# ddt -vkp ${BIN}" >> dispatch-info
306 echo "#" >> dispatch-info
307 ${PRIV} /usr/local/bin/ddt -vkp ${BIN} >> dispatch-info 2>&1
308 done
6bb65964 309fi
edebe297
A
310
311#
78403150 312# OpenDirectory info
edebe297 313#
6bb65964
A
314if [ -x /usr/bin/odutil ]; then
315 echo "#" > od-info
316 echo "# odutil show all" >> od-info
317 echo "#" >> od-info
5e9ce69e 318 ${PRIV} /usr/bin/odutil show all >> od-info 2>&1
edebe297
A
319fi
320
edebe297
A
321#
322# Kerberos configuration
323#
a40a14f8
A
324if [ -x /usr/bin/klist ]; then
325 echo "#" > kerberos
5e9ce69e
A
326 echo "# klist --verbose --all-content" >> kerberos
327 echo "#" >> kerberos
328 klist --verbose --all-content >> kerberos 2>&1
329
a40a14f8 330 echo "#" >> kerberos
5e9ce69e
A
331 echo "# ktutil list" >> kerberos
332 echo "#" >> kerberos
333 ${PRIV} /usr/sbin/ktutil --verbose list >> kerberos 2>&1
edebe297 334
a40a14f8 335 echo "#" >> kerberos
5e9ce69e 336 echo "# gsstool list --verbose" >> kerberos
a40a14f8 337 echo "#" >> kerberos
5e9ce69e 338 /System/Library/PrivateFrameworks/Heimdal.framework/Helpers/gsstool list --verbose >> kerberos 2>&1
a40a14f8 339fi
edebe297
A
340
341#
5e9ce69e 342# system profiler
edebe297 343#
5e9ce69e
A
344if [ -x /usr/sbin/system_profiler ]; then
345 system_profiler -xml SPEthernetDataType \
346 SPFibreChannelDataType \
347 SPFireWireDataType \
348 SPFirewallDataType \
349 SPModemDataType \
350 SPNetworkDataType \
351 SPThunderboltDataType \
352 SPWWANDataType \
353 SPAirPortDataType > system_profiler.spx 2>/dev/null
354fi
6bb65964 355
5e9ce69e
A
356#
357# system usage statistics
358#
78403150 359/bin/echo -n "" > system-statistics
6bb65964 360
5e9ce69e
A
361if [ -x /usr/bin/uptime ]; then
362 echo "#" >> system-statistics
363 echo "# uptime" >> system-statistics
364 echo "#" >> system-statistics
365 /usr/bin/uptime >> system-statistics 2>&1
366fi
6bb65964 367
5e9ce69e
A
368if [ -x /usr/sbin/sysctl ]; then
369 echo "#" >> system-statistics
78403150 370 echo "# sysctl kern hw net debug" >> system-statistics
5e9ce69e 371 echo "#" >> system-statistics
78403150 372 /usr/sbin/sysctl kern hw net debug >> system-statistics 2>&1
5e9ce69e 373fi
6bb65964 374
5e9ce69e
A
375if [ -x /usr/bin/zprint ]; then
376 echo "#" >> system-statistics
377 echo "# zprint" >> system-statistics
378 echo "#" >> system-statistics
379 ${PRIV} /usr/bin/zprint >> system-statistics 2>&1
380fi
6bb65964 381
78403150
A
382if [ -x /usr/sbin/lsof -a -x /bin/ls ]; then
383 N=0
384 /bin/ls -1 /Library/Preferences/SystemConfiguration/*-lock \
385 2>/dev/null \
386 | while read lock
387 do
388 if [ ${N} -eq 0 ]; then
389 echo "#" >> system-statistics
390 echo "# lsof [SCPreferences lock files]" >> system-statistics
391 fi
392 N=`expr ${N} + 1`
393
394 echo "#" >> system-statistics
395 ${PRIV} /usr/sbin/lsof -- ${lock} >> system-statistics 2>&1
396 done
397fi
398
5e9ce69e
A
399#
400# collect executable and plugin info
401#
402report_binary_info()
6bb65964 403{
78403150 404 if [ ! -f "${1}" ]; then
5e9ce69e
A
405 return
406 fi
17d3ee29 407
78403150 408 VERSION=`what "${1}"`
5e9ce69e 409 echo "${VERSION}" >> versions 2>&1
17d3ee29 410
78403150 411 SUM=`sum "${1}"`
5e9ce69e 412 echo "\tsum: ${SUM}" >> versions 2>&1
17d3ee29 413
78403150 414 LSINFO=`ls -lu "${1}"`
5e9ce69e 415 echo "\tadditional info: ${LSINFO}" >> versions 2>&1
17d3ee29 416
5e9ce69e 417 echo "" >> versions 2>&1
6bb65964
A
418}
419
5e9ce69e 420get_binary_info()
6bb65964 421{
5e9ce69e
A
422 for BIN in \
423 /usr/libexec/bootpd \
424 /usr/libexec/configd \
9de8ab86 425 /usr/libexec/discoveryd \
5e9ce69e 426 /usr/sbin/awacsd \
b7ffbc6a 427 /usr/sbin/mDNSResponder \
5e9ce69e
A
428 /usr/sbin/pppd \
429 /usr/sbin/racoon \
9de8ab86
A
430 /usr/libexec/misd \
431 /usr/libexec/InternetSharing \
5e9ce69e
A
432 /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration \
433
434 do
435 report_binary_info "${BIN}"
436 done
437
78403150
A
438 if [ -x /usr/bin/xcode-select -a -x /usr/bin/xcodebuild -a -x /usr/bin/xcrun ]; then
439 SDKPATH="`xcode-select --print-path 2>/dev/null`"
440 if [ $? -eq 0 -a -n "${SDKPATH}" ]; then
441 /usr/bin/xcodebuild -showsdks 2>/dev/null \
442 | grep iphone \
443 | awk '{ print $NF }' \
444 | while read SDK
5e9ce69e 445 do
78403150 446 SDKPATH="`xcrun --sdk $SDK --show-sdk-path`"
5e9ce69e
A
447 for BIN in \
448 /usr/libexec/configd_sim \
449 /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration \
6bb65964 450
5e9ce69e
A
451 do
452 report_binary_info "${SDKPATH}${BIN}"
453 done
454 done
78403150
A
455 else
456 echo "*** NO SDKs ***" >> versions
457 echo "" >> versions
458 fi
5e9ce69e 459 fi
6bb65964
A
460}
461
5e9ce69e 462get_plugins_info()
6bb65964 463{
5e9ce69e 464 num=0
78403150 465 cd /System/Library/SystemConfiguration
5e9ce69e
A
466 for PLUGIN in *.bundle
467 do
78403150 468 plugins[$num]="${PLUGIN}"
5e9ce69e
A
469 num=$(( $num + 1 ))
470 done
471
472 cd "${WORKDIR}"
473
474 for PLUGIN in "${plugins[@]}"
475 do
78403150
A
476 PLUGIN_DIR="/System/Library/SystemConfiguration/${PLUGIN}"
477 PLUGIN_INF="${PLUGIN_DIR}/Contents/Info.plist"
478 if [ ! -f "${PLUGIN_INF}" ]; then
479 PLUGIN_INF="${PLUGIN_DIR}/Info.plist"
480 if [ ! -f "${PLUGIN_INF}" ]; then
5e9ce69e
A
481 echo "${PLUGIN_INF}: No Info.plist" >> versions 2>&1
482 fi
6bb65964 483 fi
6bb65964 484
5e9ce69e
A
485 echo "${PLUGIN}" >> versions 2>&1
486
487 ENABLED="Enabled"
78403150 488 BOOL=`scutil --get "${PLUGIN_INF}" / Enabled 2>/dev/null`
6bb65964 489 if [ $? -eq 0 ]; then
5e9ce69e
A
490 if [ ${BOOL} = "TRUE" ]; then
491 ENABLED="Enabled*"
492 else
493 ENABLED="Disabled"
494 fi
6bb65964 495 fi
5e9ce69e 496 echo "\t${ENABLED}" >> versions 2>&1
17d3ee29 497
5e9ce69e 498 VERBOSE=""
78403150 499 BOOL=`scutil --get "${PLUGIN_INF}" / Verbose 2>/dev/null`
5e9ce69e
A
500 if [ $? -eq 0 ]; then
501 if [ ${BOOL} = "TRUE" ]; then
502 VERBOSE="Verbose"
503 fi
6bb65964 504 fi
5e9ce69e
A
505 if [ -n "${VERBOSE}" ]; then
506 echo "\t${VERBOSE}" >> versions 2>&1
6bb65964 507 fi
17d3ee29 508
78403150 509 VERSION=`scutil --get "${PLUGIN_INF}" / CFBundleVersion 2>/dev/null`
5e9ce69e 510 if [ $? -eq 1 ]; then
78403150 511 VERSION=`scutil --get "${PLUGIN_INF}" / CFBundleShortVersionString 2>/dev/null`
5e9ce69e
A
512 fi
513 echo "\tVersion: ${VERSION}" >> versions 2>&1
17d3ee29 514
78403150
A
515 if [ -f "${PLUGIN_DIR}/Contents/MacOS/${PLUGIN%.*}" ]; then
516 SUM=`sum "${PLUGIN_DIR}/Contents/MacOS/${PLUGIN%.*}"`
5e9ce69e 517 echo "\tsum: ${SUM}" >> versions 2>&1
17d3ee29 518
78403150 519 LSINFO=`ls -lu "${PLUGIN_DIR}/Contents/MacOS/${PLUGIN%.*}"`
5e9ce69e 520 echo "\tadditional info: ${LSINFO}" >> versions 2>&1
78403150
A
521 elif [ -f "${PLUGIN_DIR}/${PLUGIN%.*}" ]; then
522 SUM=`sum "${PLUGIN_DIR}/${PLUGIN%.*}"`
5e9ce69e 523 echo "\tsum: ${SUM}" >> versions 2>&1
edebe297 524
78403150 525 LSINFO=`ls -lu "${PLUGIN_DIR}/${PLUGIN%.*}"`
5e9ce69e 526 echo "\tadditional info: ${LSINFO}" >> versions 2>&1
edebe297 527 fi
17d3ee29 528
5e9ce69e
A
529 echo "" >> versions 2>&1
530 done
531}
17d3ee29 532
5e9ce69e
A
533if [ -x /usr/bin/what -a -x /usr/bin/sum -a -x /bin/ls ]; then
534 get_binary_info
535 get_plugins_info
536fi
17d3ee29 537
5e9ce69e 538#
942cecd7
A
539# collect the logarchive
540#
541if [ -x /usr/bin/log ]; then
542 LOGARCHIVE_START_TIME=`date -v -1d +"%Y-%m-%d %H:%M:%S"`
543 LOGARCHIVE_OUTPUT="system_logs.logarchive"
544 ${PRIV} /usr/bin/log collect --livedata --output "${LOGARCHIVE_OUTPUT}" --start "${LOGARCHIVE_START_TIME}" 2>/dev/null
545 if [ -d ${LOGARCHIVE_OUTPUT} ]; then
546 ${PRIV} chown -R ${UID} "${LOGARCHIVE_OUTPUT}"
5e9ce69e
A
547 fi
548fi
6bb65964 549
5e9ce69e 550#
942cecd7 551# dmesg
5e9ce69e 552#
942cecd7
A
553if [ -x /sbin/dmesg ]; then
554 ${PRIV} /sbin/dmesg > dmesg
5e9ce69e
A
555fi
556
557#
558# ppp log file(s)
559#
560scutil <<_END_OF_INPUT \
561| awk -F' *: *' \
562 ' \
563 /Logfile : / { \
564 if (index($2, "/") == 1) { print $2 } \
565 else { print "/var/log/ppp/" $2 } \
566 } \
567 END { \
568 print "/tmp/pppotcp.log" \
569 } \
570 ' \
571| sort -u \
572| while read logFile
6bb65964 573open
5e9ce69e 574show Setup:/Network/Service/[^/]+/PPP pattern
6bb65964
A
575quit
576_END_OF_INPUT
577do
5e9ce69e
A
578 if [ -f "${logFile}" ]; then
579 b="`basename ${logFile}`"
580 cat "${logFile}" > "${b}" 2>&1
581 fi
edebe297 582done
dbf6a266 583
5e9ce69e
A
584if [ -x /bin/ls ]; then
585 #
586 # collect crash reports
587 #
588 for daemon in \
78403150
A
589 InternetSharing \
590 SCHelper \
591 SCMonitor \
592 awacsd \
5e9ce69e
A
593 bootpd \
594 configd \
9de8ab86
A
595 discoveryd \
596 discoveryd_helper \
5e9ce69e 597 eapolclient \
b7ffbc6a
A
598 mDNSResponder \
599 mDNSResponderHelper \
5e9ce69e
A
600 pppd \
601 racoon \
602 socketfilterfw \
a40a14f8 603
5e9ce69e
A
604 do
605 /bin/ls -1 /Library/Logs/DiagnosticReports/${daemon}_*.crash \
78403150 606 /Library/Logs/DiagnosticReports/${daemon}_*.ips \
5e9ce69e 607 /Library/Logs/CrashReporter/${daemon}_*.crash \
78403150 608 /Library/Logs/CrashReporter/${daemon}_*.ips \
5e9ce69e
A
609 /Library/Logs/CrashReporter/${daemon}_*.plist \
610 2>/dev/null \
611 | while read log
612 do
613 if [ -f "${log}" ]; then
614 b="`basename ${log}`"
615 ${PRIV} cat "${log}" > "${b}" 2>&1
616 fi
617 done
618 done
17d3ee29
A
619fi
620
78403150
A
621#
622# stackshot
623#
624if [ -x /usr/local/bin/crstackshot ]; then
625 /usr/local/bin/crstackshot 2>/dev/null
626fi
6bb65964 627
9de8ab86
A
628#
629# wait for background activity (eg: lsof)
630#
631wait
632
dbf6a266
A
633#
634# collect everything into a single archive
635#
edebe297 636cd "${WORKDIR}/.."
5e9ce69e 637tar -c ${GZ_OPT} -f "${ARCHIVE}" "${OUT}"
edebe297
A
638rm -rf "${WORKDIR}"
639
640if [ ${UID} -eq 0 ]; then
641 if [ -n "${SUDO_UID}" -a -n "${SUDO_GID}" ]; then
642 if [ ${UID} -ne ${SUDO_UID} ]; then
643 chown ${SUDO_UID}:${SUDO_GID} "${ARCHIVE}"
644 fi
645 fi
646fi
dbf6a266 647
edebe297 648echo "Network data collected to \"${ARCHIVE}\""
a40a14f8 649