summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/tweaker/bin/twk_fingerprint_hardware.sh
blob: 25111dd6fb91eb9eec68a843d989f863e3f84d76 (plain)
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
#!/bin/bash

# Copyright 2007, 2008 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This script will grab USB and PCI data and dump it to a file for the
# user to post.

output_file=/tmp/fingerprint.txt
maintainer="Human"
thread=""

Usage() {
    echo "USAGE:"
    echo `basename $0` " [-a]"
    echo "-a: advanced mode"
    echo
    echo "EXAMPLE: $0"
    exit 3
}

while getopts "a" FLAG ; do
    case "$FLAG" in
	a) ADVANCED_MODE=1;;
	*) Usage;;
    esac
done

check_for_root() {
    if [ `whoami` != "root" ]; then
	echo -n `basename $0`
	echo " must be run as root.  Exiting.";
	exit;
    fi
}

poll_PCI() {
    echo \
"#####
# lspci -vv
#####" >> $output_file
    lspci -vv >> $output_file
    echo ""  >> $output_file
    
    echo \
"#####
# lspci -mn
#####" >> $output_file
    lspci -mn >> $output_file
    echo ""  >> $output_file
}

poll_USB() {
    echo \
"#####
# /proc/bus/usb/devices
#####" >> $output_file
cat /proc/bus/usb/devices >> $output_file
}

instruct() {
    echo "Your hardware fingerprint is in $output_file"
    echo -n "Please PM it to $maintainer"
    if [ "$thread" != "" ]; then
	echo " or post it to"
	echo -n "$thread"
    fi
    echo "."
    echo "It should be accompanied by a list of changes that you made to the baseline
installation in order to improve MythTV on your hardware."
    
    echo "If you feel up to the task, feel free to prune out any entries that are for
very low-level devices like memory controllers, USB subsystems, etc. before
sending the fingerprint."
}

main() {
    check_for_root
    > $output_file
    poll_PCI
    poll_USB
    instruct
}

main