瀏覽代碼

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)
Tianon Gravi 11 年之前
父節點
當前提交
9712f8127a
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      contrib/check-config.sh

+ 7 - 2
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