Skip to content

Commit 0465c43

Browse files
author
Anubhav
committed
Ensure shebang is the first line in scripts and update their copyright headers
1 parent 2357073 commit 0465c43

9 files changed

+40
-34
lines changed

run-integration-tests.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
function usage {
2222
echo "Usage: source ./$( basename "$( python -c "import os; print os.path.abspath('${BASH_SOURCE[0]}')" )" ) [-g] [-s <maven_settings_file>]"
2323
}
@@ -53,4 +53,4 @@ else
5353
cd acs-integration-tests
5454
mvn clean verify -P "public${GRAPH_SUFFIX}" -s "../${MVN_SETTINGS_FILE_LOC}"
5555
cd -
56-
fi
56+
fi

service/start-acs-postgres.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
# This script will run ACS against a local PostgreSQL database. To setup the database:
2222
# 1. Install PostgreSQL
2323
# 2. Open psql

service/start-acs-public-graph.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
unset PROXY_OPTS
2222

2323
if [[ -z "$SPRING_PROFILES_ACTIVE" ]]; then

service/start-acs-public.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
unset PROXY_OPTS
2222

2323
if [[ -z "$SPRING_PROFILES_ACTIVE" ]]; then

service/start-acs.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
echo "JAVA_LOCAL_OPTS: ${JAVA_LOCAL_OPTS}"
2222

2323
HTTP_VALIDATION_SPRING_PROFILE='httpValidation'

set-env-local.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
export PORT_OFFSET=${PORT_OFFSET:-0}
2222
export UAA_LOCAL_PORT=$(( 8080 + ${PORT_OFFSET} ))
2323
export ACS_LOCAL_PORT=$(( 8181 + ${PORT_OFFSET} ))

utils/copyrights.sh

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
{ set -e; } 2> /dev/null
2222

2323
function usage {
@@ -100,7 +100,7 @@ function generate_copyright_header {
100100
COPYRIGHT_HEADER="${COPYRIGHT_HEADER}${BEGINNING_COMMENT_LINE}${NEWLINE}"
101101

102102
IFS="$NEWLINE"
103-
for l in $COPYRIGHT_HEADER_BODY; do
103+
for l in ${COPYRIGHT_HEADER_BODY}; do
104104
if [[ "$BEGINNING_COMMENT_MARKER" != "$CONTINUING_COMMENT_MARKER" ]]; then
105105
COPYRIGHT_HEADER="${COPYRIGHT_HEADER} "
106106
fi
@@ -137,13 +137,17 @@ function upsert_copyright {
137137

138138
if [[ "$1" == 'xml' ]]; then
139139
echo -e '<?xml version="1.0" encoding="UTF-8"?>\n' > "$TMP_FILE"
140+
elif [[ "$1" == 'sh' ]]; then
141+
echo -e '#!/usr/bin/env bash\n' > "$TMP_FILE"
140142
fi
141143

142144
echo "$( generate_copyright_header "$1" )" >> "$TMP_FILE"
143145
echo '' >> "$TMP_FILE"
144146

145147
if [[ "$1" == 'xml' ]]; then
146148
cat "$2" | awk '/<\?xml/{y=1;next}y' | sed '/./,$!d' >> "$TMP_FILE"
149+
elif [[ "$1" == 'sh' ]]; then
150+
cat "$2" | awk '/^#!/{y=1;next}y' | sed '/./,$!d' >> "$TMP_FILE"
147151
else
148152
cat "$2" >> "$TMP_FILE"
149153
fi
@@ -156,7 +160,7 @@ function upsert_copyright {
156160
}
157161

158162
function normalize_authors {
159-
perl -i -pe 's/(\@author\s*)\d{1,}/$1acs-engineers\@ge.com/' "$2"
163+
perl -i -pe 's/(\@author\s*)\d{1,}/$1acs-engineers\@ge.com/' "$1"
160164
}
161165

162166
function modify_copyright_in_file {
@@ -172,7 +176,7 @@ function modify_copyright_in_file {
172176

173177
if [[ -n "$NORMALIZE_AUTHORS" ]]; then
174178
echo "Normalizing author information in file: ${1} with extension: .${EXTENSION}"
175-
normalize_authors "$EXTENSION" "$1"
179+
normalize_authors "$1"
176180
fi
177181
}
178182

@@ -184,7 +188,8 @@ unset SRC_FILE
184188

185189
read_args "$@"
186190

187-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
191+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
192+
ROOT_DIR="$( cd "${SCRIPT_DIR}/.." && pwd )"
188193

189194
if [[ -n "$DEBUG" ]]; then
190195
echo 'The following options are set:'
@@ -193,7 +198,8 @@ if [[ -n "$DEBUG" ]]; then
193198
echo " NORMALIZE_AUTHORS: ${NORMALIZE_AUTHORS}"
194199
echo " DEBUG: ${DEBUG}"
195200
echo " SRC_FILE: ${SRC_FILE}"
196-
echo " DIR: ${DIR}"
201+
echo " SCRIPT_DIR: ${SCRIPT_DIR}"
202+
echo " ROOT_DIR: ${ROOT_DIR}"
197203
echo ''
198204
fi
199205

@@ -211,7 +217,7 @@ if [[ -n "$DEBUG" ]]; then
211217
fi
212218

213219
if [[ -z "$SRC_FILE" ]]; then
214-
for f in $( find "$DIR" \( -not -path '*/\.*' -and -not -path '*/failsafe*' -and -not -path '*/surefire*' \) -type f \( -iname '*.groovy' -or -iname '*.java' -or -iname '*.sh' -or -iname '*.properties' -or -iname '*.xml' \) ); do
220+
for f in $( find "$ROOT_DIR" \( -not -path '*/\.*' -and -not -path '*/failsafe*' -and -not -path '*/surefire*' \) -type f \( -iname '*.groovy' -or -iname '*.java' -or -iname '*.sh' -or -iname '*.properties' -or -iname '*.xml' \) ); do
215221
modify_copyright_in_file "$f"
216222
done
217223
else

utils/download-dependency-sources.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
{ set -e; } 2> /dev/null
2222

2323
function usage {

utils/merge-to-master.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
#!/usr/bin/env bash
2+
13
################################################################################
2-
# Copyright 2017 General Electric Company
4+
# Copyright 2018 General Electric Company
35
#
46
# Licensed under the Apache License, Version 2.0 (the "License");
57
# you may not use this file except in compliance with the License.
@@ -16,8 +18,6 @@
1618
# SPDX-License-Identifier: Apache-2.0
1719
################################################################################
1820

19-
#!/usr/bin/env bash
20-
2121
YES='yes'
2222
SKIP='skip'
2323
NO='n'

0 commit comments

Comments
 (0)