Add fallback for debug upload (#4194)
* Add fallback for debug upload in case ix.io is unreachable * Update packages/bsp/common/usr/bin/armbianmonitor Co-authored-by: hzyitc <h1260071766@126.com> * adjust url * fix missing sentence * Fix broken logic * Set paste.armbian.com as default service y Co-authored-by: hzyitc <h1260071766@126.com> Co-authored-by: Igor Pečovnik <igorpecovnik@users.noreply.github.com> Co-authored-by: Igor <igor@armbian.com>
This commit is contained in:
parent
7afa645b38
commit
42d0138b64
@ -146,24 +146,40 @@ ParseOptions() {
|
||||
exit 0
|
||||
;;
|
||||
u)
|
||||
# Upload /var/log/armbian-hardware-monitor.log with additional support info
|
||||
fping ix.io 2>/dev/null | grep -q alive
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\nNetwork/firewall problem detected. Not able to upload debug info.\nPlease fix this or use \"-U\" instead and upload ${BOLD}whole output${NC} manually\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
which curl >/dev/null 2>&1 || apt-get -f -qq -y install curl
|
||||
echo -e "System diagnosis information will now be uploaded to \c"
|
||||
# we obfuscate IPv4 addresses somehow but not too much, MAC addresses have to remain
|
||||
# in clear since otherwise the log becomes worthless due to randomly generated
|
||||
# addresses here and there that might conflict
|
||||
CollectSupportInfo \
|
||||
| sed -E 's/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' \
|
||||
| curl -F 'f:1=<-' ix.io
|
||||
echo -e "Please post the URL in the forum where you've been asked for.\n"
|
||||
exit 0
|
||||
;;
|
||||
U)
|
||||
# Upload /var/log/armbian-hardware-monitor.log with additional support info
|
||||
which curl >/dev/null 2>&1 || apt-get -f -qq -y install curl
|
||||
echo -e "System diagnosis information will now be uploaded to \c"
|
||||
fping paste.armbian.com 2>/dev/null | grep -q alive
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\nNetwork/firewall problem detected.\nTrying fallback..." >&2
|
||||
fping ix.io 2>/dev/null | grep -q alive
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "\nNetwork/firewall problem detected. Not able to upload debug info.\nPlease fix this or use \"-U\" instead and upload ${BOLD}whole output${NC} manually to an online pasteboard service\nand provide the URL in the forum where you have been asked for this.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# we obfuscate IPv4 addresses somehow but not too much, MAC addresses have to remain
|
||||
# in clear since otherwise the log becomes worthless due to randomly generated
|
||||
# addresses here and there that might conflict
|
||||
CollectSupportInfo \
|
||||
| sed -E 's/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' \
|
||||
| curl -F 'f:1=<-' ix.io
|
||||
echo -e "Please post the URL in the forum where you've been asked for.\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# we obfuscate IPv4 addresses somehow but not too much, MAC addresses have to remain
|
||||
# in clear since otherwise the log becomes worthless due to randomly generated
|
||||
# addresses here and there that might conflict
|
||||
CollectSupportInfo \
|
||||
| sed -E 's/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' \
|
||||
| curl -s --data-binary @- "https://paste.armbian.com/documents" \
|
||||
| awk -F'"' '{ print "https://paste.armbian.com/" $4 }'
|
||||
echo -e "Please post the URL in the forum where you've been asked for.\n"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
U)
|
||||
# Send support info to stdout to be uploaded manually. Add line numbers to prevent
|
||||
# users being creative and supressing everything that's important
|
||||
CollectSupportInfo \
|
||||
@ -858,7 +874,8 @@ gwYNGjRo0KBBw1eEfwH4UoBHAKAAAA==" | base64 --decode | tar xzf -
|
||||
|
||||
CollectSupportInfo() {
|
||||
[[ -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
|
||||
[[ -f /boot/armbianEnv.txt ]] && LOGLEVEL=$(awk -F'=' '/^verbosity/ {print $2}' /boot/armbianEnv.txt) || LOGLEVEL=1
|
||||
[[ -f /boot/armbianEnv.txt ]] && LOGLEVEL=$(awk -F'=' '/^verbosity/ {print $2}' /boot/armbianEnv.txt)
|
||||
LOGLEVEL=${LOGLEVEL:-1}
|
||||
if [ ${LOGLEVEL} -gt 4 ]; then
|
||||
VERBOSE='-v'
|
||||
which lshw >/dev/null 2>&1 && (echo -e "\n### lshw:" ; lshw -quiet -sanitize -numeric)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user