Created
June 12, 2018 01:53
-
-
Save chrstphrchvz/7f534a72d9616e4384edae8bf1f57ffe to your computer and use it in GitHub Desktop.
Get MacPorts checksums for macOS Finder Services menu (based on https://superuser.com/a/876122/414616)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
with timeout of 360 seconds | |
tell application "System Events" | |
activate | |
display dialog input buttons {"OK"} default button 1 with title "MacPorts checksums" giving up after 300 --seconds | |
end tell | |
end timeout | |
end run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file; do | |
if [[ -d "$file" ]]; then | |
echo "$(basename "$file") is a directory" | |
else | |
cd "$(dirname "$file")" | |
echo -e "$(basename "$file")\r" | |
echo -e "checksums rmd160 $(/usr/bin/openssl dgst -rmd160 "$(basename "$file")" | egrep -o [a-f0-9]{40}) \\" | |
echo -e " sha256 $(/usr/bin/openssl dgst -sha256 "$(basename "$file")" | egrep -o [a-f0-9]{64}) \\" | |
echo -e " size $(stat -f %z "$file")" | |
fi | |
done | tr "\n" "\r" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment