1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-01 01:04:00 +00:00

fix: Fix shellcheck issues in install.sh (#714)

This commit is contained in:
AppleTheGolden 2019-12-20 16:54:40 +01:00 committed by Matan Kushner
parent c58178dece
commit 8084c2e61d

View File

@ -31,7 +31,6 @@ GREEN="$(tput setaf 2 2>/dev/null || echo '')"
YELLOW="$(tput setaf 3 2>/dev/null || echo '')" YELLOW="$(tput setaf 3 2>/dev/null || echo '')"
BLUE="$(tput setaf 4 2>/dev/null || echo '')" BLUE="$(tput setaf 4 2>/dev/null || echo '')"
MAGENTA="$(tput setaf 5 2>/dev/null || echo '')" MAGENTA="$(tput setaf 5 2>/dev/null || echo '')"
CYAN="$(tput setaf 6 2>/dev/null || echo '')"
NO_COLOR="$(tput sgr0 2>/dev/null || echo '')" NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
info() { info() {
@ -89,7 +88,8 @@ fetch() {
# - linux # - linux
# - linux_musl (Alpine) # - linux_musl (Alpine)
detect_platform() { detect_platform() {
local platform="$(uname -s | tr '[:upper:]' '[:lower:]')" local platform
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
# check for MUSL # check for MUSL
if [ "${platform}" = "linux" ]; then if [ "${platform}" = "linux" ]; then
@ -118,7 +118,8 @@ detect_platform() {
# - x86_64 # - x86_64
# - i386 # - i386
detect_arch() { detect_arch() {
local arch="$(uname -m | tr '[:upper:]' '[:lower:]')" local arch
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
# `uname -m` in some cases mis-reports 32-bit OS as 64-bit, so double check # `uname -m` in some cases mis-reports 32-bit OS as 64-bit, so double check
if [ "${arch}" = "x64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then if [ "${arch}" = "x64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
@ -132,7 +133,7 @@ confirm() {
if [ -z "${FORCE-}" ]; then if [ -z "${FORCE-}" ]; then
printf "${MAGENTA}?${NO_COLOR} $@ ${BOLD}[y/N]${NO_COLOR} " printf "${MAGENTA}?${NO_COLOR} $@ ${BOLD}[y/N]${NO_COLOR} "
set +e set +e
read yn < /dev/tty read -r yn < /dev/tty
rc=$? rc=$?
set -e set -e
if [ $rc -ne 0 ]; then if [ $rc -ne 0 ]; then
@ -150,7 +151,8 @@ check_bin_dir() {
local bin_dir="$1" local bin_dir="$1"
# https://stackoverflow.com/a/11655875 # https://stackoverflow.com/a/11655875
local good=$( IFS=: local good
good=$( IFS=:
for path in $PATH; do for path in $PATH; do
if [ "${path}" = "${bin_dir}" ]; then if [ "${path}" = "${bin_dir}" ]; then
echo 1 echo 1
@ -217,7 +219,7 @@ info "${BOLD}Platform${NO_COLOR}: ${GREEN}${PLATFORM}${NO_COLOR}"
info "${BOLD}Arch${NO_COLOR}: ${GREEN}${ARCH}${NO_COLOR}" info "${BOLD}Arch${NO_COLOR}: ${GREEN}${ARCH}${NO_COLOR}"
# non-empty VERBOSE enables verbose untarring # non-empty VERBOSE enables verbose untarring
if [ ! -z "${VERBOSE-}" ]; then if [ -n "${VERBOSE-}" ]; then
VERBOSE=v VERBOSE=v
info "${BOLD}Verbose${NO_COLOR}: yes" info "${BOLD}Verbose${NO_COLOR}: yes"
else else