Update scripts to pass shellcheck lint

main
Buddy Sandidge 4 years ago
parent 6012a4bcde
commit 4325f2ae6a

@ -19,7 +19,7 @@ if [[ $OSTYPE =~ linux ]]; then
elif [[ $OSTYPE =~ darwin ]]; then elif [[ $OSTYPE =~ darwin ]]; then
OS=darwin OS=darwin
else else
echo unknown os: $OSTYPE echo unknown os: "$OSTYPE"
exit 1 exit 1
fi fi
@ -27,37 +27,38 @@ ARCH=
if [[ $(uname -m) == x86_64 ]]; then if [[ $(uname -m) == x86_64 ]]; then
ARCH=amd64 ARCH=amd64
else else
echo arch not yet supported: $(uname -m) echo arch not yet supported: "$(uname -m)"
exit 1 exit 1
fi fi
URL=https://github.com/etcd-io/etcd/releases/download/${VERSION}/etcd-${VERSION}-${OS}-${ARCH}.tar.gz URL=https://github.com/etcd-io/etcd/releases/download/${VERSION}/etcd-${VERSION}-${OS}-${ARCH}.tar.gz
[[ -d ${APP_DEST_DIR} ]] || sudo mkdir -p ${APP_DEST_DIR} [[ -d ${APP_DEST_DIR} ]] || sudo mkdir -p "${APP_DEST_DIR}"
TMP_DIR= TMP_DIR=
if [[ ! -d ${APP_DEST_DIR}/bin ]]; then if [[ ! -d ${APP_DEST_DIR}/bin ]]; then
TMP_DIR=$(mktemp --directory) TMP_DIR=$(mktemp --directory)
DEST_FILE=$TMP_DIR/${APP}.tar.gz DEST_FILE=$TMP_DIR/${APP}.tar.gz
echo downloading ${APP} ${VERSION} to temp directory ${TMP_DIR} echo downloading "${APP}" "${VERSION}" to temp directory "${TMP_DIR}"
curl --silent --location --output ${DEST_FILE} ${URL} curl --silent --location --output "${DEST_FILE}" "${URL}"
sudo tar xf ${DEST_FILE} --directory ${APP_DEST_DIR} --strip-components 1 sudo tar xf "${DEST_FILE}" --directory "${APP_DEST_DIR}" --strip-components 1
sudo chown --recursive root:root ${APP_DEST_DIR} sudo chown --recursive root:root "${APP_DEST_DIR}"
else else
echo ${APP} ${VERSION} already installed echo "${APP}" "${VERSION}" already installed
fi fi
cd ${APP_PREFIX_DIR} cd ${APP_PREFIX_DIR}
[[ -s current ]] && sudo unlink current [[ -s current ]] && sudo unlink current
sudo ln --symbolic ${APP_DEST_DIR} current sudo ln --symbolic "${APP_DEST_DIR}" current
echo current version set to ${VERSION} echo current version set to "${VERSION}"
cd ${BIN_DIR} cd ${BIN_DIR}
# shellcheck disable=SC2044
for bin in $(find ${APP_CURRENT}/ -maxdepth 1 -executable -type f -exec basename {} \;); do for bin in $(find ${APP_CURRENT}/ -maxdepth 1 -executable -type f -exec basename {} \;); do
[[ -s $bin ]] || sudo ln --symbolic ${APP_CURRENT}/$bin [[ -s $bin ]] || sudo ln --symbolic "${APP_CURRENT}/$bin"
done done
if [[ $TMP_DIR != "" ]]; then if [[ $TMP_DIR != "" ]]; then
rm -rf ${TMP_DIR} rm -rf "${TMP_DIR}"
echo removed up temp directory ${TMP_DIR} echo removed up temp directory "${TMP_DIR}"
fi fi

@ -9,7 +9,6 @@ PREFIX_DIR=/usr/local
GO_PREFIX_DIR=${PREFIX_DIR}/golang GO_PREFIX_DIR=${PREFIX_DIR}/golang
GO_DEST_DIR=${GO_PREFIX_DIR}/${GO_VERSION} GO_DEST_DIR=${GO_PREFIX_DIR}/${GO_VERSION}
GO_CURRENT=${PREFIX_DIR}/go
OS= OS=
if [[ $OSTYPE =~ linux ]]; then if [[ $OSTYPE =~ linux ]]; then
@ -17,7 +16,7 @@ if [[ $OSTYPE =~ linux ]]; then
elif [[ $OSTYPE =~ darwin ]]; then elif [[ $OSTYPE =~ darwin ]]; then
OS=darwin OS=darwin
else else
echo unknown os: $OSTYPE echo unknown os: "$OSTYPE"
exit 1 exit 1
fi fi
@ -25,36 +24,36 @@ ARCH=
if [[ $(uname -m) == x86_64 ]]; then if [[ $(uname -m) == x86_64 ]]; then
ARCH=amd64 ARCH=amd64
else else
echo arch not yet supported: $(uname -m) echo arch not yet supported: "$(uname -m)"
exit 1 exit 1
fi fi
[[ -d ${GO_DEST_DIR} ]] || sudo mkdir -p ${GO_DEST_DIR} [[ -d ${GO_DEST_DIR} ]] || sudo mkdir -p "${GO_DEST_DIR}"
TMP_DIR= TMP_DIR=
if [[ ! -d ${GO_DEST_DIR}/bin ]]; then if [[ ! -d ${GO_DEST_DIR}/bin ]]; then
TMP_DIR=$(mktemp --directory) TMP_DIR=$(mktemp --directory)
DEST_FILE=$TMP_DIR/go.tar.gz DEST_FILE=$TMP_DIR/go.tar.gz
URL=https://dl.google.com/go/go${GO_VERSION}.${OS}-${ARCH}.tar.gz URL=https://dl.google.com/go/go${GO_VERSION}.${OS}-${ARCH}.tar.gz
echo downloading go $GO_VERSION to temp directory ${TMP_DIR} echo downloading go "$GO_VERSION" to temp directory "${TMP_DIR}"
curl --silent --output ${DEST_FILE} ${URL} curl --silent --output "${DEST_FILE}" "${URL}"
sudo tar xf ${DEST_FILE} --directory ${GO_DEST_DIR} --strip-components 1 sudo tar xf "${DEST_FILE}" --directory "${GO_DEST_DIR}" --strip-components 1
sudo chown --recursive root:root ${GO_DEST_DIR} sudo chown --recursive root:root "${GO_DEST_DIR}"
else else
echo go $GO_VERSION already installed echo go "$GO_VERSION" already installed
fi fi
cd ${PREFIX_DIR} cd ${PREFIX_DIR}
[[ -s go ]] && sudo unlink go [[ -s go ]] && sudo unlink go
sudo ln --symbolic ${GO_DEST_DIR} go sudo ln --symbolic "${GO_DEST_DIR}" go
echo current version set to ${GO_VERSION} echo current version set to "${GO_VERSION}"
[[ -f /etc/profile.d/go-path.sh ]] \ [[ -f /etc/profile.d/go-path.sh ]] \
|| echo 'export PATH=$PATH:/usr/local/go/bin' \ || echo "export PATH=\$PATH:/usr/local/go/bin" \
| sudo tee /etc/profile.d/go-path.sh | sudo tee /etc/profile.d/go-path.sh
if [[ $TMP_DIR != "" ]]; then if [[ $TMP_DIR != "" ]]; then
rm -rf ${TMP_DIR} rm -rf "${TMP_DIR}"
echo removed up temp directory ${TMP_DIR} echo removed up temp directory "${TMP_DIR}"
fi fi

@ -16,7 +16,7 @@ if [[ $(uname) =~ Linux ]]; then
elif [[ $(uname) =~ Darwin ]]; then elif [[ $(uname) =~ Darwin ]]; then
OS=darwin OS=darwin
else else
echo unsupported os: $(uname) echo "unsupported os: $(uname)"
exit 1 exit 1
fi fi
@ -24,34 +24,34 @@ ARCH=
if [[ $(uname -m) == x86_64 ]]; then if [[ $(uname -m) == x86_64 ]]; then
ARCH=amd64 ARCH=amd64
else else
echo arch not yet supported: $(uname -m) echo arch not yet supported: "$(uname -m)"
exit 1 exit 1
fi fi
TMP_DIR= TMP_DIR=
if [[ ! -d ${MINIKUBE_DEST_DIR} ]]; then if [[ ! -d ${MINIKUBE_DEST_DIR} ]]; then
sudo mkdir -p ${MINIKUBE_DEST_DIR} sudo mkdir -p "${MINIKUBE_DEST_DIR}"
TMP_DIR=$(mktemp --directory) TMP_DIR=$(mktemp --directory)
DEST_FILE=${TMP_DIR}/minikube DEST_FILE="${TMP_DIR}"/minikube
URL=https://github.com/kubernetes/minikube/releases/download/${MINIKUBE_VERSION}/minikube-${OS}-${ARCH} URL="https://github.com/kubernetes/minikube/releases/download/${MINIKUBE_VERSION}/minikube-${OS}-${ARCH}"
echo downloading minikube ${MINIKUBE_VERSION} to temp directory ${TMP_DIR} echo downloading minikube "${MINIKUBE_VERSION}" to temp directory "${TMP_DIR}"
curl --silent --location --output ${DEST_FILE} ${URL} curl --silent --location --output "${DEST_FILE}" "${URL}"
sudo chmod 755 ${DEST_FILE} sudo chmod 755 "${DEST_FILE}"
sudo mv ${DEST_FILE} ${MINIKUBE_DEST_DIR} sudo mv "${DEST_FILE}" "${MINIKUBE_DEST_DIR}"
sudo chown --recursive root:root ${MINIKUBE_DEST_DIR} sudo chown --recursive root:root "${MINIKUBE_DEST_DIR}"
else else
echo minikube ${MINIKUBE_VERSION} already installed echo minikube "${MINIKUBE_VERSION}" already installed
fi fi
cd ${MINIKUBE_PREFIX_DIR} cd "${MINIKUBE_PREFIX_DIR}"
[[ -s current ]] && sudo unlink current [[ -s current ]] && sudo unlink current
sudo ln --symbolic ${MINIKUBE_VERSION}/ current sudo ln --symbolic "${MINIKUBE_VERSION}"/ current
echo current version set to ${MINIKUBE_VERSION} echo current version set to "${MINIKUBE_VERSION}"
cd ${BIN_DIR} cd ${BIN_DIR}
[[ -L ${BIN_DIR}/minikube ]] || sudo ln --symbolic ${MINIKUBE_CURRENT}/minikube [[ -L ${BIN_DIR}/minikube ]] || sudo ln --symbolic ${MINIKUBE_CURRENT}/minikube
if [[ $TMP_DIR != "" ]]; then if [[ $TMP_DIR != "" ]]; then
rm -rf ${TMP_DIR} rm -rf "${TMP_DIR}"
echo removed up temp directory ${TMP_DIR} echo removed up temp directory "${TMP_DIR}"
fi fi

@ -18,7 +18,7 @@ if [[ $OSTYPE =~ linux ]]; then
elif [[ $OSTYPE =~ darwin ]]; then elif [[ $OSTYPE =~ darwin ]]; then
OS=darwin OS=darwin
else else
echo unknown os: $OSTYPE echo unknown os: "$OSTYPE"
exit 1 exit 1
fi fi
@ -26,36 +26,36 @@ ARCH=
if [[ $(uname -m) == x86_64 ]]; then if [[ $(uname -m) == x86_64 ]]; then
ARCH=x64 ARCH=x64
else else
echo arch not yet supported: $(uname -m) echo arch not yet supported: "$(uname -m)"
exit 1 exit 1
fi fi
[[ -d ${NODE_DEST_DIR} ]] || sudo mkdir -p ${NODE_DEST_DIR} [[ -d "${NODE_DEST_DIR}" ]] || sudo mkdir -p "${NODE_DEST_DIR}"
TMP_DIR= TMP_DIR=
if [[ ! -d ${NODE_DEST_BIN_DIR} ]]; then if [[ ! -d ${NODE_DEST_BIN_DIR} ]]; then
TMP_DIR=$(mktemp --directory) TMP_DIR=$(mktemp --directory)
DEST_FILE=$TMP_DIR/node.tar.xz DEST_FILE=$TMP_DIR/node.tar.xz
URL=https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${OS}-${ARCH}.tar.xz URL=https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${OS}-${ARCH}.tar.xz
echo downloading node $NODE_VERSION to temp directory ${TMP_DIR} echo downloading node "$NODE_VERSION" to temp directory "${TMP_DIR}"
curl --silent --output ${DEST_FILE} ${URL} curl --silent --output "${DEST_FILE}" "${URL}"
sudo tar xf ${DEST_FILE} --directory ${NODE_DEST_DIR} --strip-components 1 sudo tar xf "${DEST_FILE}" --directory "${NODE_DEST_DIR}" --strip-components 1
sudo chown --recursive root:root ${NODE_DEST_DIR} sudo chown --recursive root:root "${NODE_DEST_DIR}"
else else
echo node $NODE_VERSION already installed echo node "$NODE_VERSION" already installed
fi fi
cd ${NODE_PREFIX_DIR} cd ${NODE_PREFIX_DIR}
[[ -s current ]] && sudo unlink current [[ -s current ]] && sudo unlink current
sudo ln --symbolic ${NODE_VERSION} current sudo ln --symbolic "${NODE_VERSION}" current
echo current version set to ${NODE_VERSION} echo current version set to "${NODE_VERSION}"
cd ${BIN_DIR} cd ${BIN_DIR}
for bin in $(ls ${NODE_CURRENT}/bin); do for bin in "${NODE_CURRENT}/bin/"*; do
[[ -s $bin ]] || sudo ln --symbolic ${NODE_CURRENT}/bin/$bin [[ -s $bin ]] || sudo ln --symbolic "${NODE_CURRENT}/bin/$bin"
done done
if [[ $TMP_DIR != "" ]]; then if [[ $TMP_DIR != "" ]]; then
rm -rf ${TMP_DIR} rm -rf "${TMP_DIR}"
echo removed up temp directory ${TMP_DIR} echo removed up temp directory "${TMP_DIR}"
fi fi

@ -8,7 +8,7 @@ PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
TMP_DIR=$(mktemp --directory) TMP_DIR=$(mktemp --directory)
DEST_FILE=$TMP_DIR/$PROTOC_ZIP DEST_FILE=$TMP_DIR/$PROTOC_ZIP
URL=https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP URL=https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
curl --output "$DEST_FILE" --location $URL curl --output "$DEST_FILE" --location "$URL"
sudo unzip -o "$DEST_FILE" -d /usr/local bin/protoc sudo unzip -o "$DEST_FILE" -d /usr/local bin/protoc
sudo unzip -o "$DEST_FILE" -d /usr/local 'include/*' sudo unzip -o "$DEST_FILE" -d /usr/local 'include/*'
rm -rfv "$TMP_DIR" rm -rfv "$TMP_DIR"

@ -15,11 +15,11 @@ function move_flake() {
snowflakes[$i]=0 snowflakes[$i]=0
else else
if [ "${lastflakes[$i]}" != "" ]; then if [ "${lastflakes[$i]}" != "" ]; then
printf "\033[%s;%sH \033[0;0H " ${lastflakes[$i]} $i printf "\033[%s;%sH \033[0;0H " "${lastflakes[$i]}" "$i"
fi fi
fi fi
printf "\033[%s;%sH❄\033[0;0H" ${snowflakes[$i]} $i printf "\033[%s;%sH❄\033[0;0H" "${snowflakes[$i]}" "$i"
lastflakes[$i]=${snowflakes[$i]} lastflakes[$i]=${snowflakes[$i]}
snowflakes[$i]=$((${snowflakes[$i]}+1)) snowflakes[$i]=$((${snowflakes[$i]}+1))
@ -27,7 +27,7 @@ function move_flake() {
while : while :
do do
i=$(($RANDOM % $COLUMNS)) i=$((RANDOM % COLUMNS))
move_flake $i move_flake $i

Loading…
Cancel
Save