Debian Codegraph @

crt/s2n/codebuild/bin/install_shellcheck.sh

raw symbols SCIP
1 #!/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.sh
19
20 usage() {
21 echo "install_shellcheck.sh"
22 exit 1
23 }
24
25 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.xz
27 tar -Jxf /tmp/shellcheck.tar.xz -C /tmp
28 mv /tmp/shellcheck-v*/shellcheck /usr/local/bin/
29 chmod 755 /usr/local/bin/shellcheck
30 }
31
32 if [ "$#" -ne "0" ]; then
33 usage
34 fi
35
36 case "$OS_NAME" in
37 "amazon linux"|"linux")
38 which shellcheck || install_shellcheck
39 ;;
40 "darwin" )
41 brew install shellcheck || true ;
42 ;;
43 *)
44 echo "Unknown platform"
45 exit 255
46 ;;
47 esac