summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Swartzlander <ben@swartzlander.org>2017-01-28 14:38:10 -0500
committerBen Swartzlander <ben@swartzlander.org>2017-01-29 23:56:06 +0000
commit0358d1f17593a77fa8e804a6f75b8483c886cdfe (patch)
tree7bd7fc080bc91e33a2eb41628163af85d39ea10c
parent6f370f060895358411ea80f236c599b67d3b1e1e (diff)
Conform to bashate standards for control structures
Enable bashate errors E010 and E011 which require "then" and "do" tokens on the same lines as "if" and "while" respectively. Change-Id: I4a167530a21ab95d5dbe9f903facc9566a0461e2
Notes
Notes (review): Code-Review+2: Goutham Pacha Ravi <gouthampravi@gmail.com> Code-Review+2: Mark Sturdevant <mark.sturdevant@ibm.com> Workflow+1: Mark Sturdevant <mark.sturdevant@ibm.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 30 Jan 2017 00:04:59 +0000 Reviewed-on: https://review.openstack.org/426515 Project: openstack/manila-test-image Branch: refs/heads/master
-rwxr-xr-xcommon-files/etc/init.d/S99metadata12
-rwxr-xr-xinit-buildroot.sh12
-rwxr-xr-xmake-bootable-disk.sh6
-rwxr-xr-xrun-buildroot.sh15
-rw-r--r--tox.ini2
5 files changed, 17 insertions, 30 deletions
diff --git a/common-files/etc/init.d/S99metadata b/common-files/etc/init.d/S99metadata
index 37bf9c9..05e69b7 100755
--- a/common-files/etc/init.d/S99metadata
+++ b/common-files/etc/init.d/S99metadata
@@ -6,11 +6,10 @@ check_net() {
6 wget -q -O - -T 10 $url/public-keys 2> /dev/null || exit 1 6 wget -q -O - -T 10 $url/public-keys 2> /dev/null || exit 1
7 echo 7 echo
8 ) | ( 8 ) | (
9 while read line 9 while read line ; do
10 do 10 key=$(echo $line | sed 's/\([0-9]\+\)=.*/\1/')
11 key=$(echo $line | sed 's/\([0-9]\+\)=.*/\1/') 11 key_url=$url/public-keys/$key/openssh-key
12 key_url=$url/public-keys/$key/openssh-key 12 wget -q -O - -T 10 $key_url 2> /dev/null || exit 1
13 wget -q -O - -T 10 $key_url 2> /dev/null || exit 1
14 done 13 done
15 ) >> authorized_keys 14 ) >> authorized_keys
16} 15}
@@ -24,8 +23,7 @@ json_metadata() {
24check_cd() { 23check_cd() {
25 [ -b /dev/sr0 ] || return 24 [ -b /dev/sr0 ] || return
26 mkdir /tmp/cd 25 mkdir /tmp/cd
27 if mount /dev/sr0 /tmp/cd 26 if mount /dev/sr0 /tmp/cd ; then
28 then
29 json_metadata /tmp/cd >> authorized_keys 27 json_metadata /tmp/cd >> authorized_keys
30 umount /tmp/cd 28 umount /tmp/cd
31 fi 29 fi
diff --git a/init-buildroot.sh b/init-buildroot.sh
index 1d42678..f5ea091 100755
--- a/init-buildroot.sh
+++ b/init-buildroot.sh
@@ -7,8 +7,7 @@
7# it under the terms of the GNU General Public License version 2 as 7# it under the terms of the GNU General Public License version 2 as
8# published by the Free Software Foundation. 8# published by the Free Software Foundation.
9 9
10if which lsb_release 2> /dev/null && [ $(lsb_release -i -s) = "Ubuntu" ] 10if which lsb_release 2> /dev/null && [ $(lsb_release -i -s) = "Ubuntu" ] ; then
11then
12 sudo apt-get -y install curl unzip bc python quilt parted qemu-utils \ 11 sudo apt-get -y install curl unzip bc python quilt parted qemu-utils \
13 build-essential gcc-multilib 12 build-essential gcc-multilib
14fi 13fi
@@ -17,22 +16,19 @@ VERSION=2016.02
17FILENAME=buildroot-${VERSION}.tar.bz2 16FILENAME=buildroot-${VERSION}.tar.bz2
18 17
19# Download buildroot if we don't have it already 18# Download buildroot if we don't have it already
20if [ ! -f download/$FILENAME ] 19if [ ! -f download/$FILENAME ] ; then
21then
22 wget -P download http://buildroot.org/downloads/$FILENAME 20 wget -P download http://buildroot.org/downloads/$FILENAME
23fi 21fi
24 22
25# Untar buildroot if it's not already there 23# Untar buildroot if it's not already there
26if [ ! -d buildroot ] 24if [ ! -d buildroot ] ; then
27then
28 mkdir buildroot 25 mkdir buildroot
29 tar -C buildroot -xf download/$FILENAME --strip 1 26 tar -C buildroot -xf download/$FILENAME --strip 1
30fi 27fi
31 28
32# Apply patches to buildroot if we haven't done so before 29# Apply patches to buildroot if we haven't done so before
33PATCH_FLAG_FILE=buildroot/.manila-patches-applied 30PATCH_FLAG_FILE=buildroot/.manila-patches-applied
34if [ ! -f $PATCH_FLAG_FILE ] 31if [ ! -f $PATCH_FLAG_FILE ] ; then
35then
36 ( cd buildroot ; QUILT_PATCHES=../patches quilt push -a ) 32 ( cd buildroot ; QUILT_PATCHES=../patches quilt push -a )
37 touch $PATCH_FLAG_FILE 33 touch $PATCH_FLAG_FILE
38fi 34fi
diff --git a/make-bootable-disk.sh b/make-bootable-disk.sh
index 973767d..4d6878c 100755
--- a/make-bootable-disk.sh
+++ b/make-bootable-disk.sh
@@ -10,8 +10,7 @@
10DISK_NAME=$1 10DISK_NAME=$1
11BR_OUTPUT=output-$1 11BR_OUTPUT=output-$1
12 12
13if [ -z "$DISK_NAME" ] 13if [ -z "$DISK_NAME" ] ; then
14then
15 echo Specify disk name 14 echo Specify disk name
16 exit 2 15 exit 2
17fi 16fi
@@ -52,8 +51,7 @@ sudo tar -C $MOUNT -xf $BR_OUTPUT/images/rootfs.tar
52echo Installing syslinux 51echo Installing syslinux
53sudo $BR_OUTPUT/host/sbin/extlinux -z --install $MOUNT/boot 52sudo $BR_OUTPUT/host/sbin/extlinux -z --install $MOUNT/boot
54 53
55if [ $DISK_NAME = server ] 54if [ $DISK_NAME = server ] ; then
56then
57 echo Creating share dir 55 echo Creating share dir
58 SHARE_DIR=$MOUNT/share 56 SHARE_DIR=$MOUNT/share
59 sudo mkdir -p $SHARE_DIR 57 sudo mkdir -p $SHARE_DIR
diff --git a/run-buildroot.sh b/run-buildroot.sh
index ead9e07..2057007 100755
--- a/run-buildroot.sh
+++ b/run-buildroot.sh
@@ -12,22 +12,19 @@
12# Grab JSON.sh for json parsing 12# Grab JSON.sh for json parsing
13JSON_VERS=e05e69a0debdba68125a33ac786726cb860b2e7b 13JSON_VERS=e05e69a0debdba68125a33ac786726cb860b2e7b
14JSON_SH=https://raw.githubusercontent.com/dominictarr/JSON.sh/$JSON_VERS/JSON.sh 14JSON_SH=https://raw.githubusercontent.com/dominictarr/JSON.sh/$JSON_VERS/JSON.sh
15if [ ! -x download/JSON.sh ] 15if [ ! -x download/JSON.sh ] ; then
16then
17 curl -s $JSON_SH > download/JSON.sh 16 curl -s $JSON_SH > download/JSON.sh
18 chmod +x download/JSON.sh 17 chmod +x download/JSON.sh
19fi 18fi
20 19
21# Create the filesystem overlays 20# Create the filesystem overlays
22if [ ! -d overlay-client ] 21if [ ! -d overlay-client ] ; then
23then
24 mkdir overlay-client 22 mkdir overlay-client
25 cp -a common-files/* overlay-client 23 cp -a common-files/* overlay-client
26 mkdir -p overlay-client/usr/bin 24 mkdir -p overlay-client/usr/bin
27 cp download/JSON.sh overlay-server/usr/bin 25 cp download/JSON.sh overlay-server/usr/bin
28fi 26fi
29if [ ! -d overlay-server ] 27if [ ! -d overlay-server ] ; then
30then
31 mkdir overlay-server 28 mkdir overlay-server
32 cp -a common-files/* overlay-server 29 cp -a common-files/* overlay-server
33 cp -a server-files/* overlay-server 30 cp -a server-files/* overlay-server
@@ -44,8 +41,7 @@ cd buildroot
44BUILD_IMAGES="client server" 41BUILD_IMAGES="client server"
45 42
46# Setup the build directories with their configs 43# Setup the build directories with their configs
47for IMAGE in $BUILD_IMAGES 44for IMAGE in $BUILD_IMAGES ; do
48do
49 make O=../output-${IMAGE} manila_${IMAGE}_defconfig 45 make O=../output-${IMAGE} manila_${IMAGE}_defconfig
50done 46done
51 47
@@ -53,8 +49,7 @@ done
53rm configs/manila_*_defconfig 49rm configs/manila_*_defconfig
54 50
55# Do the builds 51# Do the builds
56for IMAGE in $BUILD_IMAGES 52for IMAGE in $BUILD_IMAGES ; do
57do
58 make O=../output-${IMAGE} all 53 make O=../output-${IMAGE} all
59 ( cd .. ; ./make-bootable-disk.sh $IMAGE ) 54 ( cd .. ; ./make-bootable-disk.sh $IMAGE )
60done 55done
diff --git a/tox.ini b/tox.ini
index f5cc9ba..d09399f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,4 +13,4 @@ commands = bash -c "find {toxinidir} \
13 -not \( -type d -name buildroot -prune \) \ 13 -not \( -type d -name buildroot -prune \) \
14 -not \( -type d -name download -prune \) \ 14 -not \( -type d -name download -prune \) \
15 -type f -name \*.sh \ 15 -type f -name \*.sh \
16 -print0 | xargs -0 bashate -v -iE010,E011" 16 -print0 | xargs -0 bashate -v"