@@ -137,21 +137,55 @@ print_config() {
137137}
138138
139139linuxHeader () {
140- sudo apt-get install -y linux-headers-" $( uname -r) "
141- sudo apt-get install -y linux-modules-" $( uname -r) "
142- sudo apt-get install -y linux-modules-extra-" $( uname -r) "
140+ if [ -f /usr/bin/apt-get ]; then
141+ sudo apt-get install -y linux-headers-" $( uname -r) "
142+ sudo apt-get install -y linux-modules-" $( uname -r) "
143+ sudo apt-get install -y linux-modules-extra-" $( uname -r) "
144+ fi
145+ if [ -f /usr/bin/yum ]; then
146+ echo " do nothing for yum with linux header?"
147+ fi
143148}
144149
145150ebpf () {
146- sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
147- mkdir -p temp-libbpf
148- cd temp-libbpf
149- git clone -b " $LIBBPF_VERSION " https://github.com/libbpf/libbpf
150- cd libbpf/src
151- sudo BUILD_STATIC_ONLY=y make install
152- sudo make install_uapi_headers
153- cd ../../..
154- sudo rm -rf temp-libbpf
151+ if [ -f /usr/bin/apt-get ]; then
152+ sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
153+ mkdir -p temp-libbpf
154+ cd temp-libbpf
155+ git clone -b " $LIBBPF_VERSION " https://github.com/libbpf/libbpf
156+ cd libbpf/src
157+ sudo BUILD_STATIC_ONLY=y make install
158+ sudo make install_uapi_headers
159+ cd ../../..
160+ sudo rm -rf temp-libbpf
161+ fi
162+ if [ -f /usr/bin/yum ]; then
163+ export workdir=$PWD
164+ yum -y install yum-utils cpio bzip2 clang llvm-devel zlib-devel libcurl-devel m4 xz
165+ yum-config-manager --enable ubi-9-baseos-source
166+ mkdir -p /tmp/elfutils-source
167+ cd /tmp/elfutils-source
168+ yumdownloader --source elfutils
169+ rpm2cpio elfutils-0.189-3.el9.src.rpm | cpio -iv
170+ ls -al
171+ tar xjvf elfutils-0.189.tar.bz2
172+ cd /tmp/elfutils-source/elfutils-0.189
173+ ./configure --disable-debuginfod
174+ make install
175+
176+ mkdir -p /tmp/libbpf-source
177+ cd /tmp/libbpf-source
178+ yumdownloader --source libbpf
179+ rpm2cpio libbpf-1.2.0-1.el9.src.rpm | cpio -iv
180+ tar xf ./linux-* el9.tar.xz
181+ cd /tmp/libbpf-source/linux-5.14.0-333.el9/tools/lib/bpf
182+ make install_headers
183+ prefix=/usr BUILD_STATIC_ONLY=y make install
184+ cd /tmp/libbpf-source/linux-5.14.0-333.el9/tools/bpf
185+ make bpftool
186+
187+ cd " $workdir "
188+ fi
155189}
156190
157191containerruntime () {
0 commit comments