mirror of
https://github.com/speed47/spectre-meltdown-checker.git
synced 2025-04-18 20:25:15 +02:00
feat: set default TMPDIR for Android (#415)
This commit is contained in:
parent
2a5b965b98
commit
5f6471d9a4
@ -850,7 +850,7 @@ update_fwdb()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# first, download the MCE.db from the excellent platomav's MCExtractor project
|
# first, download the MCE.db from the excellent platomav's MCExtractor project
|
||||||
mcedb_tmp="$(mktemp /tmp/mcedb-XXXXXX)"
|
mcedb_tmp="$(mktemp -t smc-mcedb-XXXXXX)"
|
||||||
mcedb_url='https://github.com/platomav/MCExtractor/raw/master/MCE.db'
|
mcedb_url='https://github.com/platomav/MCExtractor/raw/master/MCE.db'
|
||||||
_info_nol "Fetching MCE.db from the MCExtractor project... "
|
_info_nol "Fetching MCE.db from the MCExtractor project... "
|
||||||
if command -v wget >/dev/null 2>&1; then
|
if command -v wget >/dev/null 2>&1; then
|
||||||
@ -870,7 +870,7 @@ update_fwdb()
|
|||||||
echo DONE
|
echo DONE
|
||||||
|
|
||||||
# second, get the Intel firmwares from GitHub
|
# second, get the Intel firmwares from GitHub
|
||||||
intel_tmp="$(mktemp -d /tmp/intelfw-XXXXXX)"
|
intel_tmp="$(mktemp -d -t smc-intelfw-XXXXXX)"
|
||||||
intel_url="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/main.zip"
|
intel_url="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/main.zip"
|
||||||
_info_nol "Fetching Intel firmwares... "
|
_info_nol "Fetching Intel firmwares... "
|
||||||
## https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git
|
## https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git
|
||||||
@ -970,7 +970,7 @@ update_fwdb()
|
|||||||
echo DONE "(version $dbversion)"
|
echo DONE "(version $dbversion)"
|
||||||
|
|
||||||
if [ "$1" = builtin ]; then
|
if [ "$1" = builtin ]; then
|
||||||
newfile=$(mktemp /tmp/smc-XXXXXX)
|
newfile=$(mktemp -t smc-builtin-XXXXXX)
|
||||||
awk '/^# %%% MCEDB / { exit }; { print }' "$0" > "$newfile"
|
awk '/^# %%% MCEDB / { exit }; { print }' "$0" > "$newfile"
|
||||||
awk '{ if (NR>1) { print } }' "$mcedb_cache" >> "$newfile"
|
awk '{ if (NR>1) { print } }' "$mcedb_cache" >> "$newfile"
|
||||||
cat "$newfile" > "$0"
|
cat "$newfile" > "$0"
|
||||||
@ -1377,7 +1377,7 @@ try_decompress()
|
|||||||
return 0
|
return 0
|
||||||
elif [ "$3" != "cat" ]; then
|
elif [ "$3" != "cat" ]; then
|
||||||
_debug "try_decompress: decompression with $3 worked but result is not a kernel, trying with an offset"
|
_debug "try_decompress: decompression with $3 worked but result is not a kernel, trying with an offset"
|
||||||
[ -z "$kerneltmp2" ] && kerneltmp2=$(mktemp /tmp/kernel-XXXXXX)
|
[ -z "$kerneltmp2" ] && kerneltmp2=$(mktemp -t smc-kernel-XXXXXX)
|
||||||
cat "$kerneltmp" > "$kerneltmp2"
|
cat "$kerneltmp" > "$kerneltmp2"
|
||||||
try_decompress '\177ELF' xxy 'cat' '' cat "$kerneltmp2" && return 0
|
try_decompress '\177ELF' xxy 'cat' '' cat "$kerneltmp2" && return 0
|
||||||
else
|
else
|
||||||
@ -1391,7 +1391,7 @@ extract_kernel()
|
|||||||
{
|
{
|
||||||
[ -n "${1:-}" ] || return 1
|
[ -n "${1:-}" ] || return 1
|
||||||
# Prepare temp files:
|
# Prepare temp files:
|
||||||
kerneltmp="$(mktemp /tmp/kernel-XXXXXX)"
|
kerneltmp="$(mktemp -t smc-kernel-XXXXXX)"
|
||||||
|
|
||||||
# Initial attempt for uncompressed images or objects:
|
# Initial attempt for uncompressed images or objects:
|
||||||
if check_kernel "$1"; then
|
if check_kernel "$1"; then
|
||||||
@ -2179,6 +2179,12 @@ mockme=''
|
|||||||
mocked=0
|
mocked=0
|
||||||
specex_knob_dir=/dev/no_valid_path
|
specex_knob_dir=/dev/no_valid_path
|
||||||
|
|
||||||
|
# if /tmp doesn't exist and TMPDIR is not set, try to set it to a sane default for Android
|
||||||
|
if [ -z "${TMPDIR:-}" ] && ! [ -d "/tmp" ] && [ -d "/data/local/tmp" ]; then
|
||||||
|
TMPDIR=/data/local/tmp
|
||||||
|
export TMPDIR
|
||||||
|
fi
|
||||||
|
|
||||||
parse_cpu_details
|
parse_cpu_details
|
||||||
get_cmdline
|
get_cmdline
|
||||||
|
|
||||||
@ -2277,7 +2283,7 @@ if [ "$opt_live" = 1 ]; then
|
|||||||
# specified by user on cmdline, with --live, don't override
|
# specified by user on cmdline, with --live, don't override
|
||||||
:
|
:
|
||||||
elif [ -e "$procfs/config.gz" ] ; then
|
elif [ -e "$procfs/config.gz" ] ; then
|
||||||
dumped_config="$(mktemp /tmp/config-XXXXXX)"
|
dumped_config="$(mktemp -t smc-config-XXXXXX)"
|
||||||
gunzip -c "$procfs/config.gz" > "$dumped_config"
|
gunzip -c "$procfs/config.gz" > "$dumped_config"
|
||||||
# dumped_config will be deleted at the end of the script
|
# dumped_config will be deleted at the end of the script
|
||||||
opt_config="$dumped_config"
|
opt_config="$dumped_config"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user