Skip to content

Commit

Permalink
Merge pull request #227 from tegonal/feature/install-shellcheck-in-ho…
Browse files Browse the repository at this point in the history
…me-local-lib

install shellcheck into ~/.local/lib and fix description in sh
  • Loading branch information
robstoll authored Jan 7, 2025
2 parents 15fddfd + d484de1 commit 4622207
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ jobs:
<!-- auto-generated, do not modify here but in src/ci/install-shellspec.sh.doc -->
```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
Expand Down
30 changes: 22 additions & 8 deletions src/ci/install-shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###################
#
Expand All @@ -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
2 changes: 1 addition & 1 deletion src/ci/install-shellspec.doc.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 2 additions & 3 deletions src/ci/install-shellspec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down

0 comments on commit 4622207

Please sign in to comment.