SHA256, MD5 sum verification added.

This commit is contained in:
Ohio2 2021-10-01 20:25:48 +02:00
parent 5bb6f377a4
commit 19838ae794

28
aps
View file

@ -58,6 +58,27 @@ function sources(){
err "Sources not found, exiting!" err "Sources not found, exiting!"
fi 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(){ function runbuildsh(){
if [ -x "${2}/${1}" ]; then if [ -x "${2}/${1}" ]; then
prn "Running $1" prn "Running $1"
@ -117,7 +138,12 @@ function pkg_local(){
mkdir -p "${pkg_path}/payload" mkdir -p "${pkg_path}/payload"
. "${pkg_path}/package" . "${pkg_path}/package"
cd "${pkg_path}" 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 "build" "${pkg_path}"
runbuildsh "predeploy" "${pkg_path}" runbuildsh "predeploy" "${pkg_path}"
# Old APS code from before the rewrite! # Old APS code from before the rewrite!