From 581955c8fa8a187f983dc223c947f12e9f9ad474 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Thu, 28 Jul 2022 20:03:10 -0500 Subject: [PATCH] Fix mktar SHA1 checksum files were created regardless of existence of corresponding file. Worse yet, they weren't actual checksums. --- archives/mktar | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/archives/mktar b/archives/mktar index 6cfacbc..1c1f954 100755 --- a/archives/mktar +++ b/archives/mktar @@ -1,7 +1,7 @@ #!/bin/bash name="mktar" -version="1.1" +version="1.2" read -r -d '' help_message <<-EOF Wrapper around 'tar' for easier compression Usage: mktar FILES [..] [OPTIONS] @@ -259,8 +259,12 @@ esac # checksum routine if [[ "$checksum" -eq 1 ]]; then - if ! /usr/bin/sha1sum "$archive_fn" | /usr/bin/awk '{print $1}' > "$checksum_fn"; then - code=1 + if [[ -f "$archive_fn" ]]; then + if ! /usr/bin/sha1sum "$archive_fn" | /usr/bin/awk '{print $1}' > "$checksum_fn"; then + code=1 + fi + else + error_msg "No such file '${target}'" fi fi -- 2.45.2