Skip to content

Instantly share code, notes, and snippets.

@heiwa4126
Last active July 16, 2020 01:41
Show Gist options
  • Save heiwa4126/68f0b7fa8deafdc1516f68f8de768f9f to your computer and use it in GitHub Desktop.
Save heiwa4126/68f0b7fa8deafdc1516f68f8de768f9f to your computer and use it in GitHub Desktop.
/etc/yum.confに`exclude=kernel-* kmod-* perf-* python-perf-* redhat-release-* initscripts` みたいなことのかいてあるRHELのホストに最新カーネルをインストールするコマンドを表示するスクリプト
#!/bin/bash
pkgs=(bpftool bpftool-debuginfo kernel kernel-abi-whitelists kernel-debug kernel-debug-debuginfo kernel-debug-devel kernel-debuginfo kernel-debuginfo-common-x86_64 kernel-devel kernel-doc kernel-headers kernel-tools kernel-tools-debuginfo kernel-tools-libs kernel-tools-libs-devel perf perf-debuginfo python-perf python-perf-debuginfo)
installed=()
for pkg in ${pkgs[@]}; do
rpm -q "$pkg" &> /dev/null
if [ $? -eq 0 ] ; then
installed+=("$pkg")
fi
done
# echo -n "sudo yum install --disableexcludes=all "
echo -n "sudo -i yum install --disableexcludes=all --downloadonly "
echo ${installed[@]}
@heiwa4126
Copy link
Author

heiwa4126 commented Jul 15, 2020

出力例:

sudo yum install --disableexcludes=all kernel kernel-debug-devel kernel-headers kernel-tools kernel-tools-libs python-perf

12-13行目をちょっと変えれば、即実行もできる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment