Skip to content

Instantly share code, notes, and snippets.

@kaiakz
Last active May 16, 2020 06:31
Show Gist options
  • Save kaiakz/9ace290017437ccfc17c5b574587166e to your computer and use it in GitHub Desktop.
Save kaiakz/9ace290017437ccfc17c5b574587166e to your computer and use it in GitHub Desktop.
A simple shell script that checks minimal requirement to compile Linux kernel
#!/bin/bash
programs=(
"GNU C 4.6 "
"GNU make 3.81 "
"binutils 2.23 "
"flex 2.5.35 "
"bison 2.0 "
"util-linux 2.10o "
"kmod 13 "
"e2fsprogs 1.41.4 "
"jfsutils 1.1.3 "
"reiserfsprogs 3.6.3 "
"xfsprogs 2.6.0 "
"squashfs-tools 4.0 "
"btrfs-progs 0.18 "
"pcmciautils 004 "
"quota-tools 3.09 "
"PPP 2.4.0 "
"nfs-utils 1.0.5 "
"procps 3.2.0 "
"oprofile 0.9 "
"udev 081 "
"grub 0.93 "
"mcelog 0.6 "
"iptables 1.4.2 "
"openssl & libcrypto 1.0.0 "
"bc 1.06.95"
)
commands=(
"gcc --version"
"make --version"
"ld -v"
"flex --version"
"bison --version"
"fdformat --version"
"depmod -V"
"e2fsck -V"
"fsck.jfs -V"
"reiserfsck -V"
"xfs_db -V"
"mksquashfs -version"
"btrfsck"
"pccardctl -V"
"quota -V"
"pppd --version"
"showmount --version"
"ps --version"
"oprofiled --version"
"udevd --version"
"grub --version || grub-install --version"
"mcelog --version"
"iptables -V"
"openssl version"
"bc --version"
)
for((i=0; i < ${#programs[@]};i++)) do
echo -e '\033[33mRequires: ' ${programs[i]} '\033[0m';
# ^\b\w*\b
if ! type $(echo ${commands[i]} | grep -Eo '^\b\w*\b') > /dev/null; then
echo -e "\033[31mNot Satisfied\033[0m";
else
echo -e '\033[32mInstalled:';
${commands[i]};
echo -e '\033[0m';
fi
echo -e '\033[35m====================================================================\033[0m';
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment