From 7b09ca326731653be4d8baa54be133de1e31a550 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 15 May 2018 09:58:31 +0200 Subject: lib/common-functions: calculate_script_checksum() new --- lib/common-functions | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/common-functions') diff --git a/lib/common-functions b/lib/common-functions index 65189dc..a4cc1ef 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -704,3 +704,17 @@ irc_say() { fi fi } + +# calculate_script_checksum +# calculate and print a checksum of the main script and all scripts in lib/ +calculate_script_checksum() { + { + sha512sum "$0" + find "${base_dir}/lib" -type f \ + -exec sha512sum '{}' \; + } | \ + sort | \ + awk '{print $1}' | \ + sha512sum | \ + awk '{print $1}' +} -- cgit v1.2.3-54-g00ecf