-
-
Notifications
You must be signed in to change notification settings - Fork 474
/
quickreport
executable file
·121 lines (109 loc) · 3.54 KB
/
quickreport
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env bash
quick_report() {
local GPUS
local OS_KERNEL
local PRETTY_NAME
local QUICKEMU
local VERSION
OS_KERNEL=$(uname -s)
if [ "${OS_KERNEL}" == "Darwin" ]; then
# Get macOS product name and version using swvers
if [ -x "$(command -v sw_vers)" ]; then
PRETTY_NAME="$(sw_vers -productName) $(sw_vers -productVersion)"
else
PRETTY_NAME="macOS"
fi
elif [ -e /etc/os-release ]; then
PRETTY_NAME=$(grep PRETTY_NAME /etc/os-release | cut -d'"' -f2)
else
PRETTY_NAME="Unknown OS"
fi
CWD="$(dirname "${0}")"
if [ -x "${CWD}/quickemu" ]; then
QUICKEMU="${CWD}/quickemu"
elif [ -x "$(command -v quickemu)" ]; then
QUICKEMU="$(command -v quickemu)"
fi
if [ -n "${QUICKEMU}" ]; then
VERSION=$(${QUICKEMU} --version)
echo \
"----------------------------------
Quickemu ${VERSION}
----------------------------------"
echo -e "Distro:\t${PRETTY_NAME}"
echo -e "Kernel:\t$(uname -s -r -m)"
if [ "${OS_KERNEL}" == "Darwin" ]; then
echo -e "Memory:\t$(($(sysctl -n hw.memsize) / (1048576*1024)))G"
else
# Determine the number of gigabytes of RAM in the host by extracting the first numerical value from the output.
echo -e "Memory:\t$(free --giga -h | tr ' ' '\n' | grep -m 1 "[0-9]" | cut -d'G' -f 1)G"
fi
# Break IFS on new line
IFS=$'\n'
if [ "${OS_KERNEL}" == "Darwin" ]; then
# Get GPU information using system_profiler
GPUS=$(system_profiler SPDisplaysDataType | grep "Chipset Model" | awk -F: '{print $2}' | sed 's/^ *//')
else
GPUS=$(lspci | grep -i vga | cut -d':' -f3)
fi
if [ "$(echo "${GPUS}" | wc -l)" -eq 1 ]; then
echo "GPU:"
else
echo "GPUs:"
fi
for GPU in ${GPUS}; do
echo " -${GPU}"
done
else
echo \
"----------------------------------
Quickemu missing!
----------------------------------"
exit 1
fi
if command -v curl &> /dev/null; then
VERSION=$(curl --version)
echo \
"----------------------------------
curl $(echo "${VERSION}" | head -n 1 | cut -d' ' -f2)
----------------------------------"
echo -e "Libraries:$(echo "${VERSION}" | head -n 1 | cut -d')' -f2-)"
echo -e "Protocols:$(echo "${VERSION}" | tail -n +3 | head -n 1 | cut -d':' -f2-)"
echo -e "Features: $(echo "${VERSION}" | tail -n +4 | head -n 1 | cut -d':' -f2-)"
else
echo \
"----------------------------------
curl missing
----------------------------------"
fi
local HOST_ARCH
HOST_ARCH=$(uname -m)
local QEMU_ARCH="${HOST_ARCH}"
if [ "${HOST_ARCH}" == "arm64" ]; then
QEMU_ARCH="aarch64"
fi
if command -v "qemu-system-${QEMU_ARCH}" &> /dev/null; then
VERSION=$("qemu-system-${QEMU_ARCH}" --version | head -n 1 | cut -d' ' -f4)
echo \
"----------------------------------
QEMU ${VERSION}
----------------------------------"
"qemu-system-${QEMU_ARCH}" -cpu help
else
echo \
"----------------------------------
QEMU missing
----------------------------------"
fi
echo \
"----------------------------------
CPU
----------------------------------"
if [ "${OS_KERNEL}" == "Darwin" ]; then
sysctl -n machdep.cpu.brand_string
else
lscpu
fi
}
clear
quick_report | tee quickreport.txt