Skip to content

Commit fe2b715

Browse files
committed
install shellcheck into ~/.local/lib and fix description in sh
also fix description in install-shellspec.sh
1 parent 15fddfd commit fe2b715

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ jobs:
175175
176176
<!-- auto-generated, do not modify here but in src/ci/install-shellspec.sh.doc -->
177177
```bash
178-
# run the install-shellcheck.sh in your github/gitlab workflow
178+
# run the install-shellspec in your github/gitlab workflow
179179
# for instance, assuming you fetched this file via gt and remote name is tegonal-scripts
180180
# then in a github workflow you would have
181181

src/ci/install-shellcheck.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
# Version: v4.3.0-SNAPSHOT
1010
####### Description #############
1111
#
12-
# function which searches for *.sh files within defined paths (directories or a single *.sh) and
13-
# runs shellcheck on each file with predefined settings i.a. sets `-s bash`
12+
# installs shellcheck v0.10.0 into $HOME/.local/lib
1413
#
1514
####### Usage ###################
1615
#
@@ -35,12 +34,25 @@ declare currentDir
3534
currentDir=$(pwd)
3635
tmpDir=$(mktemp -d -t download-shellcheck-XXXXXXXXXX)
3736
cd "$tmpDir"
38-
echo "6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87 ./shellcheck-v0.10.0.linux.x86_64.tar.xz" >shellcheck-v0.10.0.linux.x86_64.tar.xz.sha256
39-
wget --no-verbose https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz
40-
sha256sum -c shellcheck-v0.10.0.linux.x86_64.tar.xz.sha256
41-
tar -xf ./shellcheck-v0.10.0.linux.x86_64.tar.xz
42-
chmod +x ./shellcheck-v0.10.0/shellcheck
37+
shellcheckVersion="v0.10.0"
38+
echo "6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87 ./shellcheck-$shellcheckVersion.linux.x86_64.tar.xz" >"shellcheck-$shellcheckVersion.linux.x86_64.tar.xz.sha256"
39+
wget --no-verbose "https://github.com/koalaman/shellcheck/releases/download/$shellcheckVersion/shellcheck-$shellcheckVersion.linux.x86_64.tar.xz"
40+
sha256sum -c "shellcheck-$shellcheckVersion.linux.x86_64.tar.xz.sha256"
41+
tar -xf "./shellcheck-$shellcheckVersion.linux.x86_64.tar.xz"
42+
chmod +x "./shellcheck-$shellcheckVersion/shellcheck"
4343
mkdir -p "$HOME/.local/bin"
44-
ln -s "$tmpDir/shellcheck-v0.10.0/shellcheck" "$HOME/.local/bin/shellcheck"
44+
shellcheckInTmp="$tmpDir/shellcheck-$shellcheckVersion"
45+
shellcheckInHomeLocalLib="$HOME/.local/lib/shellcheck-$shellcheckVersion"
46+
shellcheckBin="$HOME/.local/bin/shellcheck"
47+
if [[ -d "$shellcheckInHomeLocalLib" ]]; then
48+
echo "going to remove the existing installation in $shellcheckInHomeLocalLib"
49+
rm -r "$shellcheckInHomeLocalLib"
50+
fi
51+
mv "$shellcheckInTmp" "$shellcheckInHomeLocalLib"
52+
if [[ -f "$shellcheckBin" ]]; then
53+
rm "$shellcheckBin"
54+
fi
55+
ln -s "$shellcheckInHomeLocalLib/shellcheck" "$shellcheckBin"
56+
4557
cd "$currentDir"
4658
shellcheck --version

src/ci/install-shellspec.doc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# run the install-shellcheck.sh in your github/gitlab workflow
1+
# run the install-shellspec in your github/gitlab workflow
22
# for instance, assuming you fetched this file via gt and remote name is tegonal-scripts
33
# then in a github workflow you would have
44

src/ci/install-shellspec.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
# Version: v4.3.0-SNAPSHOT
1010
####### Description #############
1111
#
12-
# function which searches for *.sh files within defined paths (directories or a single *.sh) and
13-
# runs shellcheck on each file with predefined settings i.a. sets `-s bash`
12+
# installs shellspec 0.28.1 into $HOME/.local/lib
1413
#
1514
####### Usage ###################
1615
#
17-
# # run the install-shellcheck.sh in your github/gitlab workflow
16+
# # run the install-shellspec in your github/gitlab workflow
1817
# # for instance, assuming you fetched this file via gt and remote name is tegonal-scripts
1918
# # then in a github workflow you would have
2019
#

0 commit comments

Comments
 (0)