blob: 9894cba3e40e48a91d3da6cfe858200e52ad4b50 [file] [log] [blame]
Minos Galanakisbefc8362021-06-29 14:41:04 +01001#!/bin/bash
2#-------------------------------------------------------------------------------
3# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#-------------------------------------------------------------------------------
8
9CHECKPATCH_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
10CHECKPATCH_REPO="https://raw.githubusercontent.com/torvalds/linux/v5.9/scripts"
11
12download_file() {
13 F_PATH="$CHECKPATCH_PATH/$1"
14 curl "$CHECKPATCH_REPO/$1" --output "$F_PATH" &>/dev/null
15
16 if [ $? != 0 ]; then
17 echo "[SCF checkpatch] Error downloading file $1"
18 exit 1
19 else
20 if [ "$1" = "checkpatch.pl" ]; then
21 echo "[SCF checkpatch] $F_PATH --> chmod 740"
22 chmod 750 "$F_PATH"
23 else
24 echo "[SCF checkpatch] $F_PATH --> chmod 640"
25 chmod 640 "$F_PATH"
26 fi
27 fi
28}
29
30# Download required files
31download_file checkpatch.pl
32download_file const_structs.checkpatch
33download_file spelling.txt