Skip to content

Commit 0ac9c6b

Browse files
committed
fix a bunch of more or less significant issues
1 parent 1ee165a commit 0ac9c6b

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

packages/bsp/common/usr/bin/armbian-debug

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ Main() {
7878
sed -E 's/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' |
7979
curl -s --fail --data-binary @- "https://${paste_server}/log"
8080

81+
# Save PIPESTATUS before any other command
82+
pipe_status=("${PIPESTATUS[@]}")
83+
8184
# Check PIPESTATUS
82-
for i in "${PIPESTATUS[@]}"; do
85+
for i in "${pipe_status[@]}"; do
8386
counter=$((counter + 1))
8487
if [[ $i -ne 0 ]]; then
8588
echo "Failed (pipe ${counter} returned ${i})."
@@ -93,7 +96,7 @@ Main() {
9396
done
9497

9598
if [ "$upload_success" = true ]; then
96-
echo -e "\n${BOLD}Upload successful!${NC} Please post the URL above in the forum.\n"
99+
echo -e "\n${BOLD}Upload successful!${NC} Please post the URL at the place where you have been asked for.\n"
97100
else
98101
echo -e "\n${BOLD}All upload attempts failed. Outputting to stdout instead:${NC}\n"
99102
CollectSupportInfo |
@@ -108,7 +111,7 @@ CollectSupportInfo() {
108111
[[ -s /var/log/armbian-hardware-monitor.log ]] && cat /var/log/armbian-hardware-monitor.log || zcat /var/log/armbian-hardware-monitor.log.1.gz 2> /dev/null
109112
[[ -f /boot/armbianEnv.txt ]] && LOGLEVEL=$(awk -F'=' '/^verbosity/ {print $2}' /boot/armbianEnv.txt)
110113
LOGLEVEL=${LOGLEVEL:-1}
111-
if [ ${LOGLEVEL} -gt 4 ]; then
114+
if [ "$LOGLEVEL" -gt 4 ]; then
112115
VERBOSE='-v'
113116
which lshw > /dev/null 2>&1 && (
114117
echo -e "\n### lshw:"
@@ -129,23 +132,21 @@ CollectSupportInfo() {
129132
echo -e "\n### nvme:\n"
130133
nvme list 2> /dev/null
131134
)
132-
[ -z $SUDO_USER ] || echo -e "\n### Group membership of $(groups $SUDO_USER)"
135+
[ -z "$SUDO_USER" ] || echo -e "\n### Group membership of $(groups "$SUDO_USER")"
133136
echo -en "\n### Userland"
134137
[[ -f /etc/armbian-release ]] && echo -en " generated with Armbian Build Framework"
135138
echo -en ":\n"
136139
echo -e "\n$(grep PRETTY_NAME /etc/os-release)"
137140
echo -e "\n### Installed packages:\n\n$(dpkg -l | grep -E "openmediavault|armbian| linux-")"
138-
KernelVersion=$(awk -F" " '{print $3}' < /proc/version)
139-
case ${KernelVersion} in
140-
3.*)
141-
[[ -e /boot/script.bin ]] && echo -e "\n### fex settings: $(ls -la /boot/script.bin)\n\n$(bin2fex /boot/script.bin 2> /dev/null)"
142-
;;
143-
esac
144141
echo -e "\n### Loaded modules:\n\n$(lsmod)"
145142
[[ -f /var/log/nand-sata-install.log ]] && echo -e "\n### nand-sata-install.log:\n\n$(cat /var/log/nand-sata-install.log)"
146143
echo -e "\n### Current sysinfo:\n\n$(command -v iostat >/dev/null 2>&1 && iostat -p ALL | grep -v "^loop")\n\n$(vmstat -w)\n\n$(free -h)\n\n$(zramctl 2> /dev/null)\n\n$(uptime)\n\n$(dmesg | tail -n 250)"
147144
echo -e "\n"
148-
[[ "$(id -u)" -eq "0" ]] && for sysfsnode in /proc/sys/vm/*; do sysctl $(echo ${sysfsnode} | sed 's|/proc/sys/vm/|vm.|'); done
145+
if [[ "$(id -u)" -eq "0" ]]; then
146+
for sysfsnode in /proc/sys/vm/*; do
147+
sysctl "${sysfsnode/\/proc\/sys\/vm\//vm.}"
148+
done
149+
fi
149150
echo -e "\n### interrupts:\n$(cat /proc/interrupts)"
150151
ls /tmp/armbianmonitor_checks_* > /dev/null 2>&1 || return 0
151152
for file in /tmp/armbianmonitor_checks_*; do

0 commit comments

Comments
 (0)