diff --git a/README.md b/README.md index f4ff9ef..609c3df 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ jobs: ```bash -# run the install-shellcheck.sh in your github/gitlab workflow +# run the install-shellspec in your github/gitlab workflow # for instance, assuming you fetched this file via gt and remote name is tegonal-scripts # then in a github workflow you would have diff --git a/src/ci/install-shellcheck.sh b/src/ci/install-shellcheck.sh index 4132dcd..d62fb02 100755 --- a/src/ci/install-shellcheck.sh +++ b/src/ci/install-shellcheck.sh @@ -9,8 +9,7 @@ # Version: v4.3.0-SNAPSHOT ####### Description ############# # -# function which searches for *.sh files within defined paths (directories or a single *.sh) and -# runs shellcheck on each file with predefined settings i.a. sets `-s bash` +# installs shellcheck v0.10.0 into $HOME/.local/lib # ####### Usage ################### # @@ -35,12 +34,27 @@ declare currentDir currentDir=$(pwd) tmpDir=$(mktemp -d -t download-shellcheck-XXXXXXXXXX) cd "$tmpDir" -echo "6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87 ./shellcheck-v0.10.0.linux.x86_64.tar.xz" >shellcheck-v0.10.0.linux.x86_64.tar.xz.sha256 -wget --no-verbose https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz -sha256sum -c shellcheck-v0.10.0.linux.x86_64.tar.xz.sha256 -tar -xf ./shellcheck-v0.10.0.linux.x86_64.tar.xz -chmod +x ./shellcheck-v0.10.0/shellcheck +shellcheckVersion="v0.10.0" +echo "6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87 ./shellcheck-$shellcheckVersion.linux.x86_64.tar.xz" >"shellcheck-$shellcheckVersion.linux.x86_64.tar.xz.sha256" +wget --no-verbose "https://github.com/koalaman/shellcheck/releases/download/$shellcheckVersion/shellcheck-$shellcheckVersion.linux.x86_64.tar.xz" +sha256sum -c "shellcheck-$shellcheckVersion.linux.x86_64.tar.xz.sha256" +tar -xf "./shellcheck-$shellcheckVersion.linux.x86_64.tar.xz" +chmod +x "./shellcheck-$shellcheckVersion/shellcheck" mkdir -p "$HOME/.local/bin" -ln -s "$tmpDir/shellcheck-v0.10.0/shellcheck" "$HOME/.local/bin/shellcheck" +shellcheckInTmp="$tmpDir/shellcheck-$shellcheckVersion" +shellcheckInHomeLocalLib="$HOME/.local/lib/shellcheck-$shellcheckVersion" +shellcheckBin="$HOME/.local/bin/shellcheck" +if [[ -d "$shellcheckInHomeLocalLib" ]]; then + echo "going to remove the existing installation in $shellcheckInHomeLocalLib" + rm -r "$shellcheckInHomeLocalLib" +else + mkdir -p "$HOME/.local/lib" +fi +mv "$shellcheckInTmp" "$shellcheckInHomeLocalLib" +if [[ -f "$shellcheckBin" ]]; then + rm "$shellcheckBin" +fi +ln -s "$shellcheckInHomeLocalLib/shellcheck" "$shellcheckBin" + cd "$currentDir" shellcheck --version diff --git a/src/ci/install-shellspec.doc.sh b/src/ci/install-shellspec.doc.sh index 3929f1e..1a91901 100644 --- a/src/ci/install-shellspec.doc.sh +++ b/src/ci/install-shellspec.doc.sh @@ -1,4 +1,4 @@ -# run the install-shellcheck.sh in your github/gitlab workflow +# run the install-shellspec in your github/gitlab workflow # for instance, assuming you fetched this file via gt and remote name is tegonal-scripts # then in a github workflow you would have diff --git a/src/ci/install-shellspec.sh b/src/ci/install-shellspec.sh index bba07e4..1d0162a 100755 --- a/src/ci/install-shellspec.sh +++ b/src/ci/install-shellspec.sh @@ -9,12 +9,11 @@ # Version: v4.3.0-SNAPSHOT ####### Description ############# # -# function which searches for *.sh files within defined paths (directories or a single *.sh) and -# runs shellcheck on each file with predefined settings i.a. sets `-s bash` +# installs shellspec 0.28.1 into $HOME/.local/lib # ####### Usage ################### # -# # run the install-shellcheck.sh in your github/gitlab workflow +# # run the install-shellspec in your github/gitlab workflow # # for instance, assuming you fetched this file via gt and remote name is tegonal-scripts # # then in a github workflow you would have #