fix shellcheck issues, format bash scripts with shfmt

This commit is contained in:
Mitsuo Heijo
2020-01-31 00:06:49 +09:00
parent 4da303693f
commit a529f0d6ae
34 changed files with 107 additions and 104 deletions

View File

@@ -7,6 +7,8 @@ charset = utf-8
# Extension
[*.sh]
end_of_line = lf
indent_style = space
indent_size = 2
[*.cmd]
end_of_line = crlf

1
.shellcheckrc Normal file
View File

@@ -0,0 +1 @@
disable=SC2002

View File

@@ -6,7 +6,7 @@ curl -o "dartsdk-linux-x64-release.zip" "https://storage.googleapis.com/dart-arc
unzip "dartsdk-linux-x64-release.zip"
rm "dartsdk-linux-x64-release.zip"
cat <<EOF > analysis-server-dart-snapshot
cat <<EOF >analysis-server-dart-snapshot
#!/usr/bin/env bash
DIR=\$(cd \$(dirname \$0); pwd)

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" bash-language-server bash-language-server
"$(dirname "$0")/npm_install.sh" bash-language-server bash-language-server

View File

@@ -5,68 +5,66 @@ set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux)
platform="pc-linux-gnu"
;;
darwin)
platform="darwin-apple"
;;
linux)
platform="pc-linux-gnu"
;;
darwin)
platform="darwin-apple"
;;
esac
if which lsb_release 2> /dev/null; then
distributor_id=$(lsb_release -a 2>&1 | grep 'Distributor ID' | awk '{print $3}')
if command -v lsb_release 2>/dev/null; then
distributor_id=$(lsb_release -a 2>&1 | grep 'Distributor ID' | awk '{print $3}')
elif [ -e /etc/fedora-release ]; then
distributor_id="Fedora"
distributor_id="Fedora"
elif [ -e /etc/redhat-release ]; then
distributor_id=$(cat /etc/redhat-release | cut -d ' ' -f 1)
distributor_id=$(cat /etc/redhat-release | cut -d ' ' -f 1)
elif [ -e /etc/arch-release ]; then
distributor_id="Arch"
distributor_id="Arch"
elif [ -e /etc/SuSE-release ]; then
distributor_id="SUSE"
distributor_id="SUSE"
elif [ -e /etc/mandriva-release ]; then
distributor_id="Mandriva"
distributor_id="Mandriva"
elif [ -e /etc/vine-release ]; then
distributor_id="Vine"
distributor_id="Vine"
elif [ -e /etc/gentoo-release ]; then
distributor_id="Gentoo"
distributor_id="Gentoo"
else
distributor_id="Unkown"
distributor_id="Unkown"
fi
case $distributor_id in
# Check Ubuntu version
Ubuntu)
ubuntu_version=$(lsb_release -a 2>&1 | grep 'Release' | awk '{print $2}')
case $ubuntu_version in
14.04|16.04|18.04)
platform="linux-gnu-ubuntu-$ubuntu_version"
;;
esac
;;
# Check LinuxMint version
LinuxMint)
linuxmint_version=$(lsb_release -a 2>&1 | grep 'Release' | awk '{print $2}')
case $linuxmint_version in
19|19.1|19.2|19.3)
platform="linux-gnu-ubuntu-18.04"
;;
18|18.1|18.2|18.3)
platform="linux-gnu-ubuntu-16.04"
;;
esac
;;
# Check RedHat OS version
Fedora|Oracle|CentOS)
platform="linux-sles11.3"
;;
# Check Ubuntu version
Ubuntu)
ubuntu_version=$(lsb_release -a 2>&1 | grep 'Release' | awk '{print $2}')
case $ubuntu_version in
14.04 | 16.04 | 18.04)
platform="linux-gnu-ubuntu-$ubuntu_version"
;;
esac
;;
# Check LinuxMint version
LinuxMint)
linuxmint_version=$(lsb_release -a 2>&1 | grep 'Release' | awk '{print $2}')
case $linuxmint_version in
19 | 19.1 | 19.2 | 19.3)
platform="linux-gnu-ubuntu-18.04"
;;
18 | 18.1 | 18.2 | 18.3)
platform="linux-gnu-ubuntu-16.04"
;;
esac
;;
# Check RedHat OS version
Fedora | Oracle | CentOS)
platform="linux-sles11.3"
;;
esac
filename="clang+llvm-9.0.0-x86_64-$platform"
url="http://releases.llvm.org/9.0.0/$filename.tar.xz"
echo "Downloading clangd and LLVM..."
curl -LO "$url"
echo "Extracting archive..."
xzcat $filename.tar.xz | tar x --strip-components=1 $filename/
rm $filename.tar.xz
ln -sf bin/clangd
echo hello
curl -L "$url" | unxz | tar x --strip-components=1 $filename/
ln -sf bin/clangd .
./clangd --version

View File

@@ -4,8 +4,10 @@ set -e
version="0.9.1"
url="https://github.com/eclipse/che-che4z-lsp-for-cobol/releases/download/$version/cobol-language-support-$version.vsix"
curl -LO "$url"
unzip "cobol-language-support-$version.vsix"
filename="cobol-language-support-$version.vsix"
curl -L "$url" -o "$filename"
unzip "$filename"
rm "$filename"
cat <<EOF >./cobol-language-support
#!/usr/bin/env bash

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" css-languageserver vscode-css-languageserver-bin
"$(dirname "$0")/npm_install.sh" css-languageserver vscode-css-languageserver-bin

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" docker-langserver dockerfile-language-server-nodejs
"$(dirname "$0")/npm_install.sh" docker-langserver dockerfile-language-server-nodejs

View File

@@ -2,19 +2,17 @@
set -e
curl -o jdt-language-server-latest.tar.gz 'http://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz'
curl -L "http://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz" | tar zx
curl -o lombok.jar 'https://projectlombok.org/downloads/lombok.jar'
tar xvf jdt-language-server-latest.tar.gz
rm jdt-language-server-latest.tar.gz
osType="\$(uname -s)"
case "\${osType}" in
Darwin*) configDir=config_mac;;
Linux*) configDir=config_linux;;
*) configDir=config_linux
osType="$(uname -s)"
case "${osType}" in
Darwin*) configDir=config_mac ;;
Linux*) configDir=config_linux ;;
*) configDir=config_linux ;;
esac
cat <<EOF > eclipse-jdt-ls
cat <<EOF >eclipse-jdt-ls
#!/usr/bin/env bash
DIR=\$(cd \$(dirname \$0); pwd)

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/go_install.sh" github.com/mattn/efm-langserver
"$(dirname "$0")/go_install.sh" github.com/mattn/efm-langserver

View File

@@ -8,7 +8,7 @@ curl -LO "$url"
unzip elixir-ls.zip
rm elixir-ls.zip
cat <<EOF > elixir-ls
cat <<EOF >elixir-ls
#!/usr/bin/env bash
DIR=\$(cd \$(dirname \$0); pwd)

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" elm-languageserver "@elm-tooling/elm-language-server"
"$(dirname "$0")/npm_install.sh" elm-languageserver "@elm-tooling/elm-language-server"

View File

@@ -4,7 +4,7 @@ set -e
curl -L -o EmmyLua-LS-all.jar 'https://ci.appveyor.com/api/buildjobs/54yf9rjvj49494pd/artifacts/EmmyLua-LS%2Fbuild%2Flibs%2FEmmyLua-LS-all.jar'
cat <<EOF > emmylua-ls
cat <<EOF >emmylua-ls
#!/usr/bin/env bash
DIR=\$(cd \$(dirname \$0); pwd)

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env bash
"$(dirname $0)/pip_install.sh" fortls fortran-language-server
"$(dirname "$0")/pip_install.sh" fortls fortran-language-server

View File

@@ -3,19 +3,20 @@
set -e
if command -v dotnet >/dev/null 2>&1; then
echo "dotnet installed"
dotnetcmd=dotnet
echo "dotnet installed"
dotnetcmd=dotnet
else
echo "dotnet not found, installing..."
# REF https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/pyls_ms.lua
curl -L https://dot.net/v1/dotnet-install.sh | bash -s -- -i "./.dotnet"
dotnetcmd="\\$DIR/.dotnet/dotnet"
echo "dotnet not found, installing..."
# REF https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/pyls_ms.lua
curl -L https://dot.net/v1/dotnet-install.sh | bash -s -- -i "./.dotnet"
dotnetcmd="\\$DIR/.dotnet/dotnet"
fi
url="https://ci.appveyor.com/api/projects/fsautocomplete/fsautocomplete/artifacts/bin/pkgs/fsautocomplete.netcore.zip?branch=master"
zip=fsautocomplete.zip
curl -L "$url" -o "$zip"
unzip -o -d "fsautocomplete.netcore" "$zip"
unzip -o -d "fsautocomplete.netcore" "$zip"
rm "$zip"
cat <<EOF >fsautocomplete
#!/bin/sh

View File

@@ -6,7 +6,7 @@ git clone https://github.com/fsprojects/fsharp-language-server .
npm install
dotnet build -c Release
cat <<EOF > fsharp-language-server
cat <<EOF >fsharp-language-server
#!/usr/bin/env bash
DIR=\$(cd \$(dirname \$0); pwd)

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/go_install.sh" golang.org/x/tools/gopls@latest
"$(dirname "$0")/go_install.sh" golang.org/x/tools/gopls@latest

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" gql-language-server @playlyfe/gql-language-server
"$(dirname "$0")/npm_install.sh" gql-language-server @playlyfe/gql-language-server

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" html-languageserver vscode-html-languageserver-bin
"$(dirname "$0")/npm_install.sh" html-languageserver vscode-html-languageserver-bin

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" intelephense intelephense
"$(dirname "$0")/npm_install.sh" intelephense intelephense

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" javascript-typescript-stdio javascript-typescript-langserver
"$(dirname "$0")/npm_install.sh" javascript-typescript-stdio javascript-typescript-langserver

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" json-languageserver vscode-json-languageserver-bin
"$(dirname "$0")/npm_install.sh" json-languageserver vscode-json-languageserver-bin

View File

@@ -2,7 +2,8 @@
set -e
curl -L -o server.zip 'https://github.com/fwcd/kotlin-language-server/releases/download/0.5.2/server.zip'
version="0.5.2"
curl -L -o server.zip "https://github.com/fwcd/kotlin-language-server/releases/download/$version/server.zip"
unzip server.zip
rm server.zip

View File

@@ -19,13 +19,11 @@ esac
version="v1.34.9"
url="https://github.com/OmniSharp/omnisharp-roslyn/releases/download/$version/omnisharp-$os$arch.tar.gz"
curl -LO "$url"
tar xzvf omnisharp-$os$arch.tar.gz
rm omnisharp-$os$arch.tar.gz
curl -L "$url" | tar xz
chmod +x run
cat <<EOF > omnisharp-lsp
cat <<EOF >omnisharp-lsp
#!/usr/bin/env bash
DIR=\$(cd \$(dirname \$0); pwd)

View File

@@ -17,7 +17,7 @@ darwin)
*) ;;
esac
version="0.5.10"
version="0.5.30"
url="https://pvsc.azureedge.net/python-language-server-stable/Python-Language-Server-${system}-x64.${version}.nupkg"
nupkg="./pyls.nupkg"

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/pip_install.sh" pyls python-language-server
"$(dirname "$0")/pip_install.sh" pyls python-language-server

View File

@@ -5,14 +5,16 @@ set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
case $os in
linux)
platform="linux"
;;
darwin)
platform="mac"
;;
linux)
platform="linux"
;;
darwin)
platform="mac"
;;
esac
curl -L -o ra_lsp_server-$platform "https://github.com/rust-analyzer/rust-analyzer/releases/download/2020-01-27/ra_lsp_server-$platform"
version="2020-01-29"
curl -L -o ra_lsp_server-$platform "https://github.com/rust-analyzer/rust-analyzer/releases/download/$version/ra_lsp_server-$platform"
mv ra_lsp_server-$platform ra_lsp_server
chmod +x ra_lsp_server

View File

@@ -5,7 +5,7 @@ set -e
git clone "https://github.com/castwide/solargraph" .
bundle install --path vendor/bundle
cat <<EOF > solargraph
cat <<EOF >solargraph
#!/usr/bin/env bash
DIR=\$(cd \$(dirname \$0); pwd)

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" sql-language-server sql-language-server
"$(dirname "$0")/npm_install.sh" sql-language-server sql-language-server

View File

@@ -15,6 +15,6 @@ darwin)
;;
esac
url="https://github.com/latex-lsp/texlab/releases/download/v1.8.0/texlab-x86_64-$os.tar.gz"
curl -LO "$url"
tar xzvf texlab-x86_64-$os.tar.gz
version="v1.8.0"
url="https://github.com/latex-lsp/texlab/releases/download/$version/texlab-x86_64-$os.tar.gz"
curl -L "$url" | tar xzv

View File

@@ -2,5 +2,5 @@
set -e
"$(dirname $0)/npm_install.sh" tsserver typescript
"$(dirname $0)/npm_install.sh" typescript-language-server typescript-language-server
"$(dirname "$0")/npm_install.sh" tsserver typescript
"$(dirname "$0")/npm_install.sh" typescript-language-server typescript-language-server

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" vim-language-server vim-language-server
"$(dirname "$0")/npm_install.sh" vim-language-server vim-language-server

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" vls vue-language-server
"$(dirname "$0")/npm_install.sh" vls vue-language-server

View File

@@ -2,4 +2,4 @@
set -e
"$(dirname $0)/npm_install.sh" yaml-language-server yaml-language-server
"$(dirname "$0")/npm_install.sh" yaml-language-server yaml-language-server