-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update install script to better support non-PATH installations #1184
Changes from 6 commits
b1c84d3
52bb7d2
ff4699d
67dc804
2801500
db695ea
a80c763
afc9ece
002f8a8
5426608
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ processor=$(uname -m) | |
|
||
if [ "$processor" == "x86_64" ]; then | ||
arch="amd64" | ||
elif [ "$processor" == "arm64" ]; then | ||
arch="arm64" | ||
else | ||
arch="386" | ||
fi | ||
|
@@ -41,7 +43,7 @@ else | |
fi | ||
|
||
echo "Downloading TFLint $version" | ||
curl -L -o /tmp/tflint.zip "https://github.com/terraform-linters/tflint/releases/download/${version}/tflint_${os}.zip" | ||
curl --fail --silent -L -o /tmp/tflint.zip "https://github.com/terraform-linters/tflint/releases/download/${version}/tflint_${os}.zip" | ||
retVal=$? | ||
if [ $retVal -ne 0 ]; then | ||
echo "Failed to download tflint_${os}.zip" | ||
|
@@ -68,13 +70,13 @@ else | |
dest="${TFLINT_INSTALL_PATH:-/usr/local/bin}/" | ||
echo "Installing /tmp/tflint to ${dest}..." | ||
|
||
if [[ "$(id -u)" == 0 ]]; then SUDO=""; else | ||
if [[ "$(id -u)" == 0 ]] || [[ $TFLINT_INSTALL_NO_ROOT == 1 ]]; then SUDO=""; else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like the script should just test whether it can access the directory as the non-root user and use sudo if not rather than adding an option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call 👍 a80c763 |
||
SUDO="sudo"; | ||
fi | ||
|
||
|
||
$SUDO mkdir -p "$dest" | ||
$SUDO install -b -c -v /tmp/tflint "$dest" | ||
$SUDO install --backup=none -c -v /tmp/tflint "$dest" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps scope creeping a but - but I suggest we change this to not create any backup, to avoid polluting the PATH. What happens now if you run the install script more than once is that you'll end up with a |
||
retVal=$? | ||
if [ $retVal -ne 0 ]; then | ||
echo "Failed to install tflint" | ||
|
@@ -89,4 +91,4 @@ rm -f /tmp/tflint.zip /tmp/tflint | |
|
||
echo -e "\n\n====================================================" | ||
echo "Current tflint version" | ||
tflint -v | ||
"${dest}/tflint" -v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could submit this separately happy to merge it right away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 #1185