blobutil: don't hardcode paths
parent
688e508175
commit
a2686bf4f4
|
@ -5,6 +5,9 @@
|
||||||
# SPDX-FileCopyrightText: 2023 Leah Rowe <info@minifree.org>
|
# SPDX-FileCopyrightText: 2023 Leah Rowe <info@minifree.org>
|
||||||
# SPDX-License-Identifier: GPL-3.0-only
|
# SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
blobdir="blobs"
|
||||||
|
dl_path="${blobdir}/vendorupdate"
|
||||||
|
appdir="${blobdir}/app"
|
||||||
_7ztest="a"
|
_7ztest="a"
|
||||||
mecleaner="$(pwd)/me_cleaner/me_cleaner.py"
|
mecleaner="$(pwd)/me_cleaner/me_cleaner.py"
|
||||||
me7updateparser="$(pwd)/resources/blobs/me7_update_parser.py"
|
me7updateparser="$(pwd)/resources/blobs/me7_update_parser.py"
|
||||||
|
@ -122,23 +125,23 @@ Fetch_update() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Vendor_checksum blobs/me.exe || \
|
Vendor_checksum ${dl_path} || \
|
||||||
curl ${dl_url} > blobs/me.exe || curl ${dl_url_bkup} > blobs/me.exe
|
curl ${dl_url} > ${dl_path} || curl ${dl_url_bkup} > ${dl_path}
|
||||||
|
|
||||||
Vendor_checksum blobs/me.exe || Fail \
|
Vendor_checksum ${dl_path} || Fail \
|
||||||
"Cannot guarantee intergity of vendor update for board: `${board}`"
|
"Cannot guarantee intergity of vendor update for board: `${board}`"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Vendor_checksum() {
|
Vendor_checksum() {
|
||||||
if [ ! -f "blobs/me.exe" ]; then
|
if [ ! -f "${dl_path}" ]; then
|
||||||
printf "Vendor update not found on disk for board: `%s`\n" ${board}
|
printf "Vendor update not found on disk for board: `%s`\n" ${board}
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ "$(sha1sum blobs/me.exe | awk '{print $1}')" != "${dl_hash}" ]; then
|
if [ "$(sha1sum ${dl_path} | awk '{print $1}')" != "${dl_hash}" ]; then
|
||||||
printf "Bad checksum on vendor update for board: `%s`\n" ${board}
|
printf "Bad checksum on vendor update for board: `%s`\n" ${board}
|
||||||
rm blobs/me.exe
|
rm ${dl_path}
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
@ -153,8 +156,8 @@ Extract_me(){
|
||||||
mkdir -p ${_me_destination%/*}
|
mkdir -p ${_me_destination%/*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "blobs/app" ]; then
|
if [ -d "${appdir}" ]; then
|
||||||
rm -r blobs/app
|
rm -r ${appdir}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "${_me_destination}" ]; then
|
if [ -f "${_me_destination}" ]; then
|
||||||
|
@ -163,11 +166,11 @@ Extract_me(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'extracting and stripping intel management engine\n'
|
printf 'extracting and stripping intel management engine\n'
|
||||||
innoextract blobs/me.exe -d blobs \
|
innoextract ${dl_path} -d ${blobdir} \
|
||||||
|| 7z x blobs/me.exe -oblobs/app \
|
|| 7z x ${dl_path} -o${appdir} \
|
||||||
|| Fail 'could not extract me executable with innoextract'
|
|| Fail 'could not extract me executable with innoextract'
|
||||||
|
|
||||||
Bruteforce_extract_me "$(pwd)/${_me_destination}" "$(pwd)/blobs/app" \
|
Bruteforce_extract_me "$(pwd)/${_me_destination}" "$(pwd)/${appdir}" \
|
||||||
|| return 1
|
|| return 1
|
||||||
|
|
||||||
printf "Truncated and cleaned me output to ${_me_destination}\n"
|
printf "Truncated and cleaned me output to ${_me_destination}\n"
|
||||||
|
|
Loading…
Reference in New Issue