]> git.saurik.com Git - apple/configd.git/blobdiff - get-mobility-info
configd-1109.40.9.tar.gz
[apple/configd.git] / get-mobility-info
index db30d7b991607d257b60d770052449dc6beb2163..f6e5e87d380043672445296ae7320ed3a93f8829 100755 (executable)
@@ -75,7 +75,10 @@ if [ -z $OUTDIR ]; then
        if [ -d ~/Desktop ]; then
                OUTDIR=~/Desktop
        elif [ "`readlink /tmp`" = "private/var/tmp" ]; then
-               OUTDIR=/Library/Logs/CrashReporter
+               OUTDIR=/Library/Logs/DiagnosticReports
+               if [ ! -d /Library/Logs/DiagnosticReports -a -d /Library/Logs/CrashReporter ]; then
+                       OUTDIR=/Library/Logs/CrashReporter
+               fi
                mkdir -p ${OUTDIR}
        fi
 fi
@@ -113,19 +116,33 @@ echo ""
 #
 # collect packet capture with kernel ring buffer if available
 #
+stop_pcap () {
+       #
+       # Stop the packet capture
+       #
+       if [ ${PCAP_STARTED} -ne 0 ]; then
+               trap '' SIGINT
+               /usr/local/bin/netdiagnose stop packetcapture                   2>&1
+               PCAP_STARTED=0
+       fi
+}
+
+PCAP_STARTED=0
 if [ -x /usr/local/bin/netdiagnose -a ${NO_PCAP} -ne 1 ]; then
+       trap stop_pcap SIGINT
        /usr/local/bin/netdiagnose -p "${WORKDIR}" start packetcapture          2>&1
+       PCAP_STARTED=1
 fi
 
 #
 # get-network-info
 #
 if [ -x /System/Library/Frameworks/SystemConfiguration.framework/Resources/get-network-info ]; then
-       /System/Library/Frameworks/SystemConfiguration.framework/Resources/get-network-info -s -c -P "${WORKDIR}"
+       /bin/sh /System/Library/Frameworks/SystemConfiguration.framework/Resources/get-network-info -s -c -P "${WORKDIR}"
 elif [ -x /System/Library/Frameworks/SystemConfiguration.framework/get-network-info ]; then
-       /System/Library/Frameworks/SystemConfiguration.framework/get-network-info -s -c -P "${WORKDIR}"
+       /bin/sh /System/Library/Frameworks/SystemConfiguration.framework/get-network-info -s -c -P "${WORKDIR}"
 elif [ -x /System/Library/PrivateFrameworks/SystemConfiguration.framework/get-network-info ]; then
-       /System/Library/PrivateFrameworks/SystemConfiguration.framework/get-network-info -s -c -P "${WORKDIR}"
+       /bin/sh /System/Library/PrivateFrameworks/SystemConfiguration.framework/get-network-info -s -c -P "${WORKDIR}"
 fi
 
 #
@@ -301,7 +318,7 @@ fi
 # open files
 #
 if [ -x /usr/sbin/lsof ]; then
-       ${PRIV} /usr/sbin/lsof -n -O -P -T q            > lsof                  2>&1    &
+       ${PRIV} /usr/sbin/lsof +c 0 -n -O -P -T q       > lsof                  2>&1    &
        LSOF_PID=$!
        # Init a watchdog for lsof
        (
@@ -428,7 +445,7 @@ if [ -x /usr/sbin/lsof -a -x /bin/ls ]; then
                N=`expr ${N} + 1`
 
                echo "#"                                                >> system-statistics
-               ${PRIV} /usr/sbin/lsof -- ${lock}                       >> system-statistics    2>&1
+               ${PRIV} /usr/sbin/lsof +c 0 -- ${lock}                  >> system-statistics    2>&1
        done
 fi
 
@@ -669,9 +686,7 @@ wait
 #
 # Stop the packet capture
 #
-if [ -x /usr/local/bin/netdiagnose -a ${NO_PCAP} -ne 1 ]; then
-       /usr/local/bin/netdiagnose stop packetcapture           2>&1
-fi
+stop_pcap
 
 if [ $NO_TAR -eq 0 ]; then
        #