Kapisi/roles/Yggdrasil/package/yggdrasil-sha256

27 lines
508 B
Plaintext
Raw Normal View History

2024-09-02 23:54:57 -05:00
#!/bin/bash
set -x
basedir="/srv/yggdrasil"
shafile="$basedir""/library.sha256"
option="$1"
if [ "$option" == "-h" ] || [ "$option" == "--help" ]; then
echo Usage: $0 '[verify]'
exit 1
fi
if [[ "$option" != "verify" ]]; then
chmod u+w "$basedir"
touch "$shafile"
chmod u+w "$shafile"
find "$basedir" -type f -exec sha256sum {} \; > "$shafile"
chmod u-w "$basedir" "$shafile"
exit 0;
else
echo "These files have problems:"
sha256sum -c "$shafile";
exit $?;
fi