diff --git a/bin/install-etcd-system b/bin/install-etcd-system index a4b8175..a4b78c5 100755 --- a/bin/install-etcd-system +++ b/bin/install-etcd-system @@ -19,7 +19,7 @@ if [[ $OSTYPE =~ linux ]]; then elif [[ $OSTYPE =~ darwin ]]; then OS=darwin else - echo unknown os: $OSTYPE + echo unknown os: "$OSTYPE" exit 1 fi @@ -27,37 +27,38 @@ ARCH= if [[ $(uname -m) == x86_64 ]]; then ARCH=amd64 else - echo arch not yet supported: $(uname -m) + echo arch not yet supported: "$(uname -m)" exit 1 fi 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= if [[ ! -d ${APP_DEST_DIR}/bin ]]; then TMP_DIR=$(mktemp --directory) DEST_FILE=$TMP_DIR/${APP}.tar.gz - echo downloading ${APP} ${VERSION} to temp directory ${TMP_DIR} - curl --silent --location --output ${DEST_FILE} ${URL} + echo downloading "${APP}" "${VERSION}" to temp directory "${TMP_DIR}" + curl --silent --location --output "${DEST_FILE}" "${URL}" - sudo tar xf ${DEST_FILE} --directory ${APP_DEST_DIR} --strip-components 1 - sudo chown --recursive root:root ${APP_DEST_DIR} + sudo tar xf "${DEST_FILE}" --directory "${APP_DEST_DIR}" --strip-components 1 + sudo chown --recursive root:root "${APP_DEST_DIR}" else - echo ${APP} ${VERSION} already installed + echo "${APP}" "${VERSION}" already installed fi cd ${APP_PREFIX_DIR} [[ -s current ]] && sudo unlink current -sudo ln --symbolic ${APP_DEST_DIR} current -echo current version set to ${VERSION} +sudo ln --symbolic "${APP_DEST_DIR}" current +echo current version set to "${VERSION}" cd ${BIN_DIR} +# shellcheck disable=SC2044 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 if [[ $TMP_DIR != "" ]]; then - rm -rf ${TMP_DIR} - echo removed up temp directory ${TMP_DIR} + rm -rf "${TMP_DIR}" + echo removed up temp directory "${TMP_DIR}" fi diff --git a/bin/install-go-system b/bin/install-go-system index 1e1c170..0f49b71 100755 --- a/bin/install-go-system +++ b/bin/install-go-system @@ -9,7 +9,6 @@ PREFIX_DIR=/usr/local GO_PREFIX_DIR=${PREFIX_DIR}/golang GO_DEST_DIR=${GO_PREFIX_DIR}/${GO_VERSION} -GO_CURRENT=${PREFIX_DIR}/go OS= if [[ $OSTYPE =~ linux ]]; then @@ -17,7 +16,7 @@ if [[ $OSTYPE =~ linux ]]; then elif [[ $OSTYPE =~ darwin ]]; then OS=darwin else - echo unknown os: $OSTYPE + echo unknown os: "$OSTYPE" exit 1 fi @@ -25,36 +24,36 @@ ARCH= if [[ $(uname -m) == x86_64 ]]; then ARCH=amd64 else - echo arch not yet supported: $(uname -m) + echo arch not yet supported: "$(uname -m)" exit 1 fi -[[ -d ${GO_DEST_DIR} ]] || sudo mkdir -p ${GO_DEST_DIR} +[[ -d ${GO_DEST_DIR} ]] || sudo mkdir -p "${GO_DEST_DIR}" TMP_DIR= if [[ ! -d ${GO_DEST_DIR}/bin ]]; then TMP_DIR=$(mktemp --directory) DEST_FILE=$TMP_DIR/go.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} - curl --silent --output ${DEST_FILE} ${URL} + echo downloading go "$GO_VERSION" to temp directory "${TMP_DIR}" + curl --silent --output "${DEST_FILE}" "${URL}" - sudo tar xf ${DEST_FILE} --directory ${GO_DEST_DIR} --strip-components 1 - sudo chown --recursive root:root ${GO_DEST_DIR} + sudo tar xf "${DEST_FILE}" --directory "${GO_DEST_DIR}" --strip-components 1 + sudo chown --recursive root:root "${GO_DEST_DIR}" else - echo go $GO_VERSION already installed + echo go "$GO_VERSION" already installed fi cd ${PREFIX_DIR} [[ -s go ]] && sudo unlink go -sudo ln --symbolic ${GO_DEST_DIR} go -echo current version set to ${GO_VERSION} +sudo ln --symbolic "${GO_DEST_DIR}" go +echo current version set to "${GO_VERSION}" [[ -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 if [[ $TMP_DIR != "" ]]; then - rm -rf ${TMP_DIR} - echo removed up temp directory ${TMP_DIR} + rm -rf "${TMP_DIR}" + echo removed up temp directory "${TMP_DIR}" fi diff --git a/bin/install-minikube-system b/bin/install-minikube-system index 9c8e2f2..be12382 100755 --- a/bin/install-minikube-system +++ b/bin/install-minikube-system @@ -16,7 +16,7 @@ if [[ $(uname) =~ Linux ]]; then elif [[ $(uname) =~ Darwin ]]; then OS=darwin else - echo unsupported os: $(uname) + echo "unsupported os: $(uname)" exit 1 fi @@ -24,34 +24,34 @@ ARCH= if [[ $(uname -m) == x86_64 ]]; then ARCH=amd64 else - echo arch not yet supported: $(uname -m) + echo arch not yet supported: "$(uname -m)" exit 1 fi TMP_DIR= if [[ ! -d ${MINIKUBE_DEST_DIR} ]]; then - sudo mkdir -p ${MINIKUBE_DEST_DIR} + sudo mkdir -p "${MINIKUBE_DEST_DIR}" TMP_DIR=$(mktemp --directory) - DEST_FILE=${TMP_DIR}/minikube - URL=https://github.com/kubernetes/minikube/releases/download/${MINIKUBE_VERSION}/minikube-${OS}-${ARCH} - echo downloading minikube ${MINIKUBE_VERSION} to temp directory ${TMP_DIR} - curl --silent --location --output ${DEST_FILE} ${URL} - - sudo chmod 755 ${DEST_FILE} - sudo mv ${DEST_FILE} ${MINIKUBE_DEST_DIR} - sudo chown --recursive root:root ${MINIKUBE_DEST_DIR} + DEST_FILE="${TMP_DIR}"/minikube + URL="https://github.com/kubernetes/minikube/releases/download/${MINIKUBE_VERSION}/minikube-${OS}-${ARCH}" + echo downloading minikube "${MINIKUBE_VERSION}" to temp directory "${TMP_DIR}" + curl --silent --location --output "${DEST_FILE}" "${URL}" + + sudo chmod 755 "${DEST_FILE}" + sudo mv "${DEST_FILE}" "${MINIKUBE_DEST_DIR}" + sudo chown --recursive root:root "${MINIKUBE_DEST_DIR}" else - echo minikube ${MINIKUBE_VERSION} already installed + echo minikube "${MINIKUBE_VERSION}" already installed fi -cd ${MINIKUBE_PREFIX_DIR} +cd "${MINIKUBE_PREFIX_DIR}" [[ -s current ]] && sudo unlink current -sudo ln --symbolic ${MINIKUBE_VERSION}/ current -echo current version set to ${MINIKUBE_VERSION} +sudo ln --symbolic "${MINIKUBE_VERSION}"/ current +echo current version set to "${MINIKUBE_VERSION}" cd ${BIN_DIR} [[ -L ${BIN_DIR}/minikube ]] || sudo ln --symbolic ${MINIKUBE_CURRENT}/minikube if [[ $TMP_DIR != "" ]]; then - rm -rf ${TMP_DIR} - echo removed up temp directory ${TMP_DIR} + rm -rf "${TMP_DIR}" + echo removed up temp directory "${TMP_DIR}" fi diff --git a/bin/install-node-system b/bin/install-node-system index f36f284..b3310af 100755 --- a/bin/install-node-system +++ b/bin/install-node-system @@ -18,7 +18,7 @@ if [[ $OSTYPE =~ linux ]]; then elif [[ $OSTYPE =~ darwin ]]; then OS=darwin else - echo unknown os: $OSTYPE + echo unknown os: "$OSTYPE" exit 1 fi @@ -26,36 +26,36 @@ ARCH= if [[ $(uname -m) == x86_64 ]]; then ARCH=x64 else - echo arch not yet supported: $(uname -m) + echo arch not yet supported: "$(uname -m)" exit 1 fi -[[ -d ${NODE_DEST_DIR} ]] || sudo mkdir -p ${NODE_DEST_DIR} +[[ -d "${NODE_DEST_DIR}" ]] || sudo mkdir -p "${NODE_DEST_DIR}" TMP_DIR= if [[ ! -d ${NODE_DEST_BIN_DIR} ]]; then TMP_DIR=$(mktemp --directory) DEST_FILE=$TMP_DIR/node.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} - curl --silent --output ${DEST_FILE} ${URL} + echo downloading node "$NODE_VERSION" to temp directory "${TMP_DIR}" + curl --silent --output "${DEST_FILE}" "${URL}" - sudo tar xf ${DEST_FILE} --directory ${NODE_DEST_DIR} --strip-components 1 - sudo chown --recursive root:root ${NODE_DEST_DIR} + sudo tar xf "${DEST_FILE}" --directory "${NODE_DEST_DIR}" --strip-components 1 + sudo chown --recursive root:root "${NODE_DEST_DIR}" else - echo node $NODE_VERSION already installed + echo node "$NODE_VERSION" already installed fi cd ${NODE_PREFIX_DIR} [[ -s current ]] && sudo unlink current -sudo ln --symbolic ${NODE_VERSION} current -echo current version set to ${NODE_VERSION} +sudo ln --symbolic "${NODE_VERSION}" current +echo current version set to "${NODE_VERSION}" cd ${BIN_DIR} -for bin in $(ls ${NODE_CURRENT}/bin); do - [[ -s $bin ]] || sudo ln --symbolic ${NODE_CURRENT}/bin/$bin +for bin in "${NODE_CURRENT}/bin/"*; do + [[ -s $bin ]] || sudo ln --symbolic "${NODE_CURRENT}/bin/$bin" done if [[ $TMP_DIR != "" ]]; then - rm -rf ${TMP_DIR} - echo removed up temp directory ${TMP_DIR} + rm -rf "${TMP_DIR}" + echo removed up temp directory "${TMP_DIR}" fi diff --git a/bin/install-protoc b/bin/install-protoc index 4ea4b23..eebfd02 100755 --- a/bin/install-protoc +++ b/bin/install-protoc @@ -8,7 +8,7 @@ PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip TMP_DIR=$(mktemp --directory) DEST_FILE=$TMP_DIR/$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 'include/*' rm -rfv "$TMP_DIR" diff --git a/bin/snow b/bin/snow index 1f2d676..2e06fcb 100755 --- a/bin/snow +++ b/bin/snow @@ -15,11 +15,11 @@ function move_flake() { snowflakes[$i]=0 else 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 - printf "\033[%s;%sH❄\033[0;0H" ${snowflakes[$i]} $i + printf "\033[%s;%sH❄\033[0;0H" "${snowflakes[$i]}" "$i" lastflakes[$i]=${snowflakes[$i]} snowflakes[$i]=$((${snowflakes[$i]}+1)) @@ -27,7 +27,7 @@ function move_flake() { while : do - i=$(($RANDOM % $COLUMNS)) + i=$((RANDOM % COLUMNS)) move_flake $i