Last change
on this file since 91772 was 91772, checked in by vboxsync, 3 years ago |
openssl-1.1.1l: Applied and adjusted our OpenSSL changes to 1.1.1l. bugref:10126
|
File size:
1.5 KB
|
Line | |
---|
1 | #!/usr/bin/env bash
|
---|
2 | #
|
---|
3 | # Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
---|
4 | #
|
---|
5 | # Licensed under the OpenSSL license (the "License"). You may not use
|
---|
6 | # this file except in compliance with the License. You can obtain a copy
|
---|
7 | # in the file LICENSE in the source distribution or at
|
---|
8 | # https://www.openssl.org/source/license.html
|
---|
9 |
|
---|
10 |
|
---|
11 | myname="$(basename $0)"
|
---|
12 |
|
---|
13 | this_year="$(date '+%Y')"
|
---|
14 | some_year="[12][0-9][0-9][0-9]"
|
---|
15 | year_range="(${some_year})(-${some_year})?"
|
---|
16 |
|
---|
17 | copyright_owner="The OpenSSL Project"
|
---|
18 | copyright="Copyright .*${year_range} .*${copyright_owner}"
|
---|
19 |
|
---|
20 | # sed_script:
|
---|
21 | # for all lines that contain ${copyright} : {
|
---|
22 | # replace years yyyy-zzzz (or year yyyy) by yyyy-${this_year}
|
---|
23 | # replace repeated years yyyy-yyyy by yyyy
|
---|
24 | # }
|
---|
25 | sed_script="/${copyright}/{ s/${year_range}/\1-${this_year}/ ; s/(${some_year})-\1/\1/ }"
|
---|
26 |
|
---|
27 | function usage() {
|
---|
28 | cat >&2 <<EOF
|
---|
29 | usage: $myname [-h|--help] [file|directory] ...
|
---|
30 |
|
---|
31 | Updates the year ranges of all OpenSSL copyright statements in the given
|
---|
32 | files or directories. (Directories are traversed recursively.)
|
---|
33 | EOF
|
---|
34 | }
|
---|
35 |
|
---|
36 | if [ $# -eq 0 ]; then
|
---|
37 | usage
|
---|
38 | exit 0
|
---|
39 | fi
|
---|
40 |
|
---|
41 |
|
---|
42 | for arg in "$@"; do
|
---|
43 | case $arg in
|
---|
44 | -h|--help)
|
---|
45 | usage
|
---|
46 | exit 0
|
---|
47 | ;;
|
---|
48 | -*)
|
---|
49 | echo -e "illegal option: $arg\n" >& 2
|
---|
50 | usage
|
---|
51 | exit 1
|
---|
52 | ;;
|
---|
53 | *)
|
---|
54 | if [ -f "$arg" ]; then
|
---|
55 | sed -E -i "${sed_script}" "$arg"
|
---|
56 | elif [ -d "$arg" ]; then
|
---|
57 | find "$arg" -name '.[a-z]*' -prune -o -type f -exec sed -E -i "${sed_script}" {} +
|
---|
58 | else
|
---|
59 | echo "$arg: no such file or directory" >&2
|
---|
60 | fi
|
---|
61 | ;;
|
---|
62 | esac
|
---|
63 | done
|
---|
Note:
See
TracBrowser
for help on using the repository browser.