Update contrib/check-config.sh to use zcat and grep if zgrep isn't available

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: 9712f8127a9ac47a3679e20faea08fb971ee1ecc
Component: engine
This commit is contained in:
Tianon Gravi
2014-04-03 11:46:24 -06:00
parent 811da2f6bf
commit 78e32310f2

View File

@ -5,10 +5,15 @@ set -e
# see also https://github.com/lxc/lxc/blob/lxc-1.0.2/src/lxc/lxc-checkconfig.in
: ${CONFIG:=/proc/config.gz}
: ${GREP:=zgrep}
if ! command -v zgrep &> /dev/null; then
zgrep() {
zcat "$2" | grep "$1"
}
fi
is_set() {
$GREP "CONFIG_$1=[y|m]" $CONFIG > /dev/null
zgrep "CONFIG_$1=[y|m]" "$CONFIG" > /dev/null
}
# see http://en.wikipedia.org/wiki/ANSI_escape_code#Colors