VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1l/util/openssl-update-copyright@ 91772

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
11myname="$(basename $0)"
12
13this_year="$(date '+%Y')"
14some_year="[12][0-9][0-9][0-9]"
15year_range="(${some_year})(-${some_year})?"
16
17copyright_owner="The OpenSSL Project"
18copyright="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# }
25sed_script="/${copyright}/{ s/${year_range}/\1-${this_year}/ ; s/(${some_year})-\1/\1/ }"
26
27function usage() {
28 cat >&2 <<EOF
29usage: $myname [-h|--help] [file|directory] ...
30
31Updates the year ranges of all OpenSSL copyright statements in the given
32files or directories. (Directories are traversed recursively.)
33EOF
34}
35
36if [ $# -eq 0 ]; then
37 usage
38 exit 0
39fi
40
41
42for 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
63done
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette