summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-15 09:58:31 +0200
committerErich Eckner <git@eckner.net>2018-05-15 09:58:31 +0200
commit7b09ca326731653be4d8baa54be133de1e31a550 (patch)
tree2d8887e5850f1a38a3867163417e776f8d379847
parent8f2b7e42637e3cabdd4c970e2a65720df27b303e (diff)
downloadbuilder-7b09ca326731653be4d8baa54be133de1e31a550.tar.xz
lib/common-functions: calculate_script_checksum() new
-rwxr-xr-xlib/common-functions14
1 files changed, 14 insertions, 0 deletions
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}'
+}