updatemd5sum.sh 677 Bytes
Newer Older
AlmAck's avatar
AlmAck committed
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 36 37
#!/bin/bash
# Script by Falconindy and modified by AlmAck
# https://bbs.archlinux.org/viewtopic.php?id=131666

_script_name="Update the checksums"
source _buildscripts/functions/messages

update_md5sum()
{
    [ -n "${_args}" ] || error "you need to specify a package folder"

    newline
    msg "Updating md5sum"
    cd "${_args}"
    awk -v newsums="$(makepkg -g)" '
    BEGIN {
      if (!newsums) exit 1
    }

    /^[[:blank:]]*(md|sha)[[:digit:]]+sums=/,/\)[[:blank:]]*$/ {
      if (!i) print newsums; i++
      next
    }

    1
    ' PKGBUILD > PKGBUILD.new && mv PKGBUILD{.new,} 
}


title "${_script_name}"

_args=$(echo $1)

update_md5sum

title "All done"
newline