From 0c98cfee3e32452f2be3a4bf9aa532d10ba15249 Mon Sep 17 00:00:00 2001 From: Ben Swartzlander Date: Sat, 28 Jan 2017 15:39:09 -0500 Subject: [PATCH] Wrap long lines Fix bashate warning E006 by wrapping long lines. Also make sure bashate runs on init scripts that don't end in .sh. Change-Id: I077a064505e6f11f61c65279a54c9b2430044bf0 --- common-files/etc/init.d/S99metadata | 3 ++- run-buildroot.sh | 12 +++++++----- test-image.sh | 4 +++- tox.ini | 7 ++++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/common-files/etc/init.d/S99metadata b/common-files/etc/init.d/S99metadata index 05e69b7..cef1ad2 100755 --- a/common-files/etc/init.d/S99metadata +++ b/common-files/etc/init.d/S99metadata @@ -17,7 +17,8 @@ check_net() { json_metadata() { F=$1/ec2/2009-04-04/meta-data.json [ -f $F ] || return - JSON.sh < $F | sed -n 's/^\["public-keys","[0-9]\+","openssh-key"\]\t"\(.*\)\\n"$/\1/p' + SCRIPT='s/^\["public-keys","[0-9]\+","openssh-key"\]\t"\(.*\)\\n"$/\1/p' + JSON.sh < $F | sed -n "$SCRIPT" } check_cd() { diff --git a/run-buildroot.sh b/run-buildroot.sh index 2057007..d0cb50c 100755 --- a/run-buildroot.sh +++ b/run-buildroot.sh @@ -11,10 +11,12 @@ # Grab JSON.sh for json parsing JSON_VERS=e05e69a0debdba68125a33ac786726cb860b2e7b -JSON_SH=https://raw.githubusercontent.com/dominictarr/JSON.sh/$JSON_VERS/JSON.sh +GITHUB_RAW=https://raw.githubusercontent.com +JSON_URL=$GITHUB_RAW/dominictarr/JSON.sh/$JSON_VERS/JSON.sh +JSON_SH=download/JSON.sh if [ ! -x download/JSON.sh ] ; then - curl -s $JSON_SH > download/JSON.sh - chmod +x download/JSON.sh + curl -s $JSON_URL > $JSON_SH + chmod +x $JSON_SH fi # Create the filesystem overlays @@ -22,14 +24,14 @@ if [ ! -d overlay-client ] ; then mkdir overlay-client cp -a common-files/* overlay-client mkdir -p overlay-client/usr/bin - cp download/JSON.sh overlay-server/usr/bin + cp $JSON_SH overlay-server/usr/bin fi if [ ! -d overlay-server ] ; then mkdir overlay-server cp -a common-files/* overlay-server cp -a server-files/* overlay-server mkdir -p overlay-server/usr/bin - cp download/JSON.sh overlay-server/usr/bin + cp $JSON_SH overlay-server/usr/bin fi # Copy the config files where they need to go (temporarily) diff --git a/test-image.sh b/test-image.sh index 019f940..d85e577 100755 --- a/test-image.sh +++ b/test-image.sh @@ -1,5 +1,7 @@ #!/bin/sh qemu-img create -f qcow2 -b client.qcow2 client-test.qcow2 -kvm -m 512 -monitor none -nographic -drive file=client-test.qcow2,if=virtio,format=qcow2 -netdev user,id=net0 -device virtio-net-pci,netdev=net0 +kvm -m 512 -monitor none -nographic \ + -drive file=client-test.qcow2,if=virtio,format=qcow2 \ + -netdev user,id=net0 -device virtio-net-pci,netdev=net0 rm client-test.qcow2 diff --git a/tox.ini b/tox.ini index d09399f..d9b5c88 100644 --- a/tox.ini +++ b/tox.ini @@ -6,11 +6,12 @@ deps = {env:BASHATE_INSTALL_PATH:bashate==0.5.1} [testenv:bashate] whitelist_externals = bash -commands = bash -c "find {toxinidir} \ +commands = bash -c "(find {toxinidir} \ -not \( -type d -name .?\* -prune \) \ -not \( -type d -name output-\* -prune \) \ -not \( -type d -name overlay-\* -prune \) \ -not \( -type d -name buildroot -prune \) \ -not \( -type d -name download -prune \) \ - -type f -name \*.sh \ - -print0 | xargs -0 bashate -v" + -type f -name \*.sh -print0 ; \ + find {toxinidir}/common-files/etc/init.d \ + -type f -print0) | xargs -0 bashate -v"