From 19838ae7947030a6243d0f5c7f7db7121df91fe6 Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Fri, 1 Oct 2021 20:25:48 +0200 Subject: [PATCH] SHA256, MD5 sum verification added. --- aps | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/aps b/aps index 07b6ab0..f503b08 100755 --- a/aps +++ b/aps @@ -58,6 +58,27 @@ function sources(){ err "Sources not found, exiting!" fi } +function sha256(){ + sum="$(cat $@/sums)" + case ${shawrp##*/} in + openssl) set -- dgst -sha256 -r "$sum" ;; + sha256 set -- -r "$sum" ;; + esac + hsh=$("$shawrp" "$sum") +} + +function md5(){ + sum="$(cat $@/sums)" + md5sum "$sum" +} +function versum(){ + $sumrest=$(cat $@/sums | cut -d'+' -f-) + $sumtype=$(cat $@/sums | cut -d'+' -f2) + case $sumtype in + sha256) sha256 ;; + md5) md5 ;; + esac +} function runbuildsh(){ if [ -x "${2}/${1}" ]; then prn "Running $1" @@ -117,7 +138,12 @@ function pkg_local(){ mkdir -p "${pkg_path}/payload" . "${pkg_path}/package" cd "${pkg_path}" - sources + sources || err "No sources found / failed getting sources" + if [ -f sums ] + versum "${pkg_path}" + else + wrn "No sums file found! Be careful!" + fi runbuildsh "build" "${pkg_path}" runbuildsh "predeploy" "${pkg_path}" # Old APS code from before the rewrite!