smlinux/bldpkg.d/genchecksum

29 lines
787 B
Text
Executable file

# Generate sha512sums in the build file
genchecksum() {
echo "Discarding old SHA512SUMS from $SRCDIRRPATH.SMBuild"
sed -E -i \
-e '/^SHA512SUMS=".*"$/d' \
-e '/^SHA512SUMS="/,/"$/d' \
-e "/^SHA512SUMS='.*'\$/d" \
-e "/^SHA512sums='/,/'\$/d" \
"$SRCDIRRPATH".SMBuild
echo "Adding new SHA512SUMS in $SRCDIRRPATH.SMBuild..."
printf 'SHA512SUMS="\n' >> "$SRCDIRRPATH".SMBuild
# File types
FILES=( *.tar.* *.zip *.t?z *.patch *.diff *.c *.h )
# Checksum digest to be used along with arguments
CHECKSUMBINARY="sha512sum"
for FILE in ${FILES[@]} ; do
if [ -f "$FILE" ] ; then
$CHECKSUMBINARY $FILE >> "$SRCDIRRPATH".SMBuild
fi
done
printf '"' >> "$SRCDIRRPATH".SMBuild
echo "You may now run bldpkg again without any arguments"
exit 0
}