From 9712f8127a9ac47a3679e20faea08fb971ee1ecc Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 3 Apr 2014 11:46:24 -0600 Subject: [PATCH] Update contrib/check-config.sh to use zcat and grep if zgrep isn't available Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) --- contrib/check-config.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/check-config.sh b/contrib/check-config.sh index f225443138..3b1ff8ad85 100755 --- a/contrib/check-config.sh +++ b/contrib/check-config.sh @@ -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