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
This commit is contained in:
parent
6f370f0608
commit
0358d1f175
@ -6,11 +6,10 @@ check_net() {
|
|||||||
wget -q -O - -T 10 $url/public-keys 2> /dev/null || exit 1
|
wget -q -O - -T 10 $url/public-keys 2> /dev/null || exit 1
|
||||||
echo
|
echo
|
||||||
) | (
|
) | (
|
||||||
while read line
|
while read line ; do
|
||||||
do
|
key=$(echo $line | sed 's/\([0-9]\+\)=.*/\1/')
|
||||||
key=$(echo $line | sed 's/\([0-9]\+\)=.*/\1/')
|
key_url=$url/public-keys/$key/openssh-key
|
||||||
key_url=$url/public-keys/$key/openssh-key
|
wget -q -O - -T 10 $key_url 2> /dev/null || exit 1
|
||||||
wget -q -O - -T 10 $key_url 2> /dev/null || exit 1
|
|
||||||
done
|
done
|
||||||
) >> authorized_keys
|
) >> authorized_keys
|
||||||
}
|
}
|
||||||
@ -24,8 +23,7 @@ json_metadata() {
|
|||||||
check_cd() {
|
check_cd() {
|
||||||
[ -b /dev/sr0 ] || return
|
[ -b /dev/sr0 ] || return
|
||||||
mkdir /tmp/cd
|
mkdir /tmp/cd
|
||||||
if mount /dev/sr0 /tmp/cd
|
if mount /dev/sr0 /tmp/cd ; then
|
||||||
then
|
|
||||||
json_metadata /tmp/cd >> authorized_keys
|
json_metadata /tmp/cd >> authorized_keys
|
||||||
umount /tmp/cd
|
umount /tmp/cd
|
||||||
fi
|
fi
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
if which lsb_release 2> /dev/null && [ $(lsb_release -i -s) = "Ubuntu" ]
|
if which lsb_release 2> /dev/null && [ $(lsb_release -i -s) = "Ubuntu" ] ; then
|
||||||
then
|
|
||||||
sudo apt-get -y install curl unzip bc python quilt parted qemu-utils \
|
sudo apt-get -y install curl unzip bc python quilt parted qemu-utils \
|
||||||
build-essential gcc-multilib
|
build-essential gcc-multilib
|
||||||
fi
|
fi
|
||||||
@ -17,22 +16,19 @@ VERSION=2016.02
|
|||||||
FILENAME=buildroot-${VERSION}.tar.bz2
|
FILENAME=buildroot-${VERSION}.tar.bz2
|
||||||
|
|
||||||
# Download buildroot if we don't have it already
|
# Download buildroot if we don't have it already
|
||||||
if [ ! -f download/$FILENAME ]
|
if [ ! -f download/$FILENAME ] ; then
|
||||||
then
|
|
||||||
wget -P download http://buildroot.org/downloads/$FILENAME
|
wget -P download http://buildroot.org/downloads/$FILENAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Untar buildroot if it's not already there
|
# Untar buildroot if it's not already there
|
||||||
if [ ! -d buildroot ]
|
if [ ! -d buildroot ] ; then
|
||||||
then
|
|
||||||
mkdir buildroot
|
mkdir buildroot
|
||||||
tar -C buildroot -xf download/$FILENAME --strip 1
|
tar -C buildroot -xf download/$FILENAME --strip 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Apply patches to buildroot if we haven't done so before
|
# Apply patches to buildroot if we haven't done so before
|
||||||
PATCH_FLAG_FILE=buildroot/.manila-patches-applied
|
PATCH_FLAG_FILE=buildroot/.manila-patches-applied
|
||||||
if [ ! -f $PATCH_FLAG_FILE ]
|
if [ ! -f $PATCH_FLAG_FILE ] ; then
|
||||||
then
|
|
||||||
( cd buildroot ; QUILT_PATCHES=../patches quilt push -a )
|
( cd buildroot ; QUILT_PATCHES=../patches quilt push -a )
|
||||||
touch $PATCH_FLAG_FILE
|
touch $PATCH_FLAG_FILE
|
||||||
fi
|
fi
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
DISK_NAME=$1
|
DISK_NAME=$1
|
||||||
BR_OUTPUT=output-$1
|
BR_OUTPUT=output-$1
|
||||||
|
|
||||||
if [ -z "$DISK_NAME" ]
|
if [ -z "$DISK_NAME" ] ; then
|
||||||
then
|
|
||||||
echo Specify disk name
|
echo Specify disk name
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@ -52,8 +51,7 @@ sudo tar -C $MOUNT -xf $BR_OUTPUT/images/rootfs.tar
|
|||||||
echo Installing syslinux
|
echo Installing syslinux
|
||||||
sudo $BR_OUTPUT/host/sbin/extlinux -z --install $MOUNT/boot
|
sudo $BR_OUTPUT/host/sbin/extlinux -z --install $MOUNT/boot
|
||||||
|
|
||||||
if [ $DISK_NAME = server ]
|
if [ $DISK_NAME = server ] ; then
|
||||||
then
|
|
||||||
echo Creating share dir
|
echo Creating share dir
|
||||||
SHARE_DIR=$MOUNT/share
|
SHARE_DIR=$MOUNT/share
|
||||||
sudo mkdir -p $SHARE_DIR
|
sudo mkdir -p $SHARE_DIR
|
||||||
|
@ -12,22 +12,19 @@
|
|||||||
# Grab JSON.sh for json parsing
|
# Grab JSON.sh for json parsing
|
||||||
JSON_VERS=e05e69a0debdba68125a33ac786726cb860b2e7b
|
JSON_VERS=e05e69a0debdba68125a33ac786726cb860b2e7b
|
||||||
JSON_SH=https://raw.githubusercontent.com/dominictarr/JSON.sh/$JSON_VERS/JSON.sh
|
JSON_SH=https://raw.githubusercontent.com/dominictarr/JSON.sh/$JSON_VERS/JSON.sh
|
||||||
if [ ! -x download/JSON.sh ]
|
if [ ! -x download/JSON.sh ] ; then
|
||||||
then
|
|
||||||
curl -s $JSON_SH > download/JSON.sh
|
curl -s $JSON_SH > download/JSON.sh
|
||||||
chmod +x download/JSON.sh
|
chmod +x download/JSON.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the filesystem overlays
|
# Create the filesystem overlays
|
||||||
if [ ! -d overlay-client ]
|
if [ ! -d overlay-client ] ; then
|
||||||
then
|
|
||||||
mkdir overlay-client
|
mkdir overlay-client
|
||||||
cp -a common-files/* overlay-client
|
cp -a common-files/* overlay-client
|
||||||
mkdir -p overlay-client/usr/bin
|
mkdir -p overlay-client/usr/bin
|
||||||
cp download/JSON.sh overlay-server/usr/bin
|
cp download/JSON.sh overlay-server/usr/bin
|
||||||
fi
|
fi
|
||||||
if [ ! -d overlay-server ]
|
if [ ! -d overlay-server ] ; then
|
||||||
then
|
|
||||||
mkdir overlay-server
|
mkdir overlay-server
|
||||||
cp -a common-files/* overlay-server
|
cp -a common-files/* overlay-server
|
||||||
cp -a server-files/* overlay-server
|
cp -a server-files/* overlay-server
|
||||||
@ -44,8 +41,7 @@ cd buildroot
|
|||||||
BUILD_IMAGES="client server"
|
BUILD_IMAGES="client server"
|
||||||
|
|
||||||
# Setup the build directories with their configs
|
# Setup the build directories with their configs
|
||||||
for IMAGE in $BUILD_IMAGES
|
for IMAGE in $BUILD_IMAGES ; do
|
||||||
do
|
|
||||||
make O=../output-${IMAGE} manila_${IMAGE}_defconfig
|
make O=../output-${IMAGE} manila_${IMAGE}_defconfig
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -53,8 +49,7 @@ done
|
|||||||
rm configs/manila_*_defconfig
|
rm configs/manila_*_defconfig
|
||||||
|
|
||||||
# Do the builds
|
# Do the builds
|
||||||
for IMAGE in $BUILD_IMAGES
|
for IMAGE in $BUILD_IMAGES ; do
|
||||||
do
|
|
||||||
make O=../output-${IMAGE} all
|
make O=../output-${IMAGE} all
|
||||||
( cd .. ; ./make-bootable-disk.sh $IMAGE )
|
( cd .. ; ./make-bootable-disk.sh $IMAGE )
|
||||||
done
|
done
|
||||||
|
2
tox.ini
2
tox.ini
@ -13,4 +13,4 @@ commands = bash -c "find {toxinidir} \
|
|||||||
-not \( -type d -name buildroot -prune \) \
|
-not \( -type d -name buildroot -prune \) \
|
||||||
-not \( -type d -name download -prune \) \
|
-not \( -type d -name download -prune \) \
|
||||||
-type f -name \*.sh \
|
-type f -name \*.sh \
|
||||||
-print0 | xargs -0 bashate -v -iE010,E011"
|
-print0 | xargs -0 bashate -v"
|
||||||
|
Loading…
Reference in New Issue
Block a user