-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do.sums.bash
executable file
·32 lines (32 loc) · 965 Bytes
/
do.sums.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/env bash
# Copyright 2019 (c) all rights reserved by S D Rausty; see LICENSE
# https://sdrausty.github.io hosted courtesy https://pages.github.com
# To create checksum files and commit use; ./do.sums.bash
# To see file tree use; awk '{print $2}' sha512.sum
# To check the files use; sha512sum -c sha512.sum
#####################################################################
set -eu
git pull
rm -f *.sum
FILELIST=( $(find . -type f | grep -v .git | sort) )
CHECKLIST=(sha512sum) # md5sum sha1sum sha224sum sha256sum sha384sum
for SCHECK in ${CHECKLIST[@]}
do
printf "\\e[1;38;5;118m%s\\e[0m\\n" "Creating $SCHECK file..."
for FILE in "${FILELIST[@]}"
do
$SCHECK "$FILE" >> ${SCHECK::-3}.sum
done
done
chmod 400 ${SCHECK::-3}.sum
for SCHECK in ${CHECKLIST[@]}
do
printf "\\e[1;38;5;119m%s\\e[0m\\n" "Checking $SCHECK..."
$SCHECK -c ${SCHECK::-3}.sum
done
git add .
git commit
git push
ls
printf "\\e[1;38;5;120m%s\\e[0m\\n" "$PWD"
# do.sums.sh EOF