-
Notifications
You must be signed in to change notification settings - Fork 3
/
bugreporthelper.sh
executable file
·125 lines (84 loc) · 2.8 KB
/
bugreporthelper.sh
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/zsh -f
# Purpose: show relevant information about this Mac (helpful for bug reporting)
#
# From: Tj Luo.ma
# Mail: luomat at gmail dot com
# Web: http://RhymesWithDiploma.com
# Date: 2013-08-03
## NOTE:
## Keyboard Maestro uses a modified version of this, but it is embedded in the macro itself
NAME="$0:t:r"
zmodload zsh/datetime
TEMPFILE="${TMPDIR-/tmp/}${NAME}.${EPOCHSECONDS}.$$.$RANDOM"
umask 022
touch "$TEMPFILE"
if [ "$1" = "--fromKM" ]
then
FROM_KEYBOARD_MAESTRO=yes
shift
else
FROM_KEYBOARD_MAESTRO=no
fi
if [ "$#" = "0" -a "$FROM_KEYBOARD_MAESTRO" = "no" ]
then
echo -n "\nIf you are requesting support for an Application or PreferencePane, enter the name of it here (i.e. Dropbox, Hazel, etc): "
read APP_NAME
else
APP_NAME="$@"
fi
mdfind filename:"$APP_NAME" -onlyin /Applications -onlyin /Library/PreferencePanes -onlyin ~/Applications -onlyin ~/Library/PreferencePanes | while read line
do
PLIST="$line/Contents/Info.plist"
if [ -e "$PLIST" ]
then
echo "\nVersion Information for: $line" | tee -a "$TEMPFILE"
# Do not indent that one line
plutil -convert xml1 -o - "$PLIST" |\
egrep -A1 '(CFBundleVersion|CFBundleShortVersionString)' |\
sed 's#<key>##g; s#</key>##g ; s#<string>##g; s#</string>##g' |\
tr -s '\t|\012' ' ' |\
sed 's#--#\
#g' |\
sed 's#^# #g' |\
tee -a "$TEMPFILE"
# Do not indent that one line
fi
done
echo "\nHardware Information (system_profiler):" | tee -a "$TEMPFILE"
system_profiler SPHardwareDataType | egrep 'Model Name|Model Identifier|Processor|Cores|Cache|Memory' | tee -a "$TEMPFILE"
echo "\nOperating System Information (sw_vers):" | tee -a "$TEMPFILE"
sw_vers | sed 's#^# #g' | tee -a "$TEMPFILE"
echo "\nThird Party Kernel Extensions (kextstat):" | tee -a "$TEMPFILE"
kextstat | tail -n+2 | awk '{print $6 " " $7}' | sort | egrep -v '^com\.apple\.' | sed 's#^# #g' | tee -a "$TEMPFILE"
echo "\nLogin Items (com.apple.loginitems): " | tee -a "$TEMPFILE"
defaults read com.apple.loginitems | fgrep 'Name = ' | sed 's#^.*Name = "# #g ; s#";##g' | tee -a "$TEMPFILE"
for i in \
"$HOME/Library/LaunchAgents/" \
"$HOME/Library/LaunchDaemons/" \
"/Library/LaunchAgents/" \
"/Library/LaunchDaemons/"
do
if [ -d "$i" ]
then
cd "$i"
echo "\nlaunchd items in: $i" | sed "s#$HOME#~#g" | tee -a "$TEMPFILE"
command ls -1 | egrep '\.plist$' | sed 's#^# #g' | tee -a "$TEMPFILE"
fi
done
if [ "$FROM_KEYBOARD_MAESTRO" = "no" ]
then
# if the script was NOT called from Keyboard Maestro then ask if the user wants the information copied to their pasteboard
echo -n "\n$NAME: copy information above to the pasteboard (so it can be pasted into an email, etc)? [Y/n] "
read ANS
case "$ANS" in
n*|N*)
exit 0
;;
*)
pbcopy < $TEMPFILE && echo "$NAME: copied to pasteboard" && exit 0
;;
esac
fi
exit
#
#EOF