Auto-AddChecksum

v4hn v4hn at lunar-linux.org
Thu Jan 17 17:14:05 CET 2013


Hey everyone,

some time ago I got so annoyed at manually pasting the
new checksum of a bumped module to the DETAILS file I wrote
this small plugin that automatically prints/adds
_one_ checksum for a file, given that you removed
the old checksum (the checksum, not the prefix).

You should still verify it's the correct checksum,
but it makes live a bit easier in most cases.
Maybe someone wants to use it.
(improvements for multiple files are welcome as well)


v4hn
-------------- next part --------------
#!/bin/bash
#############################################################
#                                                           #
# verify-addchecksum.plugin - plugin to automatically add cs#
#                                                           #
#############################################################
#                                                           #
# Copyright 2012 by v4hn @ v4hn.de under GPLv2              #
#                                                           #
#############################################################


plugin_source_verify_addchecksum() {
  local TMP_MD5
  # check if we can handle this type of VFY:
  if [[ -z "${2}" || "${2}" != "sha1:" ]]; then
    return 2
  fi
  debug_msg "plugin_source_verify_addchecksum ($@)"
  TMP_MD5=$(sha1sum $SOURCE_CACHE/$1 | cut -d " " -f 1-1)
  message "${PROBLEM_COLOR}! No checksum available for ${DEFAULT_COLOR}${FILE_COLOR}$1${DEFAULT_COLOR}"
  message "Downloaded file has checksum 'sha1:$TMP_MD5'"
  sed -i "s at SOURCE_VFY=.*@SOURCE_VFY=sha1:$TMP_MD5@" $MOONBASE/$(find_section $MODULE)/$MODULE/DETAILS
  message "This was added to $MOONBASE/$(find_section $MODULE)/$MODULE/DETAILS"
  message "as SOURCE_VFY=sha1:$TMP_MD5"

  message "Reload the file to make sure you got a verifiable checksum!"
  return 1
}


plugin_register SOURCE_VERIFY plugin_source_verify_addchecksum
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://foo-projects.org/pipermail/lunar-dev/attachments/20130117/29ed8d7f/attachment.bin>


More information about the Lunar-dev mailing list