Skip to content

Commit

Permalink
More shell quoting fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Jul 23, 2017
1 parent 4e89c72 commit ed22882
Show file tree
Hide file tree
Showing 20 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions building/build-acis/common/container-build-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ACBUILDDIR="${ROOT}/acbuild-tmp"
GO_VER=1.8.3
GO_TGZ="${HELPERS}/go-bin-${GO_VER}.tgz"

ACI_BRIEF="$(basename ${ROOT})"
ACI_BRIEF="$(basename "${ROOT}")"
ACI_NAME="homeworld.mit.edu/${ACI_BRIEF}"

function common_setup() {
Expand Down Expand Up @@ -208,9 +208,9 @@ function run_builder() {
for line in "$@"
do
echo "$line"
done) >${BUILDDIR}/inner-build.sh
done) > "${BUILDDIR}/inner-build.sh"

chmod +x ${BUILDDIR}/inner-build.sh
chmod +x "${BUILDDIR}/inner-build.sh"

# stage1 should not be kvm
RKT_OPTS=(--stage1-path=/usr/lib/rkt/stage1-images/stage1-coreos.aci)
Expand Down
2 changes: 1 addition & 1 deletion building/build-acis/debian-build/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e -u
cd "$(dirname $0)"
cd "$(dirname "$0")"
source ../common/debian.sh

RELEASE="stretch"
Expand Down
2 changes: 1 addition & 1 deletion building/build-acis/debian-micro/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e -u
cd "$(dirname $0)"
cd "$(dirname "$0")"
source ../common/debian.sh

RELEASE="stretch"
Expand Down
2 changes: 1 addition & 1 deletion building/build-acis/debian-mini/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e -u
cd "$(dirname $0)"
cd "$(dirname "$0")"
source ../common/debian.sh

RELEASE="stretch"
Expand Down
2 changes: 1 addition & 1 deletion building/build-acis/debian/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e -u
cd "$(dirname $0)"
cd "$(dirname "$0")"
source ../common/debian.sh

RELEASE="stretch"
Expand Down
2 changes: 1 addition & 1 deletion building/build-acis/flannel/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e -u
cd "$(dirname $0)"
cd "$(dirname "$0")"
source ../common/container-build-helpers.sh

FLANNEL_VER="0.8.0"
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e -u

for x in homeworld-*/
do
(cd $x && ./build-package.sh)
(cd "$x" && ./build-package.sh)
done

./clean.sh
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ rm -f homeworld-*_amd64.build
rm -f homeworld-*_amd64.buildinfo
rm -f homeworld-*_amd64.changes
rm -f homeworld-*.orig.tar.xz
rm -f *.dsc
rm -f -- *.dsc
rm -f homeworld-*-dbgsym_*.deb
rm -f homeworld-*.tar.gz
6 changes: 3 additions & 3 deletions building/build-debs/common/package-build-helpers.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

PKGBASE="$(basename $(dirname $(realpath $0)))"
PKGBASE="$(basename "$(dirname "$(realpath "$0")")")"

if [ "$(echo ${PKGBASE} | cut -d '-' -f 1)" != "homeworld" ]
if [ "$(echo "${PKGBASE}" | cut -d '-' -f 1)" != "homeworld" ]
then
echo "Invalid internal name ${PKGBASE} from $0" 1>&2
exit 1
fi

DVERSION="$(head -n 1 debian/changelog | cut -d '(' -f 2 | cut -d ')' -f 1)"
VERSION="$(echo $DVERSION | cut -d '-' -f 1)"
VERSION="$(echo "$DVERSION" | cut -d '-' -f 1)"
BIN=../binaries
STAGE=..
UPSTREAM=../../upstream
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/homeworld-admitserver/inner-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -u

rm -rf go
tar -xf go-bin-1.8.3.tgz go/
export GOROOT=$(pwd)/go/
export GOROOT="$(pwd)/go/"
export PATH="$PATH:$GOROOT/bin"

if [ "$(go version 2>/dev/null)" != "go version go1.8.3 linux/amd64" ]
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/homeworld-authserver/inner-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -u

rm -rf go
tar -xf go-bin-1.8.3.tgz go/
export GOROOT=$(pwd)/go/
export GOROOT="$(pwd)/go/"
export PATH="$PATH:$GOROOT/bin"

if [ "$(go version 2>/dev/null)" != "go version go1.8.3 linux/amd64" ]
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/homeworld-etcd/inner-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e -u
rm -rf go acbuild
tar -xf go-bin-1.8.3.tgz go/
tar -xf acbuild-bin-0.4.0.tgz acbuild/
export GOROOT=$(pwd)/go/
export GOROOT="$(pwd)/go/"
export PATH="$PATH:$GOROOT/bin:$(pwd)/acbuild"

if [ "$(go version 2>/dev/null)" != "go version go1.8.3 linux/amd64" ]
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/homeworld-hyperkube/inner-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -u

rm -rf go
tar -xf go-bin-1.8.3.tgz go/
export GOROOT=$(pwd)/go/
export GOROOT="$(pwd)/go/"
export PATH="$PATH:$GOROOT/bin"

if [ "$(go version 2>/dev/null)" != "go version go1.8.3 linux/amd64" ]
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/homeworld-rkt/inner-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -u

rm -rf go
tar -xf go-bin-1.8.3.tgz go/
export GOROOT=$(pwd)/go/
export GOROOT="$(pwd)/go/"
export PATH="$PATH:$GOROOT/bin"

if [ "$(go version 2>/dev/null)" != "go version go1.8.3 linux/amd64" ]
Expand Down
2 changes: 1 addition & 1 deletion building/build-helpers/helper-acbuild/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

cd "$(dirname $0)"
cd "$(dirname "$0")"

if [ -e "../acbuild-bin-0.4.0.tgz" ]
then
Expand Down
6 changes: 3 additions & 3 deletions building/build-helpers/helper-go/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ mv go go1.4
tar -xf go1.8.3.src.tar.xz go
mv go go1.8.3
BOOTSTRAP="${ROOT}/go1.4"
cd ${ROOT}/go1.4/src/
cd "${ROOT}/go1.4/src/"
./make.bash
cd ${ROOT}/go1.8.3/src
cd "${ROOT}/go1.8.3/src"
GOROOT_FINAL="/usr/lib/homeworld-goroot" GOARCH="amd64" GOOS="linux" CGO_ENABLED="1" GOROOT_BOOTSTRAP="${BOOTSTRAP}" ./make.bash
cd ${ROOT}
cd "${ROOT}"
rm -rf go1.4
mv go1.8.3 go
tar -czf ../go-bin-1.8.3.tgz go/
Expand Down
4 changes: 2 additions & 2 deletions building/build-iso/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ chmod +w --recursive cd
gunzip cd/initrd.gz
PASS=$(pwgen 20 1)
echo "Password: $PASS"
sed "s|{{HASH}}|$(echo ${PASS} | mkpasswd -s -m sha-512)|" preseed.cfg.in >preseed.cfg
sed "s|{{HASH}}|$(echo "${PASS}" | mkpasswd -s -m sha-512)|" preseed.cfg.in >preseed.cfg
SETUPVER="$(head -n 1 ../build-debs/homeworld-apt-setup/debian/changelog | cut -d '(' -f 2 | cut -d ')' -f 1)"
ADMITVER="$(head -n 1 ../build-debs/homeworld-admitclient/debian/changelog | cut -d '(' -f 2 | cut -d ')' -f 1)"
cp "../build-debs/binaries/homeworld-apt-setup_${SETUPVER}_amd64.deb" "."
Expand All @@ -39,5 +39,5 @@ admission.conf
preseed.cfg
EOF
gzip cd/initrd
(cd cd && md5sum $(find -follow -type f) >md5sum.txt)
(cd cd && find . -follow -type f -print0 | xargs -0 md5sum > md5sum.txt)
genisoimage -quiet -o preseeded.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux.bin -c isolinux.cat ./cd
16 changes: 8 additions & 8 deletions building/upload-acis/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e -u

cd "$(dirname $0)"
cd "$(dirname "$0")"
mkdir -p staging

cp ../build-acis/containers/*.aci -t staging
Expand All @@ -15,12 +15,12 @@ do
done

function find_latest() {
LATEST="$(ls staging/$1*-linux-amd64.aci | grep -vF latest | sort | tail -n 1)"
LATEST="$(ls "staging/$1"*-linux-amd64.aci | grep -vF latest | sort | tail -n 1)"
echo "Latest for $1: $LATEST"
ln -sf "$(basename $LATEST)" "staging/${1}latest-linux-amd64.aci"
ln -sf "$(basename $LATEST.asc)" "staging/${1}latest-linux-amd64.aci.asc"
ln -sf "$(basename $LATEST)" "staging/${2}-linux-amd64.aci"
ln -sf "$(basename $LATEST.asc)" "staging/${2}-linux-amd64.aci.asc"
ln -sf "$(basename "$LATEST")" "staging/${1}latest-linux-amd64.aci"
ln -sf "$(basename "$LATEST.asc")" "staging/${1}latest-linux-amd64.aci.asc"
ln -sf "$(basename "$LATEST")" "staging/${2}-linux-amd64.aci"
ln -sf "$(basename "$LATEST.asc")" "staging/${2}-linux-amd64.aci.asc"
}

for x in debian-build debian debian-mini debian-micro
Expand All @@ -35,9 +35,9 @@ sleep 0.1
DEST=/mit/hyades/acis/homeworld.mit.edu/
for x in staging/*.aci staging/*.aci.asc
do
FILENAME="$(basename $x)"
FILENAME="$(basename "$x")"
echo "checking $x"
if [ ! -e "${DEST}/${FILENAME}" ] || [ "$(wc -c <${x})" != "$(wc -c <${DEST}/${FILENAME})" ]
if [ ! -e "${DEST}/${FILENAME}" ] || [ "$(wc -c < "${x}")" != "$(wc -c < "${DEST}/${FILENAME}")" ]
then
echo "copying $x"
cp -dfT "$x" "${DEST}/${FILENAME}"
Expand Down
2 changes: 1 addition & 1 deletion building/upload-debs/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e -u

cd "$(dirname $0)"
cd "$(dirname "$0")"
reprepro -Vb . includedeb homeworld ../build-debs/binaries/homeworld-*.deb
rsync -av --progress ./dists ./pool /mit/hyades/debian/

4 changes: 2 additions & 2 deletions deployment/clustered/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ fi

rm -f flannel.yml

ADDRESS="$(grep 'CLUSTER_CIDR=' ${1} | sed 's/^\(.*\)=\(.*\)$/\2/g')"
if [ "$(echo $ADDRESS | tr "./" "\n\n" | wc -l)" != 5 ]
ADDRESS="$(grep 'CLUSTER_CIDR=' "${1}" | sed 's/^\(.*\)=\(.*\)$/\2/g')"
if [ "$(echo "$ADDRESS" | tr "./" "\n\n" | wc -l)" != 5 ]
then
echo "Invalid address."
exit 1
Expand Down

0 comments on commit ed22882

Please sign in to comment.