From 2df08ccdf51b867fbb81148b86c6416b0a1349d8 Mon Sep 17 00:00:00 2001 From: Robert Bailey Date: Mon, 28 Nov 2016 09:47:29 -0800 Subject: [PATCH] Use gsed on the mac. --- cluster/gce/util.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index c8a54b0adf..6f99ff48b9 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -1913,5 +1913,14 @@ function prepare-e2e() { # limits the size of metadata fields to 32K, and stripping comments is the # easiest way to buy us a little more room. function prepare-startup-script() { - sed '/^\s*#\([^!].*\)*$/ d' ${KUBE_ROOT}/cluster/gce/configure-vm.sh > ${KUBE_TEMP}/configure-vm.sh + # Find a standard sed instance (and ensure that the command works as expected on a Mac). + SED=sed + if which gsed &>/dev/null; then + SED=gsed + fi + if ! ($SED --version 2>&1 | grep -q GNU); then + echo "!!! GNU sed is required. If on OS X, use 'brew install gnu-sed'." + exit 1 + fi + $SED '/^\s*#\([^!].*\)*$/ d' ${KUBE_ROOT}/cluster/gce/configure-vm.sh > ${KUBE_TEMP}/configure-vm.sh }