-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path01-create-signature.sh
executable file
·35 lines (29 loc) · 1.07 KB
/
01-create-signature.sh
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
33
34
35
#!/usr/bin/env bash
## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com>
## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3
## Generate sha256sum and gpg signature files
PWD=`pwd`
DIR="$PWD/files"
if [[ ! -d "$DIR" ]]; then
mkdir -p "$DIR"
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