3
# Allow environment variables to override grep and config
4
: ${CONFIG:=/proc/config.gz}
7
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
8
SETCOLOR_FAILURE="echo -en \\033[1;31m"
9
SETCOLOR_WARNING="echo -en \\033[1;33m"
10
SETCOLOR_NORMAL="echo -en \\033[0;39m"
13
$GREP -q "$1=[y|m]" $CONFIG
23
if [ $RES -eq 0 ]; then
24
$SETCOLOR_SUCCESS && echo -e "enabled" && $SETCOLOR_NORMAL
26
if [ ! -z "$mandatory" -a "$mandatory" = yes ]; then
27
$SETCOLOR_FAILURE && echo -e "required" && $SETCOLOR_NORMAL
29
$SETCOLOR_WARNING && echo -e "missing" && $SETCOLOR_NORMAL
34
if [ ! -f $CONFIG ]; then
35
echo "Kernel config $CONFIG not found, looking in other places..."
37
HEADERS_CONFIG="/lib/modules/$KVER/build/.config"
38
BOOT_CONFIG="/boot/config-$KVER"
39
[ -f "${HEADERS_CONFIG}" ] && CONFIG=${HEADERS_CONFIG}
40
[ -f "${BOOT_CONFIG}" ] && CONFIG=${BOOT_CONFIG}
42
if [ ! -f $CONFIG ]; then
44
echo "The kernel configuration can not be retrieved."
45
echo "Please recompile with IKCONFIG_PROC, or"
46
echo "install the kernel headers, or specify"
47
echo "the path to the config file with: CONFIG=<path> lxc-checkconfig"
51
echo "Found kernel config file $CONFIG"
55
echo "--- Namespaces ---"
56
echo -n "Namespaces: " && is_enabled CONFIG_NAMESPACES yes
57
echo -n "Utsname namespace: " && is_enabled CONFIG_UTS_NS
58
echo -n "Ipc namespace: " && is_enabled CONFIG_IPC_NS yes
59
echo -n "Pid namespace: " && is_enabled CONFIG_PID_NS yes
60
echo -n "User namespace: " && is_enabled CONFIG_USER_NS
61
echo -n "Network namespace: " && is_enabled CONFIG_NET_NS
62
echo -n "Multiple /dev/pts instances: " && is_enabled DEVPTS_MULTIPLE_INSTANCES
64
echo "--- Control groups ---"
66
CGROUP_MNT_PATH=$(grep -m1 "^cgroup" /proc/self/mounts | awk '{ print $2 }')
68
echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes
70
if [ -f $CGROUP_MNT_PATH/cgroup.clone_children ]; then
71
echo -n "Cgroup clone_children flag: " &&
72
$SETCOLOR_SUCCESS && echo -e "enabled" && $SETCOLOR_NORMAL
74
echo -n "Cgroup namespace: " && is_enabled CONFIG_CGROUP_NS yes
76
echo -n "Cgroup device: " && is_enabled CONFIG_CGROUP_DEVICE
77
echo -n "Cgroup sched: " && is_enabled CONFIG_CGROUP_SCHED
78
echo -n "Cgroup cpu account: " && is_enabled CONFIG_CGROUP_CPUACCT
79
echo -n "Cgroup memory controller: " && is_enabled CONFIG_CGROUP_MEM_RES_CTLR
80
is_set CONFIG_SMP && echo -n "Cgroup cpuset: " && is_enabled CONFIG_CPUSETS
83
echo -n "Veth pair device: " && is_enabled CONFIG_VETH
84
echo -n "Macvlan: " && is_enabled CONFIG_MACVLAN
85
echo -n "Vlan: " && is_enabled CONFIG_VLAN_8021Q
86
KVER_MINOR=$($GREP '^# Linux' $CONFIG | \
87
sed -r 's/.*2.6.([0-9]{2}).*/\1/')
88
echo -n "File capabilities: " &&
89
[[ ${KVER_MINOR} < 33 ]] && is_enabled CONFIG_SECURITY_FILE_CAPABILITIES ||
90
[[ ${KVER_MINOR} > 32 ]] && $SETCOLOR_SUCCESS && echo -e "enabled" &&
94
echo "Note : Before booting a new kernel, you can check its configuration"
95
echo "usage : CONFIG=/path/to/config $0"