~dricottone/my-utils

581955c8fa8a187f983dc223c947f12e9f9ad474 — Dominic Ricottone 2 years ago 162fb5c
Fix mktar

SHA1 checksum files were created regardless of existence of corresponding
file. Worse yet, they weren't actual checksums.
1 files changed, 7 insertions(+), 3 deletions(-)

M archives/mktar
M archives/mktar => archives/mktar +7 -3
@@ 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