From: Steven Baltakatei Sandoval Date: Thu, 21 Jul 2022 04:55:39 +0000 (+0000) Subject: feat(user/):Add script to check an ots file X-Git-Tag: 0.5.1~14 X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/commitdiff_plain/282cc59d9c67c0882fd3ab9e8e2476b341a862dd?hp=3904c727458b58dad9b18e5617f3820ae49e5089 feat(user/):Add script to check an ots file new file: user/check_ots.sh --- diff --git a/user/check_ots.sh b/user/check_ots.sh new file mode 100644 index 0000000..586e13e --- /dev/null +++ b/user/check_ots.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +yell() { echo "$0: $*" >&2; } # print script path and all args to stderr +die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status +try() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails + +if [[ ! -f $1 ]]; then die "FATAL:Not a file:$1"; fi; + +ots u "$1" 1>/dev/null 2>&1; + +if ! ( ots v "$1" 1>/dev/null 2>/dev/null ); then + yell "ERROR:Verification failed:$1"; + ots v "$1"; +fi;