diff --git a/bin/release b/bin/release index 9328c8ae2..b988506ed 100755 --- a/bin/release +++ b/bin/release @@ -39,7 +39,7 @@ setup() { else echo "Cannot determine version - multiple tags point at HEAD:" >&2 for TAG in $HEAD_TAGS; do - echo -e "\t$TAG" >&2 + echo -e "\\t$TAG" >&2 done exit 1 fi @@ -65,8 +65,8 @@ build() { echo "== Clone repo at $LATEST_TAG for version $VERSION" if [ -d "$RELEASE_DIR" ]; then - echo -e "\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2 - echo -e "\trm -rf $RELEASE_DIR" >&2 + echo -e "\\u2757 Release directory $RELEASE_DIR already exists, you may want to" >&2 + echo -e "\\trm -rf $RELEASE_DIR" >&2 exit 1 fi @@ -78,7 +78,7 @@ build() { ## Check that the top changelog entry is this version if ! latest_changelog=$(perl -nle'print $& if m{(?<=^## Release ).*}' ./CHANGELOG.md | head -1) \ || ! [ "$latest_changelog" = "$VERSION" ]; then - echo -e "\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2 + echo -e "\\u2757 Latest changelog entry \"$latest_changelog\" does not match the release version $VERSION" >&2 exit 1 fi @@ -93,7 +93,7 @@ build() { if make tests SUDO="$SUDO"; then echo -e '\u2713 Tests pass' else - echo -e "\u2757 Tests failed, probably best not publish this one" >&2 + echo -e "\\u2757 Tests failed, probably best not publish this one" >&2 exit 1 fi @@ -119,20 +119,20 @@ draft() { ## Check that the tag exists by looking at github if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_TAG_SHA" >/dev/null 2>&1; then - echo -e "\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2 - echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2 + echo -e "\\u2757 Tag $LATEST_TAG is not on GitHub, or is not the same as the local tag" >&2 + echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2 echo "You may need to" >&2 - echo -e "\tgit push git@github.com:$GITHUB_USER/scope $LATEST_TAG" + echo -e "\\tgit push git@github.com:$GITHUB_USER/scope $LATEST_TAG" exit 1 fi - echo -e "\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope" + echo -e "\\u2713 Tag $LATEST_TAG exists in GitHub repo $GITHUB_USER/scope" ## Check that the version does not already exist by looking at github ## releases if github-release info --user "$GITHUB_USER" --repo scope --tag "$LATEST_TAG" >/dev/null 2>&1; then - echo -e "\u2757 Release $LATEST_TAG already exists on GitHub" >&2 - echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2 + echo -e "\\u2757 Release $LATEST_TAG already exists on GitHub" >&2 + echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" >&2 exit 1 fi @@ -144,7 +144,7 @@ draft() { fi echo "== Creating GitHub release $RELEASE_ARGS $RELEASE_NAME $VERSION" - github-release release $RELEASE_ARGS \ + github-release release "$RELEASE_ARGS" \ --user "$GITHUB_USER" \ --repo scope \ --tag "$LATEST_TAG" \ @@ -159,7 +159,7 @@ draft() { --file "./scope" echo "** Draft $TYPE $RELEASE_NAME $VERSION created at" - echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" + echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" } publish() { @@ -177,22 +177,22 @@ publish() { --tag "$LATEST_TAG" echo "** Pre-release $RELEASE_NAME $VERSION published at" - echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" + echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" else echo "== Sanity checks" if ! [ "$LATEST_TAG_COMMIT_SHA" == "$LATEST_RELEASE_COMMIT_SHA" ]; then - echo -e "\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2 + echo -e "\\u2757 The tag latest_release does not point to the same commit as $LATEST_TAG" >&2 echo "You may need to" >&2 - echo -e "\tgit tag -af latest_release $LATEST_TAG" >&2 + echo -e "\\tgit tag -af latest_release $LATEST_TAG" >&2 exit 1 fi ## Check that the 'latest_release' tag exists by looking at github if ! curl -sSf "https://api.github.com/repos/$GITHUB_USER/scope/git/tags/$LATEST_RELEASE_SHA" >/dev/null 2>&1; then - echo -e "\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2 - echo -e "\thttps://github.com/$GITHUB_USER/scope/tags" >&2 + echo -e "\\u2757 Tag latest_release is not on GitHub, or is not the same as the local tag" >&2 + echo -e "\\thttps://github.com/$GITHUB_USER/scope/tags" >&2 echo "You may need to" >&2 - echo -e "\tgit push -f git@github.com:$GITHUB_USER/scope latest_release" >&2 + echo -e "\\tgit push -f git@github.com:$GITHUB_USER/scope latest_release" >&2 exit 1 fi echo '** Sanity checks OK for publishing tag' "$LATEST_TAG" as "$DOCKERHUB_USER/scope:$VERSION" @@ -229,8 +229,8 @@ publish() { --file "./scope" echo "** Release $RELEASE_NAME $VERSION published at" - echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" - echo -e "\thttps://github.com/$GITHUB_USER/scope/releases/latest_release" + echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/$LATEST_TAG" + echo -e "\\thttps://github.com/$GITHUB_USER/scope/releases/latest_release" fi } @@ -254,19 +254,19 @@ push_images() { usage() { echo "Usage:" - echo -e "\t./bin/release build" + echo -e "\\t./bin/release build" echo "-- Build artefacts for the latest version tag" - echo -e "\t./bin/release draft" + echo -e "\\t./bin/release draft" echo "-- Create draft release with artefacts in GitHub" - echo -e "\t./bin/release publish" + echo -e "\\t./bin/release publish" echo "-- Publish the GitHub release and update DockerHub" exit 1 } # Ensure required tooling is installed -if ! which github-release >/dev/null; then +if ! command -v github-release >/dev/null; then echo "Please install git-release:" >&2 - echo -e "\tgo get github.com/weaveworks/github-release" >&2 + echo -e "\\tgo get github.com/weaveworks/github-release" >&2 echo "and create a git token per https://github.com/weaveworks/github-release" >&2 exit 1 fi diff --git a/extras/build_on_circle.sh b/extras/build_on_circle.sh index 046dd88a8..d0772a20a 100755 --- a/extras/build_on_circle.sh +++ b/extras/build_on_circle.sh @@ -2,4 +2,4 @@ set -e -./in_parallel.sh "make RM=" "$(find . -maxdepth 2 -name "*.go" -printf "%h\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')" +./in_parallel.sh "make RM=" "$(find . -maxdepth 2 -name "*.go" -printf "%h\\n" | sort -u | sed -n 's/\.\/\(.*\)/\1\/\1/p')" diff --git a/extras/dialer/dialer b/extras/dialer/dialer index 67dacf46a..86abc7e5f 100755 --- a/extras/dialer/dialer +++ b/extras/dialer/dialer @@ -23,7 +23,7 @@ while true; do rand=$(((RANDOM % max_dialer) + 1)) container=${dialer[$rand]} docker rm -f "$container" >/dev/null & - unset dialer[$rand] + unset "dialer[$rand]" dialer=("${dialer[@]}") fi diff --git a/extras/generate_latest_map b/extras/generate_latest_map index d41d07e23..d08e474b3 100755 --- a/extras/generate_latest_map +++ b/extras/generate_latest_map @@ -211,7 +211,7 @@ function generate_latest_map() { func (m ${latest_map_type}) String() string { buf := bytes.NewBufferString("{") for _, val := range m { - fmt.Fprintf(buf, "%s: %s,\n", val.key, val.String()) + fmt.Fprintf(buf, "%s: %s,\\n", val.key, val.String()) } fmt.Fprintf(buf, "}") return buf.String() diff --git a/integration/410_container_control_test.sh b/integration/410_container_control_test.sh index abe74c541..af6696e5d 100755 --- a/integration/410_container_control_test.sh +++ b/integration/410_container_control_test.sh @@ -20,7 +20,7 @@ PROBEID=$(docker_on "$HOST1" logs weavescope 2>&1 | grep "probe starting" | sed # container's PATH settings are respected, which isn't the case for # login shells. PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$CID;/docker_exec_container" | jq -r '.pipe') -assert "(sleep 1 && echo 'echo \$PATH' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho \$PATH\n/home:/usr/bin\n/ # 6n" +assert "(sleep 1 && echo 'echo \$PATH' && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb" "/ # 6necho \$PATH\\n/home:/usr/bin\\n/ # 6n" assert_raises "curl -f -X POST 'http://$HOST1:4040/api/control/$PROBEID/$CID;/docker_stop_container'" diff --git a/integration/420_host_control_test.sh b/integration/420_host_control_test.sh index fe461b091..19fc448ac 100755 --- a/integration/420_host_control_test.sh +++ b/integration/420_host_control_test.sh @@ -15,6 +15,6 @@ HOSTID=$($SSH "$HOST1" hostname) # Execute 'echo foo' in the host tty and check its output PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$HOSTID;/host_exec" | jq -r '.pipe') -assert "(sleep 1 && echo \"PS1=''; echo foo\" && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb | tail -n 1" "foo\n" +assert "(sleep 1 && echo \"PS1=''; echo foo\" && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb | tail -n 1" "foo\\n" scope_end_suite diff --git a/scope b/scope index 5611e1f5d..e318ec955 100755 --- a/scope +++ b/scope @@ -18,7 +18,7 @@ SCOPE_IMAGE="$SCOPE_IMAGE_NAME:$IMAGE_VERSION" # with care. SCOPE_CONTAINER_NAME="${SCOPE_CONTAINER_NAME:-weavescope}" SCOPE_APP_CONTAINER_NAME="${SCOPE_APP_CONTAINER_NAME:-weavescope-app}" -IP_REGEXP="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" +IP_REGEXP="[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}" IP_ADDR_CMD="find /sys/class/net -type l | xargs -n1 basename | grep -vE 'docker|veth|lo' | \ xargs -n1 ip addr show | grep inet | awk '{ print \$2 }' | grep -oE '$IP_REGEXP'" LISTENING_IP_ADDR_CMD="for I in \$( $IP_ADDR_CMD ); do if curl -m 1 -s \${I}:4040 > /dev/null ; then echo \${I}; fi; done" @@ -112,11 +112,11 @@ check_docker_version() { } check_probe_only() { - echo "${ARGS}" | grep -q -E "\-\-no\-app|\-\-service\-token|\-\-probe\-only" + echo "${ARGS}" | grep -q -E -e "--no-app|--service-token|--probe-only" } check_listen_address_arg() { - echo "${ARGS}" | grep -q -E "\-\-app\.http\.address" + echo "${ARGS}" | grep -q -E -e "--app\\.http\\.address" } check_docker_for_mac() {