| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # |
| 3 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"). |
| 6 | # You may not use this file except in compliance with the License. |
| 7 | # A copy of the License is located at |
| 8 | # |
| 9 | # http://aws.amazon.com/apache2.0 |
| 10 | # |
| 11 | # or in the "license" file accompanying this file. This file is distributed |
| 12 | # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 13 | # express or implied. See the License for the specific language governing |
| 14 | # permissions and limitations under the License. |
| 15 | # |
| 16 | |
| 17 | set -e |
| 18 | source codebuild/bin/s2n_setup_env.shscip-shell source . . `codebuild/bin/s2n_setup_env.sh`. |
| 19 | |
| 20 | usagescip-shell shell shell-project 0.0.0 usage().() { |
| 21 | echoscip-shell system . . echo. "install_shellcheck.sh" |
| 22 | exit 1 |
| 23 | } |
| 24 | |
| 25 | install_shellcheckscip-shell shell shell-project 0.0.0 install_shellcheck().() { |
| 26 | wget "https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$ARCH.tar.xz" -O /tmp/shellcheck.tar.xzscip-shell filesystem . . `/tmp/shellcheck.tar.xz`. |
| 27 | tarscip-shell system . . tar. -Jxf /tmp/shellcheck.tar.xzscip-shell filesystem . . `/tmp/shellcheck.tar.xz`. -C /tmpscip-shell filesystem . . `/tmp`. |
| 28 | mvscip-shell system . . mv. /tmp/shellcheck-v*/shellcheck /usr/local/bin/scip-shell filesystem . . `/usr/local/bin/`. |
| 29 | chmodscip-shell system . . chmod. 755 /usr/local/bin/shellcheckscip-shell filesystem . . `/usr/local/bin/shellcheck`. |
| 30 | } |
| 31 | |
| 32 | if [scip-shell system . . `[`. "$#" -ne "0" ]; then |
| 33 | usagescip-shell shell shell-project 0.0.0 usage(). |
| 34 | fi |
| 35 | |
| 36 | case "$OS_NAME" in |
| 37 | "amazon linux"|"linux") |
| 38 | whichscip-shell system . . which. shellcheck || install_shellcheckscip-shell shell shell-project 0.0.0 install_shellcheck(). |
| 39 | ;; |
| 40 | "darwin" ) |
| 41 | brew install shellcheck || truescip-shell system . . true. ; |
| 42 | ;; |
| 43 | *) |
| 44 | echoscip-shell system . . echo. "Unknown platform" |
| 45 | exit 255 |
| 46 | ;; |
| 47 | esac |