archcraft-xfce/profile/create-signature.sh

35 lines
1005 B
Bash
Raw Permalink Normal View History

2022-10-07 06:59:17 +00:00
#!/usr/bin/env bash
2024-01-12 04:47:03 -01:00
## Copyright (C) 2020-2024 Aditya Shakya <adi1090x@gmail.com>
2022-10-07 06:59:17 +00:00
## Generate sha256sum and gpg signature files
PWD=`pwd`
2024-01-12 04:47:03 -01:00
DIR="$PWD/out"
2022-10-07 06:59:17 +00:00
if [[ ! -d "$DIR" ]]; then
2024-01-12 04:47:03 -01:00
exit 1
2022-10-07 06:59:17 +00:00
fi
RELEASE=`find $DIR -type f -name "archcraft-*.iso" -printf "%f\n"`
if [[ -n "$RELEASE" ]]; then
echo -e "\n[*] Generating sha256sum for ${RELEASE} ..."
cd "$DIR" && sha256sum ${RELEASE} > ${RELEASE}.sha256sum
if [[ -e "${RELEASE}.sha256sum" ]]; then
echo -e "[*] Checksum generated successfully."
else
echo -e "[!] Failed to generate checksum file."
fi
echo -e "\n[*] Generating gpg signature for ${RELEASE} ..."
gpg --default-key adi1090x@gmail.com --output ${RELEASE}.sig --detach-sig ${RELEASE}
if [[ -e "${RELEASE}.sig" ]]; then
echo -e "[*] Signature generated successfully.\n"
else
echo -e "[!] Failed to generate signature file.\n"
fi
else
echo -e "\n[!] There's no ISO file in 'files' directory.\n[!] Copy the ISO file in 'files' directory & Run this script again.\n"
exit 1
fi