-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall
More file actions
165 lines (136 loc) · 6.67 KB
/
install
File metadata and controls
165 lines (136 loc) · 6.67 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#! /bin/bash
# Author : wenxueliu
#
# Reference
# http://debuginfo.centos.org/7/x86_64/
# http://debuginfo.centos.org/6/x86_64/
# http://my.oschina.net/MaTech/blog/639999
# QA:
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_cfg80211.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_function.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_hrtimer.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_jbd2.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_kmem.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_kvm.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_mac80211.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_sched_switch.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_scsi.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# file /usr/lib/debug/usr/lib64/traceevent/plugins/plugin_xen.so.debug from install of kernel-debuginfo-common-x86_64-3.10.0-327.22.2.el7.x86_64 conflicts with file from package kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64
# run with rpm -Uvh instead of rpm -ivh
check_privilege() {
if [[ $UID != 0 ]]
then
INFO " This script neeeds to be run with sudo, like this:"
echo -e "\n sudo $0 $*\n"
exit 1
fi
}
check_kernel() {
if [[ ! -f /etc/redhat-release ]]
then
echo "sorry, only redhat and centos support now."
exit 1;
fi
local version=`yum info kernel-devel | grep Version | awk '{print $3}'`
local arch=`yum info kernel-devel | grep Arch | awk '{print $3}'`
local release=`yum info kernel-devel | grep Release | awk '{print $3}'`
local kernel_devel=${version}-${release}.${arch}
if [[ $kernel_devel != `uname -r` ]]; then
echo "your kernel version is `uname -r`"
echo "the kernel version you should use is $kernel-devel"
echo "run with $ yum update and reboot, then run this script"
exit 1
fi
}
check_feature() {
if cat /boot/config-`uname -r` | grep "CONFIG_KALLSYMS.*=y"
then
echo "your os support debuginfo, it import to kernel and user space probe"
else
echo "Sorry, your os doesn't support probe"
echo "rebuild or upgrade it"
exit 1
fi
if cat /boot/config-`uname -r` | grep -e "UPROBE.*=y"
then
echo "your os support user space probe completely"
elif cat /boot/config-`uname -r` | grep "UTRACE=y"
then
echo "your os support user space probe partially"
else
echo "Sorry, your os doesn't support user space probe"
fi
if cat /boot/config-`uname -r` | grep CONFIG_FRAME_POINTER=y
then
echo "your os support frame pointer, it's important to probe java program if you install java new than 8u60"
else
echo "Sorry, your os don't support frame pointer, it's important to probe java program if you install java new than 8u60"
fi
}
check_version() {
if grep "release 6" /etc/redhat-release >> /dev/null;
then
os_version=7
elif grep "release 6" /etc/redhat-release >> /dev/null;
then
os_version=6
else
echo "unsupport redhat version"
cat /etc/redhat-release
exit 1;
fi
}
check_depend() {
local retry=0
which wget > /dev/null
(( $? != 0 )) && yum instal -y wget
which curl > /dev/null
(( $? != 0 )) && yum instal -y curl
which wget > /dev/null || which curl > /dev/null
(( $? != 0 )) && echo "wget or curl is missing" && exit 1
}
install_debuginfo() {
check_kernel
check_version
check_feature
check_depend
echo "check pass, continue...."
yum install -y yum-utils
yum install -y kernel-devel
debuginfo-install -y kernel
kernel_version=`uname -r`
machine=`uname -m`
which wget > /dev/null
if (( $? == 0 ))
then
wget -c http://debuginfo.centos.org/${os_version}/${machine}/kernel-debug-debuginfo-${kernel_version}.rpm
wget -c http://debuginfo.centos.org/${os_version}/${machine}/kernel-debuginfo-${kernel_version}.rpm
wget -c http://debuginfo.centos.org/${os_version}/${machine}/kernel-debuginfo-common-${machine}-${kernel_version}.rpm
else
which curl > /dev/null
if (( $? == 0 ))
then
curl http://debuginfo.centos.org/${os_version}/${machine}/kernel-debug-debuginfo-${kernel_version}.rpm \
-o kernel-debug-debuginfo-${kernel_version}.rpm
curl http://debuginfo.centos.org/${os_version}/${machine}/kernel-debuginfo-${kernel_version}.rpm \
-o kernel-debuginfo-${kernel_version}.rpm
curl http://debuginfo.centos.org/${os_version}/${machine}/kernel-debuginfo-common-${machine}-${kernel_version}.rpm \
-o kernel-debuginfo-common-${machine}-${kernel_version}.rpm
fi
fi
rpm -ivh kernel-debug-debuginfo-${kernel_version}.rpm kernel-debuginfo-common-${machine}-${kernel_version}.rpm kernel-debuginfo-${kernel_version}.rpm
}
install_systemtap() {
yum install -y systemtap systemtap-runtime
stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'
}
install_perf() {
yum install -y perf
}
main() {
check_privilege
install_debuginfo
install_systemtap
install_perf
}
main