Browse Source

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
changes/16/426516/3
Ben Swartzlander 2 years ago
parent
commit
0c98cfee3e
4 changed files with 16 additions and 10 deletions
  1. 2
    1
      common-files/etc/init.d/S99metadata
  2. 7
    5
      run-buildroot.sh
  3. 3
    1
      test-image.sh
  4. 4
    3
      tox.ini

+ 2
- 1
common-files/etc/init.d/S99metadata View File

@@ -17,7 +17,8 @@ check_net() {
17 17
 json_metadata() {
18 18
     F=$1/ec2/2009-04-04/meta-data.json
19 19
     [ -f $F ] || return
20
-    JSON.sh < $F | sed -n 's/^\["public-keys","[0-9]\+","openssh-key"\]\t"\(.*\)\\n"$/\1/p'
20
+    SCRIPT='s/^\["public-keys","[0-9]\+","openssh-key"\]\t"\(.*\)\\n"$/\1/p'
21
+    JSON.sh < $F | sed -n "$SCRIPT"
21 22
 }
22 23
 
23 24
 check_cd() {

+ 7
- 5
run-buildroot.sh View File

@@ -11,10 +11,12 @@
11 11
 
12 12
 # Grab JSON.sh for json parsing
13 13
 JSON_VERS=e05e69a0debdba68125a33ac786726cb860b2e7b
14
-JSON_SH=https://raw.githubusercontent.com/dominictarr/JSON.sh/$JSON_VERS/JSON.sh
14
+GITHUB_RAW=https://raw.githubusercontent.com
15
+JSON_URL=$GITHUB_RAW/dominictarr/JSON.sh/$JSON_VERS/JSON.sh
16
+JSON_SH=download/JSON.sh
15 17
 if [ ! -x download/JSON.sh ] ; then
16
-    curl -s $JSON_SH > download/JSON.sh
17
-    chmod +x download/JSON.sh
18
+    curl -s $JSON_URL > $JSON_SH
19
+    chmod +x $JSON_SH
18 20
 fi
19 21
 
20 22
 # Create the filesystem overlays
@@ -22,14 +24,14 @@ if [ ! -d overlay-client ] ; then
22 24
     mkdir overlay-client
23 25
     cp -a common-files/* overlay-client
24 26
     mkdir -p overlay-client/usr/bin
25
-    cp download/JSON.sh overlay-server/usr/bin
27
+    cp $JSON_SH overlay-server/usr/bin
26 28
 fi
27 29
 if [ ! -d overlay-server ] ; then
28 30
     mkdir overlay-server
29 31
     cp -a common-files/* overlay-server
30 32
     cp -a server-files/* overlay-server
31 33
     mkdir -p overlay-server/usr/bin
32
-    cp download/JSON.sh overlay-server/usr/bin
34
+    cp $JSON_SH overlay-server/usr/bin
33 35
 fi
34 36
 
35 37
 # Copy the config files where they need to go (temporarily)

+ 3
- 1
test-image.sh View File

@@ -1,5 +1,7 @@
1 1
 #!/bin/sh
2 2
 
3 3
 qemu-img create -f qcow2 -b client.qcow2 client-test.qcow2
4
-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
4
+kvm -m 512 -monitor none -nographic \
5
+    -drive file=client-test.qcow2,if=virtio,format=qcow2 \
6
+    -netdev user,id=net0 -device virtio-net-pci,netdev=net0
5 7
 rm client-test.qcow2

+ 4
- 3
tox.ini View File

@@ -6,11 +6,12 @@ deps = {env:BASHATE_INSTALL_PATH:bashate==0.5.1}
6 6
 
7 7
 [testenv:bashate]
8 8
 whitelist_externals = bash
9
-commands = bash -c "find {toxinidir} \
9
+commands = bash -c "(find {toxinidir} \
10 10
                     -not \( -type d -name .?\* -prune \) \
11 11
                     -not \( -type d -name output-\* -prune \) \
12 12
                     -not \( -type d -name overlay-\* -prune \) \
13 13
                     -not \( -type d -name buildroot -prune \) \
14 14
                     -not \( -type d -name download -prune \) \
15
-                    -type f -name \*.sh \
16
-                    -print0 | xargs -0 bashate -v"
15
+                    -type f -name \*.sh -print0 ; \
16
+                    find {toxinidir}/common-files/etc/init.d \
17
+                    -type f -print0) | xargs -0 bashate -v"

Loading…
Cancel
Save