mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-01-13 16:50:35 +00:00
Simplify and move get_file_arch out of subfunction
This commit is contained in:
parent
9c23d6d07c
commit
b17e01f282
@ -1002,20 +1002,6 @@ wine_check() {
|
|||||||
system_wine_ok="true"
|
system_wine_ok="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Function to determine the architecture of a binary file using 'od'
|
|
||||||
get_file_arch() {
|
|
||||||
local file_path="$1"
|
|
||||||
local ob_output
|
|
||||||
ob_output="$(od -An -t x1 -j 0x12 -N 1 "$file_path" 2>/dev/null | tr -d '[:space:]')"
|
|
||||||
case "$ob_output" in
|
|
||||||
"3e") echo "x86_64" ;;
|
|
||||||
"03"|"06") echo "i386" ;;
|
|
||||||
"b7") echo "aarch64" ;;
|
|
||||||
"28") echo "aarch32" ;;
|
|
||||||
*) echo "" ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# If system wine passes the above checks, also check for the new wow64 mode that currently does not work
|
# If system wine passes the above checks, also check for the new wow64 mode that currently does not work
|
||||||
if [ "$system_wine_ok" = "true" ]; then
|
if [ "$system_wine_ok" = "true" ]; then
|
||||||
# Get paths to wine and wineserver binaries
|
# Get paths to wine and wineserver binaries
|
||||||
@ -1028,6 +1014,7 @@ wine_check() {
|
|||||||
|
|
||||||
# If unable to determine architecture, attempt alternative methods
|
# If unable to determine architecture, attempt alternative methods
|
||||||
if [ -z "${wine_binary_arch}" ]; then
|
if [ -z "${wine_binary_arch}" ]; then
|
||||||
|
wineboot_bin="$(command -v wineboot)"
|
||||||
if [ -x "${wineboot_bin}" ]; then
|
if [ -x "${wineboot_bin}" ]; then
|
||||||
wine_bin_dir="$(dirname "$(readlink -f "${wineboot_bin}" 2>/dev/null)" 2>/dev/null)"
|
wine_bin_dir="$(dirname "$(readlink -f "${wineboot_bin}" 2>/dev/null)" 2>/dev/null)"
|
||||||
if [ -x "${wine_bin_dir}/wine" ]; then
|
if [ -x "${wine_bin_dir}/wine" ]; then
|
||||||
@ -1052,20 +1039,40 @@ wine_check() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If Wine is 32-bit only, fail the check
|
# Check for the new WOW64, 32bit, or unknown states and then fail the check
|
||||||
if { [ "${wineserver_binary_arch}" = "i386" ] || [ "${wineserver_binary_arch}" = "aarch32" ]; } && \
|
if [ "${wineserver_binary_arch}" = "${wine_binary_arch}" ] || [ -z "${wineserver_binary_arch}" ] || [ -z "${wine_binary_arch}" ]; then
|
||||||
{ [ "${wine_binary_arch}" = "i386" ] || [ "${wine_binary_arch}" = "aarch32" ]; }; then
|
|
||||||
preflight_fail+=("Wine does not appear to be installed correctly.\nPlease refer to our Quick Start Guide:\n$lug_wiki")
|
|
||||||
system_wine_ok="false"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If it's the new WOW64, fail the check
|
|
||||||
if [ "${wineserver_binary_arch}" = "${wine_binary_arch}" ]; then
|
|
||||||
system_wine_ok="false"
|
system_wine_ok="false"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to determine the architecture of a binary file using 'od'
|
||||||
|
# Used for wine_check above to check the system wine architecture
|
||||||
|
get_file_arch() {
|
||||||
|
case "$(od -An -t x1 -j 0x12 -N 1 "$1" 2>/dev/null | tr -d '[:space:]')" in
|
||||||
|
"3e")
|
||||||
|
# x86_64
|
||||||
|
echo "64bit"
|
||||||
|
;;
|
||||||
|
"03"|"06")
|
||||||
|
# i386
|
||||||
|
echo "32bit"
|
||||||
|
;;
|
||||||
|
"b7")
|
||||||
|
# aarch64
|
||||||
|
echo "64bit"
|
||||||
|
;;
|
||||||
|
"28")
|
||||||
|
# aarch32
|
||||||
|
echo "32bit"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Unknown
|
||||||
|
echo ""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Check system memory and swap space
|
# Check system memory and swap space
|
||||||
memory_check() {
|
memory_check() {
|
||||||
# Get totals in bytes
|
# Get totals in bytes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user